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