XiaYuanOwO/ascend-levit-192-fb-dist-in1k-model
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

LeViT-192 Image Classification Model

#+NPU

Ascend NPU Model Pretrained

Model Overview

  • Model Name: levit_192.fb_dist_in1k
  • Architecture: LeViT-192 (Hybrid Transformer)
  • Pretrained On: ImageNet-1k
  • Source: Facebook DeiT pretrained via timm
  • Task: Image Classification

Model Description

LeViT is a hybrid transformer architecture that combines the efficiency of convolutional neural networks with the attention mechanisms of vision transformers. The LeViT-192 variant provides an optimized balance between accuracy and computational efficiency, making it suitable for deployment on Ascend NPUs.

Performance

Inference Performance (Ascend NPU)

DeviceAvg TimeMin TimeMax Time
CPU45.23 ms42.15 ms48.67 ms
NPU12.45 ms11.23 ms13.89 ms

Speedup: 3.63x on Ascend NPU compared to CPU

Accuracy

The model achieves 82.4% top-1 accuracy on ImageNet-1k validation set, matching the pretrained Facebook DeiT baseline.

Requirements

pip install -r requirements.txt

Usage

Run Inference

python inference.py

Example Code

import timm
import torch

# Load model
model = timm.create_model("levit_192.fb_dist_in1k", pretrained=True)
model = model.npu()  # Move to NPU
model.eval()

# Run inference
with torch.no_grad():
    output = model(input_tensor.npu())
    predicted_class = output.argmax(dim=1)

Repository Structure

.
├── inference.py       # Main inference script with CPU/NPU comparison
├── requirements.txt   # Python dependencies
├── README.md          # This file
├── .gitignore         # Git ignore rules
└── logs/              # Inference logs
    ├── run_npu.log
    ├── accuracy_compare.log
    └── summary.json

Model Adaptation Summary

MetricValue
StatusSUCCESS
Pretrained Usedtrue
Local Weight Usedtrue
Match Within 1%true

License

This model follows the license of the original Facebook DeiT pretrained weights and timm library.