Instructions to use microsoft/beit-base-patch16-224-pt22k-ft22k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/beit-base-patch16-224-pt22k-ft22k with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="microsoft/beit-base-patch16-224-pt22k-ft22k") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("microsoft/beit-base-patch16-224-pt22k-ft22k") model = AutoModelForImageClassification.from_pretrained("microsoft/beit-base-patch16-224-pt22k-ft22k") - Inference
- Notebooks
- Google Colab
- Kaggle
config.json is missing 2 labels from id2label and label2id: 9205 and 15027
There are two labels missing from config.json's id2label key: 9205 and 15027. This causes issues in one's script when running the code in 'How to use':
predicted_class_idx = logits.argmax(-1).item()
print("Predicted class:", model.config.id2label[predicted_class_idx])
The keys are simply skipped in id2label (please see the photos attached), they are the only ones skipped in id2label (proof in photos), and they don't exist in label2id either (I checked).
I was simply playing around with the model when I got an error using your code and I noticed this. I can tell that the labels are missing because the model still predicts those keys, even though they're not in the config file.
This version is probably too old to get an update, but I'm leaving it here for anyone like me who's still using it.


