Instructions to use google/vit-hybrid-base-bit-384 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/vit-hybrid-base-bit-384 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="google/vit-hybrid-base-bit-384") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoModelForImageClassification model = AutoModelForImageClassification.from_pretrained("google/vit-hybrid-base-bit-384", dtype="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
#2
by ybelkada - opened
README.md
CHANGED
|
@@ -31,15 +31,15 @@ fine-tuned versions on a task that interests you.
|
|
| 31 |
Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
|
| 32 |
|
| 33 |
```python
|
| 34 |
-
from transformers import
|
| 35 |
from PIL import Image
|
| 36 |
import requests
|
| 37 |
|
| 38 |
url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
|
| 39 |
image = Image.open(requests.get(url, stream=True).raw)
|
| 40 |
|
| 41 |
-
feature_extractor =
|
| 42 |
-
model = ViTHybridForImageClassification.from_pretrained('google/vit-base-
|
| 43 |
|
| 44 |
inputs = feature_extractor(images=image, return_tensors="pt")
|
| 45 |
outputs = model(**inputs)
|
|
|
|
| 31 |
Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
|
| 32 |
|
| 33 |
```python
|
| 34 |
+
from transformers import ViTHybridImageProcessor, ViTHybridForImageClassification
|
| 35 |
from PIL import Image
|
| 36 |
import requests
|
| 37 |
|
| 38 |
url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
|
| 39 |
image = Image.open(requests.get(url, stream=True).raw)
|
| 40 |
|
| 41 |
+
feature_extractor = ViTHybridImageProcessor.from_pretrained('google/vit-hybrid-base-bit-384')
|
| 42 |
+
model = ViTHybridForImageClassification.from_pretrained('google/vit-hybrid-base-bit-384')
|
| 43 |
|
| 44 |
inputs = feature_extractor(images=image, return_tensors="pt")
|
| 45 |
outputs = model(**inputs)
|