valeriol29
commited on
Commit
•
8a9ba13
1
Parent(s):
abe3b35
Update README.md
Browse filesAdd some comments on pooling layer initialization according to https://github.com/huggingface/transformers/issues/25377#issuecomment-2164986543 🤗
cc
@amyeroberts
@nielsr
README.md
CHANGED
@@ -41,7 +41,10 @@ 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(
|
|
|
|
|
|
|
45 |
|
46 |
inputs = processor(images=image, return_tensors="pt")
|
47 |
outputs = model(**inputs)
|
|
|
41 |
image = Image.open(requests.get(url, stream=True).raw)
|
42 |
|
43 |
processor = ViTImageProcessor.from_pretrained('facebook/dino-vits16')
|
44 |
+
model = ViTModel.from_pretrained(
|
45 |
+
'facebook/dino-vits16',
|
46 |
+
add_pooling_layer=True # Whether to initialize the ViTPooler module. Set it to 'False' to load only the backbone. 🤗
|
47 |
+
)
|
48 |
|
49 |
inputs = processor(images=image, return_tensors="pt")
|
50 |
outputs = model(**inputs)
|