Update README.md
Browse files
README.md
CHANGED
@@ -33,16 +33,17 @@ fine-tuned versions on a task that interests you.
|
|
33 |
Here is how to use this model:
|
34 |
|
35 |
```python
|
36 |
-
from transformers import
|
37 |
from PIL import Image
|
38 |
import requests
|
39 |
|
40 |
url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
|
41 |
image = Image.open(requests.get(url, stream=True).raw)
|
42 |
|
43 |
-
|
44 |
model = ViTModel.from_pretrained('facebook/dino-vits16')
|
45 |
-
|
|
|
46 |
outputs = model(**inputs)
|
47 |
last_hidden_states = outputs.last_hidden_state
|
48 |
```
|
|
|
33 |
Here is how to use this model:
|
34 |
|
35 |
```python
|
36 |
+
from transformers import ViTImageProcessor, ViTModel
|
37 |
from PIL import Image
|
38 |
import requests
|
39 |
|
40 |
url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
|
41 |
image = Image.open(requests.get(url, stream=True).raw)
|
42 |
|
43 |
+
processor = ViTImageProcessor.from_pretrained('facebook/dino-vits16')
|
44 |
model = ViTModel.from_pretrained('facebook/dino-vits16')
|
45 |
+
|
46 |
+
inputs = processor(images=image, return_tensors="pt")
|
47 |
outputs = model(**inputs)
|
48 |
last_hidden_states = outputs.last_hidden_state
|
49 |
```
|