Skip to content

cua_s1: load and validate native vision checkpoints on CPU - #59

Merged
hsliuustc0106 merged 4 commits into
ThinkFlowLab:mainfrom
Levius-Fubuki:codex/cua-vision-loader
Oct 6, 2026
Merged

hsliuustc0106 merged 4 commits into
ThinkFlowLab:mainfrom
Levius-Fubuki:codex/cua-vision-loader

Conversation

@Levius-Fubuki

@Levius-Fubuki Levius-Fubuki commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Purpose

Add CPU VisionCheckpoint loading for Qwen3.5-4B and the Cua-S1 multimodal adapter. Validate configuration, the complete visual tensor inventories, shapes/dtypes, bounded offsets, shard routing, duplicate header/index keys and checkpoint path containment. Keep 297 BF16 base tensors and 100 FP32 LoRA tensors separate, with borrowed views backed by owned memory maps.

Updated onto main 7f39ac40902c374803992407bb26eeba29c8a588. The diff is four core files: the loader, its public export, the required Serde derive dependency and its lockfile dependency edge. It uses the existing shared Qwen/runtime layout. CUDA vision execution is supplied separately by #64.

Test Plan

Current head: 550ee0afae3475e488b5cb308a733ad41d1e9487. Baseline: 7f39ac40902c374803992407bb26eeba29c8a588.

Test Result (fresh, 2026-10-05)

The current production tree passed cargo fmt --all --check, cargo clippy --workspace --locked --all-targets -- -D warnings, cargo test --workspace --locked, and cargo build --workspace --release --locked on macOS arm64 / Rust 1.98.0. Workspace tests: 82 passed, 0 failed, 10 existing tests ignored (6 CUDA, 2 Laya checkpoint/oracle, 1 Laya packing, 1 Open-Jev tokenization). Benchmark CI checks also passed: 4 smoke requests validated and 8 Python tests passed.

Feature fixtures and examples remain outside this core-only diff. A fresh external Cargo runner imports the current production crate by path and uses its locked dependency versions; only the external root package is added to the runner lockfile. The feature harness is materialized from the linked pre-cleanup commit. No native CUDA, full multimodal inference, HTTP image path, model accuracy or performance claim is made by this CPU prerequisite PR.

The external release fixture suite passed all 13 cases, covering single/sharded checkpoints, ignored language-only tensors, shapes/dtypes/missing or extra tensors, malformed/truncated payloads, bad shard routes, duplicate keys, overflow offsets, paths/symlink escapes, vision config and adapter math/targets. A fresh loader execution over the local visual-only extracts matched all 397 Rust-accessor SHA-256 values against a fresh independent Python mmap calculation: 667,028,480 base bytes and 16,678,912 adapter bytes. Aggregate payload hashes also matched the pinned extraction manifest.

The extracts contain unchanged visual payloads from base revision 851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a and multimodal adapter revision 16818868b0cc7813808aae4e87b417657046ab79, repackaged with rebased offsets. This does not verify the original full checkpoint file hashes or execute the encoder. Checkpoint files must remain immutable while their maps/views are alive.

Harness sources and extraction recipe: pre-cleanup commit. Fresh local logs, runner lockfile and payload hash tables are archived under artifacts/all-pr-followups-20261005/cua/pr59/.

Self-review

Full current diff reviewed against the pinned main revision; shared execution/processing/runtime ownership and core-only scope retained. The CPU loader can merge independently as a prerequisite for #64. Maintainer review remains separate.

Demo / evidence

Actual CPU validation, not native encoder/HTTP inference. Raw logs and fixture/payload hashes remain local under the artifact path above, outside the core-code diff. No video is needed for these CPU prerequisites. Current-head GitHub Rust, benchmark and docs CI passed; deployment skipped. CI run.

…a-vision-loader

# Conflicts:
#	src/models/cua_s1/native/Cargo.toml
#	src/models/cua_s1/native/src/lib.rs
@Levius-Fubuki
Levius-Fubuki marked this pull request as ready for review October 5, 2026 15:48
Copilot AI balanced review requested due to automatic review settings October 5, 2026 15:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@hsliuustc0106
hsliuustc0106 merged commit 9e961f0 into ThinkFlowLab:main Oct 6, 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.

3 participants