赛事: 昇腾 Model Agent 模型适配大赛(第二季) 引擎: torch_npu 硬件: Ascend 910B4 标签:
npuascendpytorchtransformers
| 属性 | 值 |
|---|---|
| 原始模型 | yuvalkirstain/PickScore_v1 |
| 参数量 | 130 M |
| 任务类型 | 图像偏好打分(CLIP 多模态) |
| 输入格式 | RGB 图像 + 候选文本 |
| 输出格式 | 图像-文本偏好分数 |
PickScore_v1 是基于 CLIP 的图像偏好打分模型,预测人类对图像-文本对的偏好 程度,可用于图像生成评估、检索排序等。本适配在昇腾 NPU(Ascend 910B4) 上完成推理,单次约 5.2 s。
⚠️ 本仓库不包含模型权重(交付件仅
inference.py/readme.md/requirements.txt/assets/), 推理前必须先从原始模型仓单独下载权重。
huggingface-cli download yuvalkirstain/PickScore_v1 --local-dir ./ --local-dir-use-symlinks False
pip install -r requirements.txt -i https://repo.huaweicloud.com/repository/pypi/simple/python3 inference.py --model_path . --image test_img.png \
--texts "a red circle;an orange circle;a blue square" --device npu:0python3 inference.py --model_path . --image test_img.png \
--texts "a red circle;an orange circle;a blue square" --device npu:0预期输出:
[Model Agent] NPU 设备就绪: Ascend910B4 (count=1)
[Model Agent] 模型加载完成 -> npu:0
[Model Agent] 图像偏好分数:
a red circle: 24.01 <- best
[Model Agent] 推理时延: 5245.0 ms.
├── inference.py # NPU 推理脚本
├── readme.md # 本文件
├── requirements.txt # 依赖清单
└── assets/ # 截图素材本模型由 昇腾 Model Agent 自动完成 NPU 适配:
CLIPModel + CLIPProcessor,model.to('npu:0') +
torch.no_grad() 推理,无 CUDA 依赖。