fix(vision): DeepSeek-OCR CLIP encoder parity is off the mlx-vlm reference on CUDA

オープン
#3,563 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust

調査の方向性

Start with tests/deepseekocr_encoder_parity.rs and its header reference script, ref_dsocr_enc2.py; run the CUDA parity test on GB10 and compare each CLIP layer with mlx-vlm, since the SAM output already matches. Check the CLIP path in src/vision/encoders/deepseekocr_clip.rs and the CUDA SAM-to-CLIP handoff. Determine whether Metal also fails, identify the root cause, and keep the existing tolerance while making make verify-test-cuda pass.

索引モデルが issue の本文から書いたものです。

説明

area:models platform:linux priority:medium status:ready type:bug

Problem

sam_and_clip_encoders_match_reference in tests/deepseekocr_encoder_parity.rs (gated on models/deepseek-ocr-4bit, vision weights bf16) fails on GB10 (spark-102, sm_121, CUDA) at tests/deepseekocr_encoder_parity.rs:88 with CLIP absmean 0.130644 off reference.

[SAM] shape=[1, 16, 16, 1024] absmean=0.04302
[CLIP] shape=[1, 257, 1024] absmean=0.13064 first4=[0.12695, -0.22852, -0.59375, -0.04102]

SAM passes (reference 0.04304, tol 0.002). CLIP's reference is 0.14356 with tol 0.005, so the gap is about 0.013 (roughly 9%), well outside bf16 drift.

It fails identically on main at the previous MLX pin (fc344c98, commit bb0c8b3b) and at the new pin 5a48f9cc (#3517), so it predates the pin bump. It surfaced during the #3517 GB10 gate (make verify-test-cuda). Not yet checked: the Metal result, and when it started on CUDA. The test file was last changed by #651 (initial) and #2682 (quantized vision parameter loading hardening).

Since SAM matches and CLIP does not, the gap is in the CLIP path (ClipEncoder::from_weights(&weights, "vision_model", ClipConfig::default(), 64, 4), src/vision/encoders/deepseekocr_clip.rs) or the SAM-to-CLIP handoff on CUDA.

cargo test -p mlxcel --features cuda --profile test-fast --test deepseekocr_encoder_parity -- --test-threads=1

Acceptance Criteria

  • Determine whether the test passes on Metal (CUDA-only vs. both backends)
  • Root cause found, by bisect or a per-layer diff against mlx-vlm using the reference script the test header names (ref_dsocr_enc2.py)
  • Fixed so the test passes on GB10 with the existing tolerance; do not widen the tolerance without a diagnosed numeric reason
  • The test passes in make verify-test-cuda
主要言語
Rust
スター
505
フォーク
81
平均マージ
14時間 2分
マージ済み PR(30日)
448

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

lablup/mlxcel のほかの issue

lablup/mlxcel の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。