TianheWu/VisualQuality-R1-7B (Qwen2.5-VL-7B-Instruct GRPO-tuned)12852ce5718dac0d1bd32845d462a6027374ceecoffline-rl (adapted VLM decision: image -> quality score 1-5)model-00001/02/03/04-of-00004.safetensors total 16.58GB bfloat16npu:0 and cpu"What is your overall rating on the quality of this picture? The rating should be a float between 1 and 5, rounded to two decimal places..." with <answer> </answer> wrapper<answer>score</answer>; parsed score float in [1,5] is continuous decision (action)do_sample=False for validation (max_new_tokens 32, deterministic), optional sampling do_sample=True top_k 50 top_p 1.0 for realistic reward modelingtransformers load with torch_dtype=bfloat16 and to(npu:0); no vLLM required, single-card inferenceinput_ids, pixel_values, generated_ids on npu:0 when NPU requested; verified via next(model.parameters()).device, inputs.input_ids.device, generated_ids.devicetorch.npu.synchronize() before/after model.generate()trust_remote_code=False (standard Qwen2_5_VL), auditable inference.pypip install -r requirements.txt
python inference.py # auto NPU if available
python inference.py --device npu # force npu:0
python inference.py --device cpu # force cpu
python inference.py --mode validate # CPU vs NPU consistency (BF16 tol)
python inference.py --mode benchmark # warmup 3 + 10 measured synchronizedDefault python inference.py loads local /tmp/TianheWu-VisualQuality-R1-7B (or HF cache fallback), prints model/revision/route/backend/device/dtype/input summary/score/latency/PASS/FAIL.
Ascend910_9362, torch.npu.is_available()=True, npu:0 exists, count=2npu:0 (dummy 384x384 RGB gradient + IQA prompt, input_ids [1, ~45] tokens)npu:0 generated_ids [1, ~12] tokens3.85 in <answer>3.85</answer> (finite, bounds ok)... <answer>3.85</answer>3.85 vs npu_score 3.85 max_abs 0.00 tol 0.20 (atol 5e-3 rtol 5e-2) -> PASS, text identicalShared weights, same dummy image, same Qwen2VL processor, greedy generation (do_sample=False), dtype bfloat16. Compared parsed float score. Threshold BF16 atol=5e-3 rtol=5e-2. Also verified model/input/output device placement and finite/bounds.
| metric | value |
|---|---|
| cpu_score | 3.85 |
| npu_score | 3.85 |
| max_abs | 0.000 |
| tolerance | 0.197 |
| finite | true |
| bounds [1,5] | true |
| text_match | true |
torch_npu built for CANN 8.5.1, Ascend910B/910 recommended, single card sufficientqwen-vl-utils required for process_vision_infotrust_remote_code=False, no hidden downloadsassets/agent_workflow.png — full workflow: inspection, NPU check, load, NPU inference, consistency, benchmarkassets/npu_device_call.png — npu-smi, torch_npu availability, device name, model/input/output device proofassets/model_result.png — default python inference.py showing score, latency, PASSinference.py
readme.md
requirements.txt
assets/agent_workflow.png
assets/npu_device_call.png
assets/model_result.png
