This repository is published as an Ascend NPU model repository. The model card metadata at the top of this README uses the exact scalar field hardware: NPU and the tag list contains NPU, Ascend and ascend-npu. The repository description or model card should also include the #+NPU label on AtomGit or GitCode.
| Item | Value |
|---|---|
| Repository | https://gitcode.com/nanyizjm/webssl-dino300m |
| Competition task | Track 1 model adaptation |
| Hardware metadata | hardware: NPU |
| Required tag | #+NPU |
| README data policy | Inference, accuracy and performance values are written as text in this README; images are not used as a replacement for data. |
| Item | Value |
|---|---|
| Model repository | https://gitcode.com/nanyizjm/webssl-dino300m |
| Original model or weight source | https://gitcode.com/hf_mirrors/facebook/webssl-dino300m-full2b-224 |
| Competition track | Track 1: model adaptation |
| Target hardware | Ascend NPU |
| Required function | NPU inference runs successfully or the blocking reason is explicitly recorded |
| Required accuracy | NPU result compared with CPU/GPU reference, error less than 1 percent |
| Required tag | #+NPU |
| Deliverable | Status |
|---|---|
| inference.py | Present |
| readme.md / README.md | Present |
| eval/eval_accuracy.py | Present |
| eval/eval_performance.py | Present |
| logs directory | Present |
| results directory | Present |
| assets or screenshot evidence | Present |
The README must include explicit numeric CPU/GPU versus NPU comparison data. The key acceptance target is error less than 1 percent. The corresponding structured evidence should be saved under results/accuracy_eval.json and logs/accuracy_eval.log when available.
#+NPU
This section is written directly in the README for platform review. It uses only checked-in logs and JSON result files from this repository. It does not rely on embedded images.
| Review item | Direct result |
|---|---|
| Repository | webssl-dino300m |
| Hardware metadata | hardware: NPU and #+NPU are present in this README |
| Normal NPU inference output | PASS - checked-in NPU inference output is written below. |
| Accuracy requirement | PASS - checked-in accuracy evidence reports PASS; use the table below for exact recorded values. |
| Performance evidence | Available - checked-in performance metrics are written below. |
| Evidence files | results/inference_result.json, logs/inference.log, results/accuracy_eval.json, results/performance_eval.json, logs/accuracy_eval.log, logs/performance_eval.log |
"device": "npu:0",
"input_shape": [
"pooler_output_shape": [
"throughput": 83.1147748890298,
Device: npu:0 | Dtype: float32 | NPU: True (2)
pooler_output: torch.Size([1, 1024])
Throughput: 83.11 images/s| Source | Metric | Value |
|---|---|---|
results/inference_result.json | device | npu:0 |
results/inference_result.json | input_shape | [1,3,224,224] |
results/inference_result.json | pooler_output_shape | [1,1024] |
results/inference_result.json | throughput | 83.1147748890298 |
| Source | Metric | Value |
|---|---|---|
results/accuracy_eval.json | cls_cosine_mean | 0.99999998325879 |
results/accuracy_eval.json | hidden_cosine_mean | 1.000000136294638 |
results/accuracy_eval.json | passed | true |
results/accuracy_eval.json | per_sample[0].cls_cosine | 0.9999999170671785 |
results/accuracy_eval.json | per_sample[0].hidden_cosine | 1.0000006037679103 |
results/accuracy_eval.json | per_sample[1].cls_cosine | 1.0000000832219453 |
results/accuracy_eval.json | per_sample[1].hidden_cosine | 0.9999999999999761 |
results/accuracy_eval.json | per_sample[2].cls_cosine | 0.9999999160183392 |
results/accuracy_eval.json | per_sample[2].hidden_cosine | 1.0000002285577343 |
results/accuracy_eval.json | per_sample[3].cls_cosine | 0.9999999999932347 |
Accuracy conclusion: PASS - checked-in accuracy evidence reports PASS; use the table below for exact recorded values.
| Source | Metric | Value |
|---|---|---|
results/performance_eval.json | device | npu:0 |
results/performance_eval.json | dtype | float32 |
results/performance_eval.json | batch_size | 1 |
results/performance_eval.json | throughput | 24.79304568233863 |
results/performance_eval.json | peak_memory_mb | 1174.8173828125 |
本文档记录 WebSSL-DINO-300M 在华为昇腾 NPU 环境下的适配验证、推理部署与评测结果整理。
WebSSL-DINO-300M 的当前适配任务类型为:图像识别 / 视觉特征提取。仓库围绕 赛道一模型适配 交付要求,提供 NPU 推理脚本、精度评测、性能评测、运行日志、结果文件和文本化自验证证据。
相关获取地址:
仓库提供 inference.py 作为统一推理入口,运行时通过 --device npu 或脚本默认设备在昇腾 NPU 上执行推理。推理代码保留 model.eval()、无梯度推理、输入输出摘要、耗时统计和日志保存逻辑,便于复现与核验。
仓库保留精度评测与性能评测材料。精度验证以 CPU/GPU 参考输出与 NPU 输出进行对比,目标为误差小于 1%;性能验证记录延迟、吞吐、batch size、输入尺寸/长度、dtype、NPU 内存等信息。所有结果以 logs/ 与 results/ 中的真实运行文件为准。
自验证截图中的关键内容已转写为 README 文本证据,避免仅依赖图片展示。仓库 README、日志、JSON 结果和附件材料均用于 AtomGit/GitCode 公开提交,README 顶部已声明 hardware: NPU 与 #+NPU 标签。
| 组件 | 版本 / 说明 |
|---|---|
| 操作系统 | Linux |
| CANN | 8.5.1 |
| PyTorch | 2.9.0+cpu |
| torch_npu | 2.9.0.post1 |
| transformers | 4.57.6 |
| accelerate | N/A |
| 依赖安装 | pip install -r requirements.txt |
results/env_info.json 或 logs/env_check.log 为准)torch_npu,请先完成昇腾基础环境配置后再运行真实验证。.
├── .gitignore
├── README.md
├── assets/accuracy_eval_result.png
├── assets/accuracy_screenshot.png
├── assets/env_check.png
├── assets/git_submit_result.png
├── assets/inference_result.png
├── assets/inference_screenshot.png
├── assets/performance_eval_result.png
├── assets/performance_screenshot.png
├── eval/eval_accuracy.py
├── eval/eval_performance.py
├── inference.py
├── logs/accuracy_eval.log
├── logs/env_check.log
├── logs/env_info.txt
├── logs/inference.log
├── logs/model_check.log
├── logs/performance_eval.log
├── requirements.txt
├── results/accuracy_eval.json
├── results/env_info.json
├── results/inference_result.json
└── results/performance_eval.json本仓库不提交大体积模型权重;请按原模型发布页、ModelScope、GitCode 或 HuggingFace 镜像下载后通过参数传入。
推荐约定:
mkdir -p weights
# 将下载后的模型权重或模型目录放入 weights/<model_name>,运行时通过 --model_path 传入pip install -r requirements.txt
python inference.py --model_path <model_path> --image_path <image.jpg> --device npupython eval/eval_accuracy.py --model_path <model_path> --device npu
python eval/eval_performance.py --model_path <model_path> --device npu| 指标 | 结果 |
|---|---|
| 模型名称 | 整体精度评估 |
| 任务类型 | 图像识别 / 视觉特征提取 |
| 推理设备 | Ascend NPU |
| 推理框架 | PyTorch / torch_npu 或仓库脚本声明的推理框架 |
| 仓库分支 | main |
| 当前提交 | 55d2ff2 |
测试结果来源:results/performance_eval.json
| 指标 | 结果 |
|---|---|
device | npu:0 |
dtype | float32 |
batch_size | 1 |
avg_ms | 40.3339 |
throughput | 24.7930 |
结果来源:results/accuracy_eval.json
| 指标 | 结果 |
|---|---|
是否通过 | PASS |
结论:README 仅记录仓库中已有的真实评测数据;若某项指标未在 JSON/日志中出现,请以对应日志文件为准,不在文档中补造数值。
python eval/eval_accuracy.py --model_path <model_path> --device npu
python eval/eval_performance.py --model_path <model_path> --device npu关键日志和结构化 JSON 已在下方“结果数据直接文本”中直接写入;原始文件路径仅用于复核。
inference.py 支持的参数以脚本自身 --help 输出为准。当前 README 从脚本中提取到的主要参数如下:
| 参数 | 默认值 | 说明 |
|---|---|---|
--model_path | 见脚本默认值 | 模型权重或模型目录路径 |
--image_path | 见脚本默认值 | 输入样例路径 |
--device | 见脚本默认值 | 推理设备,NPU 推理使用 npu |
--dtype | 见脚本默认值 | 推理精度类型 |
--trust_remote_code | 见脚本默认值 | 脚本参数,详见 python inference.py --help |
--output_log | 见脚本默认值 | 输出目录或日志路径 |
python inference.py --help
python inference.py --model_path <model_path> --image_path <image.jpg> --device npu以下内容来自仓库已有 README 证据段、运行日志或结果文件。图片文件如保留在 assets/ 中,仅作为附件材料;README 中直接写入可检索的文本证据。
The PNG files below were rendered from the previous assets/*.txt evidence files. The original TXT files were removed after rendering.
| Evidence | PNG file |
|---|---|
| accuracy_eval_result | assets/accuracy_eval_result.png |
| env_check | assets/env_check.png |
| git_submit_result | assets/git_submit_result.png |
| inference_result | assets/inference_result.png |
| performance_eval_result | assets/performance_eval_result.png |
本节将仓库中已提交的评测 JSON、推理日志、环境日志和性能日志直接写入 README。原始文件路径仅用于标识数据来源,主要数值和输出内容已在下面以文本形式完整展开。
# Environment Check Log
# Repository: webssl-dino300m
# Model: 整体精度评估
# Date: 2026-05-16 07:03:22
## System Info
Linux pod-8e032c81b34d489191e775768926f3b6 5.10.0-182.0.0.95.r2220_156.hce2.aarch64 #1 SMP Sat Sep 14 02:34:54 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
## Python
Python 3.11.14
pip 26.0.1 from /usr/local/python3.11.14/lib/python3.11/site-packages/pip (python 3.11)
## NPU Info
+------------------------------------------------------------------------------------------------+
| npu-smi 25.5.2 Version: 25.5.2 |
+---------------------------+---------------+----------------------------------------------------+
| NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page)|
| Chip Phy-ID | Bus-Id | AICore(%) Memory-Usage(MB) HBM-Usage(MB) |
+===========================+===============+====================================================+
| 0 Ascend910 | OK | 175.2 48 0 / 0 |
| 0 0 | 0000:0A:00.0 | 0 0 / 0 3107 / 65536 |
+------------------------------------------------------------------------------------------------+
| 0 Ascend910 | OK | - 49 0 / 0 |
| 1 1 | 0000:0B:00.0 | 0 0 / 0 2870 / 65536 |
+===========================+===============+====================================================+
+---------------------------+---------------+----------------------------------------------------+
| NPU Chip | Process id | Process name | Process memory(MB) |
+===========================+===============+====================================================+
| No running processes found in NPU 0 |
+===========================+===============+====================================================+
## CANN Version
8.5.1
## PyTorch
2.9.0+cpu
## torch_npu
2.9.0.post1+gitee7ba04
## transformers
4.57.6
## Git Info
Branch: main
Commit: 17780e1a0385d070e26eec8bef1b072a956745ac
<redacted sensitive line>
ASCEND_TOOLKIT_HOME=/usr/local/Ascend/cann-8.5.1
PYTHONPATH=/usr/local/Ascend/cann-8.5.1/python/site-packages:/usr/local/Ascend/cann-8.5.1/opp/built-in/op_impl/ai_core/tbe:/usr/local/Ascend/ascend-toolkit/latest/python/site-packages:/usr/local/Ascend/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe:WebSSL-DINO-300M Environment Info
========================================
Date: 2026-05-15 02:17:35
Python: Python 3.11.14
PyTorch: 2.9.0+cpu
torch_npu: 2.9.0.post1+gitee7ba04
transformers: 4.57.6
numpy: 1.26.4
Pillow: 12.2.0
NPU Available: True
NPU Count: 2
NPU Name: Ascend910_9362
NPU Memory: 61.3 GB
OS: Ubuntu 22.04.5 LTS
Kernel: 5.10.0-182.0.0.95.r2220_156.hce2.aarch64
Arch: aarch64{
"model_name": "整体精度评估",
"repo": "webssl-dino300m",
"repo_url": "https://atomgit.com/nanyizjm/webssl-dino300m.git",
"status": "SUCCESS",
"os": "Linux",
"python": "3.11.14",
"cann_version": "8.5.1",
"torch_version": "2.9.0+cpu",
"torch_npu_version": "2.9.0.post1",
"transformers_version": "4.57.6",
"accelerate_version": "N/A",
"npu_available": true,
"npu_info": "Ascend910 x2",
"git_branch": "main",
"git_commit": "17780e1a0385d070e26eec8bef1b072a956745ac",
"timestamp": "2026-05-16 07:03:22",
"note": "Environment check passed. NPU Ascend910 available."
}WebSSL-DINO-300M Model Check Log
==================================
Date: 2026-05-15
1. Model Info
- Name: facebook/webssl-dino300m-full2b-224
- Architecture: Dinov2Model (ViT-L/14 + SwiGLU)
- Parameters: 303,655,168 (0.304B)
- Hidden Size: 1024
- Num Heads: 16
- Num Layers: 24
- Patch Size: 14
- Image Size: 224
2. Weight Files
- config.json: ✓
- model.safetensors: ✓
- preprocessor_config.json: ✓
- configuration.json: ✓
3. NPU Load Test
- Load time: 1.96s
- Device: Ascend910_9362
- torch_npu: 2.9.0.post1
4. Inference Test
- Input: [1, 3, 224, 224] (random, seed=42)
- last_hidden_state: [1, 257, 1024] ✓
- pooler_output: [1, 1024] ✓
- CLS norm: 38.367
- Inference: 12.03 ms
5. Accuracy Check (CPU vs NPU, 5 samples)
- CLS Cosine: 1.000000 (> 0.9999 ✓)
- Hidden Cosine: 1.000000 (> 0.9999 ✓)
- CLS P99 Err: 0.0025% (< 1% ✓)
- Hidden P99 Err: 0.0040% (< 1% ✓)
- CLS MAE: 0.0007% (< 1% ✓)
- Hidden MAE: 0.0007% (< 1% ✓)
- Overall: PASS ✓
6. Performance Check (10 runs)
- Avg: 40.33 ms
- Throughput: 24.79 images/s
- Peak Memory: 1174.8 MB
7. Config Patches
- attn_implementation: flash_attention_2 → eager
- local_transformer_attn_implementation: flash_attention_2 → eager
All checks passed.============================================================
WebSSL-DINO-300M Inference - Ascend NPU
============================================================
Device: npu:0 | Dtype: float32 | NPU: True (2)
Model: /tmp/ms_cache/facebook/webssl-dino300m-full2b-224
Loading model...
Loaded in 1.96s (0.304B params)
Image: random test (seed=42), 224x224
Input: torch.Size([1, 3, 224, 224])
============================================================
Results
============================================================
last_hidden_state: torch.Size([1, 257, 1024])
pooler_output: torch.Size([1, 1024])
(1 CLS + 256 patch tokens, hidden_dim=1024)
CLS Embedding (first 10): [1.4275214672088623, 0.8247609734535217, -1.082946538925171, 2.1961376667022705, -0.15313589572906494, -0.866186261177063, -1.393379807472229, -0.14722689986228943, -2.1677703857421875, -1.0568121671676636]
mean=0.003040 std=1.198970
min=-3.795284 max=3.518420
norm=38.367168
Patch Tokens: (256, 1024)
mean=0.014319 std=1.254481
Performance
Inference: 12.03 ms
Throughput: 83.11 images/s
Device: Ascend910_9362 (61.3 GB)
PyTorch 2.9.0+cpu
torch_npu 2.9.0.post1+gitee7ba04{
"model": "facebook/webssl-dino300m-full2b-224",
"device": "npu:0",
"dtype": "float32",
"params": 303655168,
"input_shape": [
1,
3,
224,
224
],
"last_hidden_state_shape": [
1,
257,
1024
],
"pooler_output_shape": [
1,
1024
],
"cls_first10": [
1.4275214672088623,
0.8247609734535217,
-1.082946538925171,
2.1961376667022705,
-0.15313589572906494,
-0.866186261177063,
-1.393379807472229,
-0.14722689986228943,
-2.1677703857421875,
-1.0568121671676636
],
"cls_mean": 0.0030402292031794786,
"cls_std": 1.198970079421997,
"inference_ms": 12.03155517578125,
"throughput": 83.1147748890298,
"npu_available": true
}============================================================
WebSSL-DINO-300M Accuracy: CPU vs NPU
============================================================
Loading CPU model...
Loading NPU model...
Testing 5 images (224x224)
Sample 1: CLS cos=1.000000 p99=0.0024% mae=0.0007% | Hid cos=1.000001 p99=0.0035% mae=0.0007%
Sample 2: CLS cos=1.000000 p99=0.0021% mae=0.0007% | Hid cos=1.000000 p99=0.0032% mae=0.0007%
Sample 3: CLS cos=1.000000 p99=0.0019% mae=0.0006% | Hid cos=1.000000 p99=0.0034% mae=0.0007%
Sample 4: CLS cos=1.000000 p99=0.0018% mae=0.0005% | Hid cos=1.000000 p99=0.0031% mae=0.0006%
Sample 5: CLS cos=1.000000 p99=0.0025% mae=0.0008% | Hid cos=0.999999 p99=0.0040% mae=0.0008%
============================================================
Summary
============================================================
CLS: Cosine=1.000000 P99Err=0.0025% MAE=0.0007%
Hid: Cosine=1.000000 P99Err=0.0040% MAE=0.0007%
Cos>0.9999: PASS
P99Err<1%: PASS
MAE<1%: PASS
Overall: PASS{
"model": "facebook/webssl-dino300m-full2b-224",
"device": "npu:0",
"dtype": "float32",
"num_samples": 5,
"cls_cosine_mean": 0.99999998325879,
"hidden_cosine_mean": 1.000000136294638,
"cls_p99_err_pct": 0.0025229721662130143,
"hidden_p99_err_pct": 0.004013771410870238,
"cls_mae_pct": 0.0006723163824062794,
"hidden_mae_pct": 0.0007142241702240426,
"passed": true,
"per_sample": [
{
"sample": 1,
"cls_cosine": 0.9999999170671785,
"hidden_cosine": 1.0000006037679103,
"cls": {
"max_pct": 0.0030284432796179317,
"p99_pct": 0.0023675809088237747,
"mae_pct": 0.0007356820333370706,
"mae_abs": 5.3805481002200395e-05
},
"hidden": {
"max_pct": 0.030081209843046963,
"p99_pct": 0.0035430426333917095,
"mae_pct": 0.000727855558579904,
"mae_abs": 0.00017752802523318678
}
},
{
"sample": 2,
"cls_cosine": 1.0000000832219453,
"hidden_cosine": 0.9999999999999761,
"cls": {
"max_pct": 0.002995769500557799,
"p99_pct": 0.002073185178055721,
"mae_pct": 0.0006545009455294348,
"mae_abs": 4.724428436020389e-05
},
"hidden": {
"max_pct": 0.016550137661397457,
"p99_pct": 0.0032153715101061104,
"mae_pct": 0.0006718938948324649,
"mae_abs": 0.00016772106755524874
}
},
{
"sample": 3,
"cls_cosine": 0.9999999160183392,
"hidden_cosine": 1.0000002285577343,
"cls": {
"max_pct": 0.002367289380345028,
"p99_pct": 0.0019456348792001694,
"mae_pct": 0.0006113581093813991,
"mae_abs": 4.346994683146477e-05
},
"hidden": {
"max_pct": 0.01789237867342308,
"p99_pct": 0.0034051165662342692,
"mae_pct": 0.000710885342414258,
"mae_abs": 0.0001809181849239394
}
},
{
"sample": 4,
"cls_cosine": 0.9999999999932347,
"hidden_cosine": 1.000000377501917,
"cls": {
"max_pct": 0.0024557148208259605,
"p99_pct": 0.0017780269383318359,
"mae_pct": 0.000521863330504857,
"mae_abs": 3.759437095141038e-05
},
"hidden": {
"max_pct": 0.030275125754997134,
"p99_pct": 0.003122873307220622,
"mae_pct": 0.0006468600076914299,
"mae_abs": 0.00016762528684921563
}
},
{
"sample": 5,
"cls_cosine": 0.9999999999932523,
"hidden_cosine": 0.9999994716456524,
"cls": {
"max_pct": 0.003683959585032426,
"p99_pct": 0.0025229721662130143,
"mae_pct": 0.0008381774932786357,
"mae_abs": 5.966971366433427e-05
},
"hidden": {
"max_pct": 0.2130313077941537,
"p99_pct": 0.004013771410870238,
"mae_pct": 0.0008136260476021562,
"mae_abs": 0.00019733332737814635
}
}
]
}============================================================
WebSSL-DINO-300M Performance
============================================================
Model: 0.304B params
Batch: 1 | Input: torch.Size([1, 3, 224, 224]) | Device: npu:0
Memory before warmup: 1174.8 MB
Warmup: 3
Timed runs: 10
Run 1: 39.30 ms
Run 2: 44.68 ms
Run 3: 41.04 ms
Run 4: 44.22 ms
Run 5: 33.24 ms
Run 6: 48.29 ms
Run 7: 32.02 ms
Run 8: 36.77 ms
Run 9: 33.49 ms
Run 10: 50.29 ms
============================================================
Results
============================================================
Avg: 40.33 ms Std: 6.14 ms
Min: 32.02 ms Max: 50.29 ms Median: 40.17 ms
Throughput: 24.79 images/s
Device: Ascend910_9362 (61.3 GB)
Peak memory: 1174.8 MB{
"model": "facebook/webssl-dino300m-full2b-224",
"device": "npu:0",
"dtype": "float32",
"params": 303655168,
"batch_size": 1,
"input_shape": [
1,
3,
224,
224
],
"avg_ms": 40.33389091491699,
"std_ms": 6.141222820137581,
"min_ms": 32.018184661865234,
"max_ms": 50.290584564208984,
"median_ms": 40.17221927642822,
"throughput": 24.79304568233863,
"peak_memory_mb": 1174.8173828125
}license 元数据或 LICENSE 文件为准。