Skip to content

Add CPU checkpoint loading for Laya - #21

Merged
hsliuustc0106 merged 4 commits into
ThinkFlowLab:mainfrom
linear3735:codex/laya-checkpoint
Oct 2, 2026
Merged

hsliuustc0106 merged 4 commits into
ThinkFlowLab:mainfrom
linear3735:codex/laya-checkpoint

Conversation

@linear3735

@linear3735 linear3735 commented Sep 28, 2026 •

Copy link
Copy Markdown

Purpose

Read Laya configuration and weights, validate tensor names and shapes, and convert FP32/FP16/BF16 values. Backends choose their storage precision. Refs #14.

Checkpoint tests live in tests/laya/ and remain registered with the omni-laya crate. Moving them does not change test contents or commands.

Test Plan

cargo fmt --all --check
cargo clippy --workspace --locked --all-targets -- -D warnings
cargo test --workspace --locked
cargo build --workspace --release --locked

With the pinned checkpoint and PyTorch oracle, run:

cargo test --release --locked -p omni-laya --test weights -- --ignored

System1-Omni Version / Commit: 219808b; includes upstream 566dec1.

Test Result

All four workspace checks passed; 25 CPU tests passed and four external-data/GPU tests were skipped by default.

Both full-checkpoint CPU tests passed separately after the move: all 206 tensor names/shapes and 618 conversion hashes matched the existing PyTorch 2.14.0 reference for checkpoint 55cf4c4ebb4ebe31b2550e8bdf3bd21b99753851. No GPU tests ran.

Rust CI, Docs build and benchmark harness tests passed for this update.

Self-review

Before marking this PR ready for review or requesting maintainer review, complete
the self-review checklist.
Keep the PR in draft while this work is incomplete.
For agent assistance, use the optional precheck-pr skill.

  • I have reviewed the full diff and addressed the issues I found.
  • I have checked that the change follows the project's architecture and stays focused on the stated purpose.
  • I have run the checks appropriate to this change and reported commands, results, and anything I could not verify above.
  • I have checked that the PR description, documentation, and any accuracy or performance claims match the implementation and available evidence.

The inventory mismatch reported only that the sets were unequal, so the
most likely failure -- pointing the engine at a checkpoint that is not the
frozen one -- said nothing about which tensor was wrong or in which
direction. Both sets were already in scope.

Report the expected-only names as "missing" and the checkpoint-only names
as "unexpected", sorted, so the message is deterministic. The neighbouring
errors already name their tensor (duplicate expected tensor, shape mismatch,
unsupported dtype); this was the one that did not.

Adds a CPU test over the synthetic safetensors fixture that asserts both
directions and the ordering.

fmt, clippy -D warnings, and the workspace tests pass; the checkpoint test
that exercises this path still passes against the frozen checkpoint.

@hsliuustc0106 hsliuustc0106 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed commit c8cebc4db70bea6855fac1c2913f335f4df23f95.

No findings. 6 CPU tests passed; 2 full-checkpoint tests ignored without local weights.

@hsliuustc0106

Copy link
Copy Markdown
Contributor

resolve conflicts

Comment thread tests/laya/checkpoint.rs
@@ -0,0 +1,205 @@
use omni_laya::{config::Config, weights::Weights};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests should not be placed here

@hsliuustc0106 hsliuustc0106 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 86c4c5a25b795be5e9e3c7cad402b230011592b7.

No actionable findings. Formatting, Clippy, release build, strict docs build, and all 25 workspace tests passed. Both full-checkpoint CPU tests also passed: 206 tensor names/shapes and 618 conversion hashes matched the PyTorch 2.8.0 CPU reference for checkpoint 55cf4c4ebb4ebe31b2550e8bdf3bd21b99753851. The two GPU tests were not run.

@hsliuustc0106
hsliuustc0106 merged commit 1be7d41 into ThinkFlowLab:main Oct 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants