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() – make qwen3_5 loadable (native if present, else vendored)

  • load_processor(ckpt)– version-robust image-only Qwen3-VL processor loader

Module Contents

pyiqa.archs.qrealign.qrealign_compat.init[source]
pyiqa.archs.qrealign.qrealign_compat.oc[source]
pyiqa.archs.qrealign.qrealign_compat.capture_outputs(fn)[source]
pyiqa.archs.qrealign.qrealign_compat.g[source]
pyiqa.archs.qrealign.qrealign_compat.merge_with_config_defaults(fn)[source]
pyiqa.archs.qrealign.qrealign_compat.maybe_autocast(device_type='cuda', enabled=True, **kw)[source]
pyiqa.archs.qrealign.qrealign_compat.is_flash_attention_requested(config)[source]
pyiqa.archs.qrealign.qrealign_compat.u[source]
pyiqa.archs.qrealign.qrealign_compat.torch_compilable_check(*a, **k)[source]
pyiqa.archs.qrealign.qrealign_compat.integ[source]
pyiqa.archs.qrealign.qrealign_compat.use_kernelized_func(*da, **dk)[source]
pyiqa.archs.qrealign.qrealign_compat.cu[source]
pyiqa.archs.qrealign.qrealign_compat.get_interface(self, key, default=None)[source]
pyiqa.archs.qrealign.qrealign_compat.ensure_qwen3_5()[source]

Make the qwen3_5 architecture 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-only Qwen3VLProcessor for releases whose AutoProcessor demands a video sub-processor that image-only Q-ReAlign never uses.