Repository navigation
test(vision): refresh the DeepSeek-OCR CLIP reference for quick GELU - #3578
Merged
Merged
Conversation
Mark scripts/deepseekocr_encoder_reference.py executable in Git, which the python tooling check requires for scripts with a shebang. Load the model with mlx_vlm.utils.load_model so the script no longer depends on tokenizer and processor resolution, which fails under transformers 5.24.1 for this checkpoint. Resolve the test checkpoint through tests/common so MLXCEL_REQUIRE_MODELS=1 fails instead of silently skipping. Refs lablup#3563 Refs lablup#3578
Member
|
Maintainer hardening review, with a follow-up commit Independent measurement on GB10 (spark-102, sm_121)I installed mlx-vlm 0.8.1 with
The new target reproduces from an independent reference, and the erf variant lands 0.0129 away, about 2.6 times the unchanged 0.005 tolerance, so the check still rejects the old activation. Fixes in
|
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the GB10 failure in #3563. The requested Metal run is still outstanding.
The model is already using the right activation. The expected CLIP mean still describes the older erf-GELU implementation, even though #3456 switched the MLP to the quick GELU used by mlx-vlm. Refresh the reference mean and replace the test's pointer to a missing scratchpad script with a runnable, independent mlx-vlm reference. No inference code, SAM expectation, or tolerance changes.
On GB10, using mlx-community/DeepSeek-OCR-4bit revision
4958b6b, mlx-vlm 0.8.1 and MLX 0.32.4, I ran the same deterministic bf16 input through the reference SAM once, then through the reference CLIP with and without substituting the old erf GELU:The old target is 0.14356. The new target, 0.13067, comes from unmodified mlx-vlm, not the implementation under test. The original 0.005 tolerance rejects the erf variant by more than a factor of two.
To regenerate:
python scripts/deepseekocr_encoder_reference.py models/deepseek-ocr-4bitwith mlx-vlm installed. The input normalization runs in float32 before the cast to bf16, matching the Rust fixture.Metal: no Metal device on the test host. The Metal review of #3456 covered related library tests, not this checkpoint-gated integration test; a run of this specific test on Metal remains unverified.
The macOS nightly workflow also documents that its self-hosted runner has no model weights and that checkpoint-gated tests self-skip. A green test name there would not by itself establish an encoder measurement on Metal.
On the unmodified Rust base
60cd7d657, the checkpoint-gated CUDA integration test really executed and failed: SAM 0.04305, CLIP 0.13067141 (test exit 101). On the candidate, the same SAM and CLIP signatures, including the first four values, pass the unchanged tolerances (test exit 0).cargo fmt --all -- --checkalso passed.As a separate diagnostic, with the same checkpoint and SAM handoff, I stopped both CLIP encoders after 1, 6, 12, 18 and 24 transformer blocks. These are float32 reductions of the bf16 hidden states (not just the final layer):
Final GB10
make verify-test-cudacompleted (exit 0): 17,947 passed, 0 failed, 519 ignored, including the real-checkpoint integration test. A first run failed unrelated PTX cache trust checks because the temporary build directory was group-writable; the successful rerun used private directories, without source changes.