This directory is a complete, reproducible Ascend NPU inference candidate for the
pinned upstream model
TianheWu/VisualQuality-R1-7B.
12852ce5718dac0d1bd32845d462a6027374ceecmodel-00001..00004-of-00004.safetensors) + tokenizer.json, sizes and SHA256
recorded in logs/npu_result.json (checkpoint_sha256) and verified 5/5 before load.Qwen2_5_VLForConditionalGeneration (Qwen2.5-VL
image-quality reward / reasoning, non-thinking mode).torch_npu (torch 2.9.0+cpu + torch_npu 2.9.0, CANN-matched).npu:3 (Ascend910B4-1).<answer>1.00</answer> (score 1.0).The model forward runs wholly on npu:3. The CPU only orchestrates Python, hashes the
pinned artifacts, deserializes the checkpoint, and preprocesses the image/text. There is
no CPU offload and no CPU fallback; any NPU initialization, placement mismatch, or
execution error makes the process exit nonzero.
| Field | Value |
|---|---|
| Model ID | TianheWu/VisualQuality-R1-7B |
| Source | https://huggingface.co/TianheWu/VisualQuality-R1-7B |
| Pinned revision | 12852ce5718dac0d1bd32845d462a6027374ceec |
pipeline_tag | reinforcement-learning |
library_name | transformers |
| NPU tags | ascend, npu, torch_npu, hardware: NPU |
| Architecture | Qwen2_5_VLForConditionalGeneration (base Qwen/Qwen2.5-VL-7B-Instruct) |
| Parameter count | 8,292,166,656 (bf16) |
| Task | NR-IQA image quality rating / reasoning (reward model, RL2R) |
| Deterministic output | <answer>1.00</answer> (score 1.0) |
The upstream model card front matter declares license: mit (verified directly from the
pinned local model card README.md). This delivery reproduces that metadata verbatim as
license: mit. The exact source revision and the original card tags
(IQA, Reasoning, VLM, Pytorch, R1, GRPO, RL2R) are preserved. We do not
relabel or extend the license beyond what the upstream card states.
Tested in this container (delivery root
/work/pipeline/jobs/rl26/visualquality-r1-7b/visualquality-r1-7b-npu):
| Component | Version / value |
|---|---|
| OS | Linux 5.10.0 .oe2203sp4.aarch64 (openEuler, aarch64) |
| Python | 3.11.14 |
| CANN | 8.5.1 (Ascend910B4-1) |
| torch | 2.9.0+cpu (image-provided, CANN-matched — do not replace) |
| torch_npu | 2.9.0 (image-provided, CANN-matched — do not replace) |
| transformers | 5.15.1 |
| huggingface_hub | 1.28.0 |
| torchvision | 0.24.0 |
| numpy | 1.26.4 |
| Pillow | 12.3.0 |
| safetensors | 0.8.0 |
| npu-smi | 25.5.1 |
| Hardware | Ascend910B4-1 (8 devices; this candidate uses physical npu:3) |
The interpreter is the pre-provisioned model venv
/work/pipeline/runtime/model-venvs/transformers-5.15.1/bin/python; its venv-local
Transformers is 5.15.1 and its system-site packages provide the CANN-matched
torch 2.9.0+cpu / torch_npu 2.9.0 and torchvision 0.24.0.
The pinned venv already contains every package above; no additional package was installed for this delivery. If you must recreate an isolated model-specific venv, install only non-torch runtime dependencies and fetch only from the Aliyun PyPI mirror:
# 1. Create the model-specific venv (inherits system-site CANN-matched torch/torch_npu).
python -m venv --system-site-packages /work/pipeline/runtime/model-venvs/transformers-5.15.1
# 2. Install the non-torch runtime dependencies from Aliyun only.
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/Equivalently, pin the mirror for the whole shell:
export PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
pip install -r requirements.txt⚠️ Never install
torchortorch_npufrom PyPI. They are provided by the image as a CANN-matched pair (torch 2.9.0+cpu+torch_npu 2.9.0) and must stay untouched. Therequirements.txtcomment header records this policy.
# 1. Load the CANN environment (required for NPU runtime).
source /usr/local/Ascend/ascend-toolkit/set_env.sh
# 2. Sanity-check the NPU devices.
npu-smi info
# 3. Run the deterministic NPU inference (device npu:3; a hold window keeps the process
# alive so npu-smi can capture the live PID on device 3).
cd /work/pipeline/jobs/rl26/visualquality-r1-7b/visualquality-r1-7b-npu
/work/pipeline/runtime/model-venvs/transformers-5.15.1/bin/python inference.py \
--run-id 1 --output logs/npu_result.json --log logs/npu_inference.log \
--smi-capture logs/npu_smi_capture.txt --hold 20 --max-new-tokens 64
# 4. Inspect the structured result.
cat logs/npu_result.jsonCommand (two consecutive fresh processes, same venv + same input):
cd /work/pipeline/jobs/rl26/visualquality-r1-7b/visualquality-r1-7b-npu
/work/pipeline/runtime/model-venvs/transformers-5.15.1/bin/python inference.py \
--run-id 1 --output logs/npu_result.json --log logs/npu_inference.log \
--smi-capture logs/npu_smi_capture.txt --hold 20 --max-new-tokens 64
/work/pipeline/runtime/model-venvs/transformers-5.15.1/bin/python inference.py \
--run-id 2 --output logs/npu_result_run2.json --log logs/npu_inference_run2.log \
--smi-capture logs/npu_smi_capture_run2.txt --hold 15 --max-new-tokens 64Exit code: 0 for both. Run 1 PID 891779, run 2 PID 895572 — both correlated live with
npu-smi on physical npu:3 (16432 MB). Both runs produced byte-identical output.
Actual output (logs/npu_inference.log):
[2026-08-22 13:04:29] VisualQuality-R1-7B - Ascend NPU reward/reasoning inference
[2026-08-22 13:04:29] sys.executable : /work/pipeline/runtime/model-venvs/transformers-5.15.1/bin/python
[2026-08-22 13:04:29] version transformers : 5.15.1
[2026-08-22 13:04:29] version torch : 2.9.0+cpu
[2026-08-22 13:04:29] version torch_npu : 2.9.0
[2026-08-22 13:04:29] source revision : 12852ce5718dac0d1bd32845d462a6027374ceec
[2026-08-22 13:04:29] npu device : npu:3 name=Ascend910B4-1
[2026-08-22 13:04:44] pinned artifacts verified: 5/5
[2026-08-22 13:04:46] processor : Qwen2_5_VLProcessor image=Qwen2VLImageProcessor video=Qwen2VLVideoProcessor tok=Qwen2Tokenizer
[2026-08-22 13:04:46] input device : npu:3 (all tensor inputs)
[2026-08-22 13:04:47] strict load : 729/729 tensors, missing=0 unexpected=0
[2026-08-22 13:04:47] spot-check : 5 tensors byte-equal to raw safetensors
[2026-08-22 13:04:50] model device : npu:3 params=8292166656 dtype=torch.bfloat16
[2026-08-22 13:04:51] logits device : npu:3 shape=(1, 168, 152064) dtype=torch.bfloat16
[2026-08-22 13:04:52] generated text : '<answer>1.00</answer>'
[2026-08-22 13:04:52] parsed score : 1.0
[2026-08-22 13:04:52] output sha256 : d4a6e25a1a45bbde35f865352cfacbb29cb3bfc6d3c8cbb848200ace237e19f4
[2026-08-22 13:04:53] [NPU-SMI] match: | 3 0 | 891779 | python | 16432 |
[2026-08-22 13:05:14] npu-smi pid match : True
[2026-08-22 13:05:14] INFERENCE OK (exit_code=0)Key result values (all on npu:3):
| Output | Value | Notes |
|---|---|---|
generated_text | <answer>1.00</answer> | on npu:3, greedy decode |
score | 1.0 | parsed from the answer |
output sha256 | d4a6e25a…19f4 | identical across both runs |
logits | (1, 168, 152064) bf16 | on npu:3 |
strict_load | 729/729, missing 0, unexpected 0 | 5 tensors spot-checked byte-equal |
Placement evidence in logs/npu_result.json (top level): engine: torch_npu,
npu_available: true, npu_device_name: Ascend910B4-1, source_revision: 12852ce5…,
input_device: npu:3, model_device: npu:3, output_device: npu:3, exit_code: 0.
Determinism (two consecutive fresh processes, same venv + same input):
| Run | PID | exit | generated_text | output sha256 |
|---|---|---|---|---|
| 1 | 891779 | 0 | <answer>1.00</answer> | d4a6e25a…19f4 |
| 2 | 895572 | 0 | <answer>1.00</answer> | d4a6e25a…19f4 |
Rendered from the real final transcript / sanitized log / result JSON (no fabricated values):
assets/agent_workflow.png — agent workflow: read-only upstream routing, pinned-revision
checkpoint verification, NPU init, official Qwen2.5-VL processor, strict load, NPU forward,
and result JSON.assets/npu_device_call.png — live npu-smi device / process call on physical npu:3
(PID correlation during the hold window).assets/model_result.png — final model result: <answer>1.00</answer>, score, shapes,
devices, versions, timing and PID.assets/modelagent_live_session.png — sanitized excerpts from the real ModelAgent
requirement/repair conversation, followed by the independently rerun final PID and
acceptance result.<answer>1.00</answer> output only under the pinned venv
(transformers 5.15.1, torch 2.9.0+cpu, torch_npu 2.9.0). Outside this exact stack the
numerical output is not guaranteed.1.00). It is a reproducible probe,
not a real photograph; it does not benchmark real-world IQA accuracy.<answer> tags. Thinking-style chain of
thought is not exercised.model.*, visual.*); transformers 5.15.1 nests them as model.language_model.* /
model.visual.*. from_pretrained performs this remap internally and this delivery's
strict-load check applies the same mapping, so counts are exact (729/729).npu:3. On another host with
a different ASCEND_RT_VISIBLE_DEVICES mapping, verify npu:3 still selects the intended
physical device./work/pipeline/models/rl26/visualquality-r1-7b); it is not copied into this delivery.