uoft-cs/cifar10
Viewer • Updated • 60k • 125k • 106
How to use yturkunov/cifar10_vit16_lora with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-classification", model="yturkunov/cifar10_vit16_lora")
pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png") # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("yturkunov/cifar10_vit16_lora", dtype="auto")An adapter for the google/vit-base-patch16-224 ViT trained on CIFAR10 classification task
from transformers import AutoModelForImageClassification
labels2title = ['plane', 'car', 'bird', 'cat',
'deer', 'dog', 'frog', 'horse', 'ship', 'truck']
model = AutoModelForImageClassification.from_pretrained(
'google/vit-base-patch16-224-in21k',
num_labels=len(labels2title),
id2label={i: c for i, c in enumerate(labels2title)},
label2id={c: i for i, c in enumerate(labels2title)}
)
model.load_adapter("yturkunov/cifar10_vit16_lora")
The model expects an image that has went through the following preprocessing stages: