Instructions to use roylvzn/vit-cifar10 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- timm
How to use roylvzn/vit-cifar10 with timm:
import timm model = timm.create_model("hf-hub:roylvzn/vit-cifar10", pretrained=True) - Notebooks
- Google Colab
- Kaggle
Download vit_model.py from roylvzn/vit-cifar10: direct link, hf CLI and curl.
- Browser
- Download file 333 Bytes
-
https://huggingface.co/roylvzn/vit-cifar10/resolve/refs%2Fpr%2F1/vit_model.py
- Command line
-
hf download hf://roylvzn/vit-cifar10@refs/pr/1/vit_model.py
-
curl -L -o vit_model.py https://huggingface.co/roylvzn/vit-cifar10/resolve/refs%2Fpr%2F1/vit_model.py
333 Bytes
| import timm | |
| import torch.nn as nn | |
| class ViTModel(nn.Module): | |
| def __init__(self, num_classes): | |
| super(ViTModel, self).__init__() | |
| self.model = timm.create_model('vit_base_patch16_224', pretrained=False) | |
| self.model.head = nn.Linear(self.model.head.in_features,num_classes) | |
| def forward(self, x): | |
| return self.model(x) |