pyiqa.archs.qrealign_arch

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

pyiqa.archs.qrealign_arch.LEVELS = ['excellent', 'good', 'fair', 'poor', 'bad'][source]
pyiqa.archs.qrealign_arch.WEIGHTS = [1.0, 0.75, 0.5, 0.25, 0.0][source]
pyiqa.archs.qrealign_arch.MODELS[source]
pyiqa.archs.qrealign_arch.TASKS[source]
class pyiqa.archs.qrealign_arch.QReAlign(model='mini', dtype='auto', task='quality')[source]

Bases: torch.nn.Module

Q-ReAlign multimodal visual-quality scorer (Qwen3.5-VL backbone).

Parameters:
  • model (str) – one of 'mini' / 'lite' / 'pro' (see MODELS), or any HuggingFace repo id / local path to a Q-ReAlign checkpoint.

  • dtype (str) – torch dtype passed to from_pretrained (default 'auto' -> bfloat16 weights).

  • task (str) – default scoring task, 'quality' (IQA) or 'aesthetic' (IAA).

forward(x, task_=None)[source]

Score a batch of images.

Parameters:
  • x (torch.Tensor) – (B, 3, H, W) in [0, 1].

  • task (str) – override the default task for this call.

Returns:

shape (B,) quality scores in [0, 1] (higher = better).

Return type:

torch.Tensor