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(ci): the safetensors floor is a boundary, not an unclosed gap

Adeshina Lasisi0d0c73e31772
diff --git a/laya-dotnet/tools/export_onnx.py b/laya-dotnet/tools/export_onnx.py
index f2d15694..17a0d9d8 100644
--- a/laya-dotnet/tools/export_onnx.py
+++ b/laya-dotnet/tools/export_onnx.py
@@ -146,6 +146,16 @@ def verify_snapshot(directory, label, required=()):
except Exception as problem:
problems.append("%s: %d bytes, not valid JSON (%s)" % (shown, size, problem))
elif name.endswith(".safetensors") and size < 1024:
+ # A floor, not a completeness check, and deliberately so: `safetensors` already
+ # validates that the tensor byte ranges cover the file, and says so clearly --
+ # a 2.3 GB weights file truncated to 500 KB raises `SafetensorError: Error while
+ # deserializing header: incomplete metadata, file not fully covered`, in the
+ # exporter, seconds after the fetch. That is self-diagnosing, which is exactly
+ # what the 0-byte `tokenizer.json` was NOT: it surfaced as `EOF while parsing a
+ # value at line 1 column 0` from a .NET constructor, in a test, ninety seconds
+ # later, naming neither a file nor a download. So this only catches a file too
+ # short to hold the 8-byte length prefix and a header at all, where the loader's
+ # own error would be about a malformed header rather than a truncated download.
problems.append("%s: %d bytes, too small to hold a header" % (shown, size))
if problems:
raise SystemExit(
diff --git a/laya-dotnet/tools/regen_golden.py b/laya-dotnet/tools/regen_golden.py
index 7c7248fc..a71f8a64 100644
--- a/laya-dotnet/tools/regen_golden.py
+++ b/laya-dotnet/tools/regen_golden.py
@@ -173,6 +173,16 @@ def verify_snapshot(directory, label, required=()):
except Exception as problem:
problems.append("%s: %d bytes, not valid JSON (%s)" % (shown, size, problem))
elif name.endswith(".safetensors") and size < 1024:
+ # A floor, not a completeness check, and deliberately so: `safetensors` already
+ # validates that the tensor byte ranges cover the file, and says so clearly --
+ # a 2.3 GB weights file truncated to 500 KB raises `SafetensorError: Error while
+ # deserializing header: incomplete metadata, file not fully covered`, in the
+ # exporter, seconds after the fetch. That is self-diagnosing, which is exactly
+ # what the 0-byte `tokenizer.json` was NOT: it surfaced as `EOF while parsing a
+ # value at line 1 column 0` from a .NET constructor, in a test, ninety seconds
+ # later, naming neither a file nor a download. So this only catches a file too
+ # short to hold the 8-byte length prefix and a header at all, where the loader's
+ # own error would be about a malformed header rather than a truncated download.
problems.append("%s: %d bytes, too small to hold a header" % (shown, size))
if problems:
raise SystemExit(
diff --git a/laya-java/scripts/prepare_checkpoint.py b/laya-java/scripts/prepare_checkpoint.py
index 6e5e746e..4593e5ad 100755
--- a/laya-java/scripts/prepare_checkpoint.py
+++ b/laya-java/scripts/prepare_checkpoint.py
@@ -167,6 +167,16 @@ def verify_snapshot(directory, label, required=()):
except Exception as problem:
problems.append("%s: %d bytes, not valid JSON (%s)" % (shown, size, problem))
elif name.endswith(".safetensors") and size < 1024:
+ # A floor, not a completeness check, and deliberately so: `safetensors` already
+ # validates that the tensor byte ranges cover the file, and says so clearly --
+ # a 2.3 GB weights file truncated to 500 KB raises `SafetensorError: Error while
+ # deserializing header: incomplete metadata, file not fully covered`, in the
+ # exporter, seconds after the fetch. That is self-diagnosing, which is exactly
+ # what the 0-byte `tokenizer.json` was NOT: it surfaced as `EOF while parsing a
+ # value at line 1 column 0` from a .NET constructor, in a test, ninety seconds
+ # later, naming neither a file nor a download. So this only catches a file too
+ # short to hold the 8-byte length prefix and a header at all, where the loader's
+ # own error would be about a malformed header rather than a truncated download.
problems.append("%s: %d bytes, too small to hold a header" % (shown, size))
if problems:
raise SystemExit(