pyiqa.archs.qrealign.qrealign_compat ==================================== .. py:module:: pyiqa.archs.qrealign.qrealign_compat .. autoapi-nested-parse:: 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 --------------- .. py:data:: init .. py:data:: oc .. py:function:: capture_outputs(fn) .. py:data:: g .. py:function:: merge_with_config_defaults(fn) .. py:function:: maybe_autocast(device_type='cuda', enabled=True, **kw) .. py:function:: is_flash_attention_requested(config) .. py:data:: u .. py:function:: torch_compilable_check(*a, **k) .. py:data:: integ .. py:function:: use_kernelized_func(*da, **dk) .. py:data:: cu .. py:function:: get_interface(self, key, default=None) .. py:function:: ensure_qwen3_5() 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)``. .. py:function:: load_processor(ckpt) 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.