Downloads · 30 days
0
aadex/rope_vit-imagenet100
rope_vit-imagenet100 is a image classification model from aadex. Use it when you need a label for an image. The card lists the license as apache-2.0.
This model was trained using the vit-analysis framework for analyzing Vision Transformer positional encoding methods.
Downloads · 30 days
0
Access
Public
Updated Dec 25, 2025
Repo size
66.4 MB
Likes
0
Public
Click a slice to open those files.
.pth66.4 MB · 100%
From the Hugging Face model README
This model was trained using the vit-analysis framework for analyzing Vision Transformer positional encoding methods.
| Property | Value |
|---|---|
| Model Type | ROPE Vision Transformer |
| Dataset | imagenet100 |
| Best Accuracy | 77.30% |
| Image Size | 224 |
| Patch Size | 16 |
| Hidden Dim | 192 |
| Depth | 12 |
| Num Heads | 3 |
| MLP Dim | 768 |
| Num Classes | 100 |
This is a Vision Transformer with Rotary Position Embeddings (RoPE). RoPE encodes position information directly into the attention mechanism, enabling better generalization to different sequence lengths and improved extrapolation capabilities.
import torch
from models import RoPESimpleVisionTransformer
# Initialize model
model = RoPESimpleVisionTransformer(
image_size=224,
patch_size=16,
num_layers=12,
num_heads=3,
hidden_dim=192,
mlp_dim=768,
num_classes=100,
)
# Load checkpoint
checkpoint = torch.load('rope_vit_imagenet100_best.pth', map_location='cpu')
state_dict = checkpoint['state_dict']
# Remove 'module.' prefix if present (from DDP training)
state_dict = {k.replace('module.', ''): v for k, v in state_dict.items()}
model.load_state_dict(state_dict)
model.eval()
# Inference
from torchvision import transforms
from PIL import Image
transform = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])
image = Image.open('your_image.jpg').convert('RGB')
input_tensor = transform(image).unsqueeze(0)
with torch.no_grad():
output = model(input_tensor)
prediction = output.argmax(dim=1)
This model was trained with:
If you use this model, please cite:
@misc{vit-analysis,
title={Vision Transformer Position Encoding Analysis},
year={2024},
url={https://github.com/your-repo/vit-analysis}
}
Apache 2.0