Skip to content

armgit / laya

Public Imported from GitHub
0

Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.

docs(go): say what onnx requires, and that it builds only in-repo until core is tagged

Adeshina Lasisic6e1afd07c5a
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
index 61846951..0be0ace1 100644
--- a/.github/workflows/go.yml
+++ b/.github/workflows/go.yml
@@ -181,8 +181,8 @@ jobs:
pip install -r laya-dotnet/tools/requirements-regen.txt
# The key is byte-identical to the multilingual predict cell in java.yml, so both share one
- # entry. Like Java's, it is blind to model code outside laya/common.py; the `.laya-revision`
- # stamp `prepare_checkpoint.py` reads is what stops a stale graph being reused.
+ # entry. Like Java's, it is blind to model code outside laya/common.py. The key hashes
+ # prepare_checkpoint.py, which holds HF_REVISION, so a revision bump misses the cache.
- name: Cache the exported graph
id: graph
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
diff --git a/laya-go/README.md b/laya-go/README.md
index 16f97e20..85a47ed6 100644
--- a/laya-go/README.md
+++ b/laya-go/README.md
@@ -1,9 +1,10 @@
# laya-go
-A pure-Go port of [laya](../README.md). Standard library only: no cgo, no third-party modules.
+A pure-Go port of [laya](../README.md). This module is standard library only: no cgo, no third-party
+modules. Running the model needs the nested `onnx` module, which uses cgo.
The foundation (language detection, questions, sequences, the tokenizer) and the predict path
-(`infer`, `agent`) are here. The native ONNX session and the router come in later changes.
+(`infer`, `agent`) are here, and the `onnx` module runs the graph. The router comes in a later change.
| Package | What it is |
| --- | --- |
@@ -42,8 +43,9 @@ order-sensitive state. `Analyze` reads every leaf, so its cost grows with the nu
- No root package: the module path ends in `laya-go`, so tags are `laya-go/vX.Y.Z`.
- Every package in this module is pure Go: `lang`, `schema`, `sequence`, `tokenizer`, `infer` and
`agent` now, and `router`, `presets` and `shortlist` later.
-- cgo will live only in an `onnx` package, a nested module with its own `go.mod`, so `go test ./...`
- here never compiles it. Importing `lang` or `agent` never compiles cgo.
+- cgo lives only in `onnx`, a nested module with its own `go.mod`, so `go test ./...` here never
+ compiles it. `onnx` requires this module and `github.com/yalue/onnxruntime_go`; until this module has
+ a release tag, `onnx` builds only inside this repository (its `go.mod` points here with `replace`). Importing `lang` or `agent` never compiles cgo.
- `tokenizer` is public (`LoadFS`, `Parse`); `internal/unicodedata`, `internal/pyjson`,
`internal/decode` and `internal/collate` stay internal. `infer.Batch` is the public name of
what `collate` builds.
diff --git a/laya-go/agent/contract_test.go b/laya-go/agent/contract_test.go
index c5ec0e14..288afa45 100644
--- a/laya-go/agent/contract_test.go
+++ b/laya-go/agent/contract_test.go
@@ -72,7 +72,7 @@ func blockedClose(t *testing.T, s *fakeSession, states []any, opts ...agent.Call
}
}
-// TestCloseBehindABlockedRunDoesNotStallNewCalls is the reviewer's scenario: Close waits on a
+// TestCloseBehindABlockedRunDoesNotStallNewCalls covers this scenario: Close waits on a
// call stuck in the session, and a new call, even one with a dead context, must not wait too.
func TestCloseBehindABlockedRunDoesNotStallNewCalls(t *testing.T) {
s := &fakeSession{}
diff --git a/laya-go/agent/lifecycle_test.go b/laya-go/agent/lifecycle_test.go
index 12b1caf8..62f6ffa2 100644
--- a/laya-go/agent/lifecycle_test.go
+++ b/laya-go/agent/lifecycle_test.go
@@ -15,7 +15,7 @@ import (
"github.com/NandhaKishorM/laya/laya-go/sequence"
)
-// TestEnteringNeverWaitsForACallInFlight is the scenario of the second review: a Run is blocked,
+// TestEnteringNeverWaitsForACallInFlight is this scenario: a Run is blocked,
// predictors with a short context arrive as Close begins, and none may wait for that Run.
func TestEnteringNeverWaitsForACallInFlight(t *testing.T) {
s := &fakeSession{}
diff --git a/laya-go/onnx/doc.go b/laya-go/onnx/doc.go
index 2e176e21..0b6800b4 100644
--- a/laya-go/onnx/doc.go
+++ b/laya-go/onnx/doc.go
@@ -2,7 +2,9 @@
// agent package can answer questions with it.
//
// It is a separate module because it needs cgo and a native ONNX Runtime shared library
-// (1.29 or newer, which the caller supplies). Open takes the fused laya.onnx, whose .data
+// (1.29 or newer, which the caller supplies). It requires the core laya-go module and
+// github.com/yalue/onnxruntime_go; until the core module is tagged it builds only inside the
+// laya repository, where go.mod points at it with a replace directive. Open takes the fused laya.onnx, whose .data
// sidecar must sit beside it, and runs it on the CPU provider:
//
// sess, err := onnx.Open("laya.onnx", onnx.WithLibrary("/opt/onnxruntime/libonnxruntime.so.1.30.0"))