Skip to content

fix(qwen3-vl): fall back to hf_hub_download for mmraw preprocessor_config.json#82

Merged
hubert-marek merged 2 commits into
feat/ephemeral-mm-pixelsfrom
fix/mmraw-hub-download-fallback
Jun 10, 2026
Merged

fix(qwen3-vl): fall back to hf_hub_download for mmraw preprocessor_config.json#82
hubert-marek merged 2 commits into
feat/ephemeral-mm-pixelsfrom
fix/mmraw-hub-download-fallback

Conversation

@hubert-marek

@hubert-marek hubert-marek commented Jun 9, 2026

Copy link
Copy Markdown

Problem

The raw-image (mmraw) layout path (db5058e) resolves the model's image geometry from preprocessor_config.json, but _load_preprocessor_config_json only checks local paths and the local HF cache (try_to_load_from_cache). Hosted env workers render models they never loaded locally, so hub-style ids always miss the cache and every image rollout fails:

RuntimeError: Qwen raw image layout could not find preprocessor_config.json for
'Qwen/Qwen3.6-35B-A3B'. Ensure the model is cached locally or set all image_*
layout fields explicitly in the renderer config.

…even when the file is publicly available on the Hub. Hit in production on worldsims gflights-booking RL runs (Qwen3.6-35B-A3B); currently worked around by passing the five explicit image_* layout fields through chat_template_kwargs in the run config.

Fix

On cache miss for a hub-style id, fall back to hf_hub_download(model_id, "preprocessor_config.json") — a few hundred bytes, lands in the HF cache, then memoized by the existing lru_cache. Offline/no-network workers fall through to the existing RuntimeError, whose message now also mentions Hub reachability alongside the explicit image_* config escape hatch.

Test

test_qwen3_vl_preprocessor_config_hub_download_fallback: cache-miss → fallback download succeeds and parses; offline download failure → RuntimeError preserved.

tests/test_client.py -k 'hub_download_fallback or raw_mode_render' → 2 passed

🤖 Generated with Claude Code


Note

Low Risk
Narrow change to config resolution for hub model IDs with existing error paths when offline; adds optional Hub network fetch on cache miss only.

Overview
Fixes Qwen3-VL mmraw image rollouts on workers that never cached the model locally: when preprocessor_config.json is missing from disk and try_to_load_from_cache misses, _load_preprocessor_config_json now falls back to hf_hub_download (small file, then existing lru_cache). Offline or failed downloads still raise the same RuntimeError, with an updated message that also points to Hub reachability and explicit image_* layout overrides.

Adds test_qwen3_vl_preprocessor_config_hub_download_fallback to cover successful hub fallback and preserved failure when download is unavailable.

Reviewed by Cursor Bugbot for commit f146935. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fall back to hf_hub_download in _load_preprocessor_config_json for Qwen3-VL when cache misses

Previously, _load_preprocessor_config_json in qwen3_vl.py would raise a RuntimeError if no cached preprocessor_config.json was found for a hub-style model ID. It now attempts hf_hub_download as a fallback before raising. The error message is also updated to mention that the model must be reachable on the Hugging Face Hub.

Changes since #82 opened

  • Reformatted code style and documentation in _load_preprocessor_config_json utility function [f146935]

Macroscope summarized 91f3040.

…nfig.json

The raw-image (mmraw) layout path resolves the model's image geometry from
preprocessor_config.json, but _load_preprocessor_config_json only checked
local paths and the local HF cache (try_to_load_from_cache). Hosted env
workers render models they never loaded locally, so hub-style ids always
missed the cache and every image rollout failed with

  RuntimeError: Qwen raw image layout could not find
  preprocessor_config.json for 'Qwen/Qwen3.6-35B-A3B' ...

even when the file is publicly available on the Hub.

Add an hf_hub_download fallback on cache miss (a few hundred bytes, lands in
the HF cache, then memoized by the lru_cache). Offline/no-network workers
fall through to the existing RuntimeError, whose message now also mentions
Hub reachability alongside the explicit image_* config escape hatch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 9, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 9, 2026

Copy link
Copy Markdown

Approvability

Verdict: Approved

Straightforward bug fix adding a fallback to download preprocessor_config.json from Hugging Face Hub when local cache misses. The change is small, self-contained with proper error handling, and includes comprehensive test coverage.

You can customize Macroscope's approvability policy. Learn more.

@hubert-marek

Copy link
Copy Markdown
Author

@cursoragent fix the ruff and style here - make comments concise

@cursor

cursor Bot commented Jun 10, 2026

Copy link
Copy Markdown

You need to increase your spend limit or enable usage-based billing to run background agents. Go to Cursor

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@macroscopeapp macroscopeapp Bot dismissed their stale review June 10, 2026 05:00

Dismissing prior approval to re-evaluate f146935

@hubert-marek hubert-marek merged commit 462149b into feat/ephemeral-mm-pixels Jun 10, 2026
2 of 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