pyiqa.archs.qrealign_arch ========================= .. py:module:: pyiqa.archs.qrealign_arch .. autoapi-nested-parse:: Q-ReAlign: a modern, model-agnostic Q-Align visual-quality scorer. Q-ReAlign reproduces the Q-Align recipe on a Qwen3.5-VL backbone (``model_type: qwen3_5``): the model is asked to rate quality, and the probability mass it places on the discrete words ``excellent / good / fair / poor / bad`` is collapsed -- via the fixed weighting ``[1.0, 0.75, 0.5, 0.25, 0.0]`` -- into a single scalar in ``[0, 1]`` (higher = better). Three public checkpoints (selected with ``model=``): mini -> q-future/Q-ReAlign-Mini-0.8B (fast, throughput champion) lite -> q-future/Q-ReAlign-Lite-4B pro -> q-future/Q-ReAlign-Pro-9B (best average SRCC/PLCC) Requires ``transformers>=5.0`` (native qwen3_5 from 5.2; 5.0/5.1 run via the vendored modeling + shim in ``pyiqa.archs.qrealign``). Reference: Wu et al., "Q-Align: Teaching LMMs for Visual Scoring via Discrete Text-Defined Levels", arXiv:2312.17090. Q-ReAlign: https://github.com/Q-Future/Q-ReAlign Module Contents --------------- .. py:data:: LEVELS :value: ['excellent', 'good', 'fair', 'poor', 'bad'] .. py:data:: WEIGHTS :value: [1.0, 0.75, 0.5, 0.25, 0.0] .. py:data:: MODELS .. py:data:: TASKS .. py:class:: QReAlign(model='mini', dtype='auto', task='quality') Bases: :py:obj:`torch.nn.Module` Q-ReAlign multimodal visual-quality scorer (Qwen3.5-VL backbone). :param model: one of ``'mini'`` / ``'lite'`` / ``'pro'`` (see ``MODELS``), or any HuggingFace repo id / local path to a Q-ReAlign checkpoint. :type model: str :param dtype: torch dtype passed to ``from_pretrained`` (default ``'auto'`` -> bfloat16 weights). :type dtype: str :param task: default scoring task, ``'quality'`` (IQA) or ``'aesthetic'`` (IAA). :type task: str .. py:method:: forward(x, task_=None) Score a batch of images. :param x: ``(B, 3, H, W)`` in ``[0, 1]``. :type x: torch.Tensor :param task_: override the default task for this call. :type task_: str :returns: shape ``(B,)`` quality scores in ``[0, 1]`` (higher = better). :rtype: torch.Tensor