pyiqa.archs.qrealign.qrealign_compat¶
Back-compat shim so transformers 5.0/5.1 can run the vendored qwen3_5 model.
qwen3_5 (the Qwen3.5-VL backbone behind Q-ReAlign) is natively supported only
in transformers >= 5.2. This module makes the vendored modeling code also run on
transformers 5.0/5.1 (and even 4.57) by patching the handful of internal symbols
that were added/renamed between those releases. It is idempotent and only
patches what is missing, so importing it on transformers >= 5.2 is a harmless no-op.
- Import this module BEFORE importing/using
qwen3_5. Public helpers: ensure_qwen3_5()– makeqwen3_5loadable (native if present, else vendored)load_processor(ckpt)– version-robust image-only Qwen3-VL processor loader
Module Contents¶
- pyiqa.archs.qrealign.qrealign_compat.maybe_autocast(device_type='cuda', enabled=True, **kw)[source]¶
- pyiqa.archs.qrealign.qrealign_compat.ensure_qwen3_5()[source]¶
Make the
qwen3_5architecture importable + Auto*-registered.On transformers >= 5.2 this is a no-op (native support). On 5.0/5.1 the vendored modeling files are injected into the installed transformers tree and registered with the Auto* factories. Returns
(Qwen3_5Config, Qwen3_5ForConditionalGeneration).
- pyiqa.archs.qrealign.qrealign_compat.load_processor(ckpt)[source]¶
Load the Q-ReAlign processor robustly across transformers 5.0 -> 5.x.
Prefers the native
AutoProcessor(works on 5.0+). Falls back to building an image-onlyQwen3VLProcessorfor releases whoseAutoProcessordemands a video sub-processor that image-only Q-ReAlign never uses.