模型名称: PickScore_v1 模型链接: https://ai.gitcode.com/hf_mirrors/yuvalkirstain/PickScore_v1 模型描述: PickScore v1 是基于 CLIP-H (ViT-H/14) 微调的文生图质量评分模型,用于评估文本提示与生成图像之间的匹配程度。基于 Pick-a-Pic 数据集训练,支持图像排序、模型评估和人类偏好预测等任务。 模型架构: CLIP-H (ViT-H/14 + Transformer Text Encoder, projection_dim=1024) 参数规模: 约 3.9GB (ViT-H/14 图像编码器 + 24层Transformer文本编码器)
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch / torch_npu | 2.1.0+ | 昇腾NPU推理 |
| transformers | >= 4.45.0 | HuggingFace 库 |
| 昇腾驱动 | CANN 8.0.RC2+ | 推荐最新版 |
安装命令:
pip install torch torch_npu transformers sentencepiece# 检查 NPU 设备
npu-smi info# 单条输入推理
python inference.py --input "测试输入内容" --model_path ./PickScore_v1
# 批量输入推理
python inference.py --input_file test_samples.txt --model_path ./PickScore_v1| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --input | str | - | 输入文本/图像路径 |
| --input_file | str | - | 批量输入文件路径 |
| --model_path | str | PickScore_v1 | 模型路径 |
| --max_length | int | 2048 | 最大生成长度 |
输入:
Prompt: a beautiful sunset over the ocean | Images: test_pickscore_1.jpg, test_pickscore_2.jpg输出:
最佳图像: test_pickscore_1.jpg (score: 17.8072, prob: 0.7210) | test_pickscore_2.jpg: score=16.8575, prob=0.2790耗时: 0.2767s
输入:
Prompt: a cute cat sitting on a chair | Images: test_pickscore_2.jpg, test_pickscore_3.jpg输出:
最佳图像: test_pickscore_3.jpg (score: 17.5766, prob: 0.5456) | test_pickscore_2.jpg: score=17.5190, prob=0.4544耗时: 0.0333s
输入:
Prompt: a futuristic cityscape at night | Images: test_pickscore_1.jpg, test_pickscore_3.jpg输出:
最佳图像: test_pickscore_3.jpg (score: 17.9097, prob: 0.5281) | test_pickscore_1.jpg: score=17.8803, prob=0.4719耗时: 0.0332s



| 测试样例 | NPU输出 | 耗时 | 是否成功运行 |
|---|---|---|---|
| 日落场景 (sunset over ocean) | 最佳: test_pickscore_1.jpg (score: 17.8072, prob: 0.... | 0.2767s | ✅ 成功 |
| 猫咪场景 (cute cat) | 最佳: test_pickscore_3.jpg (score: 17.5766, prob: 0.... | 0.0333s | ✅ 成功 |
| 城市夜景 (futuristic cityscape) | 最佳: test_pickscore_3.jpg (score: 17.9097, prob: 0.... | 0.0332s | ✅ 成功 |
结论: 模型已在 NPU 上成功运行推理,满足验收要求。 说明: 根据最新规则,不再强制精度1%验证,本章节记录 NPU 运行验证结果。
文档生成时间:2026-08-19 11:28:07