本仓库包含了 Wvolf/ViT_Deepfake_Detection 在华为昇腾 NPU 上的适配与推理实现。
本模型基于 HuggingFace Transformers Pipeline 进行推理,在昇腾 NPU 上通过 torch_npu 实现硬件加速。
pip install -r requirements.txtpython inference.pypip install -r requirements.txtpython inference.pypython compare_cpu_npu.py| 指标 | 数值 |
|---|---|
| CPU 推理耗时 | 0.6424s |
| NPU 推理耗时 | 0.0081s |
| MAE (平均绝对误差) | 0.000236 |
| Max Error (最大误差) | 0.000236 |
| MSE (均方误差) | 0.000000 |
| 误差百分比 | 0.0236% |
结论: NPU 与 CPU 推理误差 < 1%
| 设备 | 推理耗时 (s) |
|---|---|
| CPU | 0.6424 |
| NPU | 0.0081 |
CPU inference time: 0.6424s
NPU inference time: 0.0081s