nielsr HF staff commited on
Commit
e1a3478
1 Parent(s): be0d844
Files changed (1) hide show
  1. README.md +3 -4
README.md CHANGED
@@ -22,21 +22,20 @@ By pre-training the model, it learns an inner representation of images that can
22
 
23
  ## Intended uses & limitations
24
 
25
- You can use the raw model for image classification. See the [model hub](https://huggingface.co/models?search=google/vit) to look for
26
- fine-tuned versions on a task that interests you.
27
 
28
  ### How to use
29
 
30
  Here is how to use this model:
31
 
32
  ```python
33
- from transformers import ViTFeatureExtractor, ViTForImageClassification
34
  from PIL import Image
35
  import requests
36
  url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
37
  image = Image.open(requests.get(url, stream=True).raw)
38
  feature_extractor = ViTFeatureExtractor.from_pretrained('google/vit-large-patch16-224-in21k')
39
- model = ViTForImageClassification.from_pretrained('google/vit-large-patch16-224-in21k')
40
  inputs = feature_extractor(images=image, return_tensors="pt")
41
  outputs = model(**inputs)
42
  last_hidden_state = outputs.last_hidden_state
 
22
 
23
  ## Intended uses & limitations
24
 
25
+ You can use the raw model to embed images, but it's mostly intended to be fine-tuned on a downstream task.
 
26
 
27
  ### How to use
28
 
29
  Here is how to use this model:
30
 
31
  ```python
32
+ from transformers import ViTFeatureExtractor, ViTModel
33
  from PIL import Image
34
  import requests
35
  url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
36
  image = Image.open(requests.get(url, stream=True).raw)
37
  feature_extractor = ViTFeatureExtractor.from_pretrained('google/vit-large-patch16-224-in21k')
38
+ model = ViTModel.from_pretrained('google/vit-large-patch16-224-in21k')
39
  inputs = feature_extractor(images=image, return_tensors="pt")
40
  outputs = model(**inputs)
41
  last_hidden_state = outputs.last_hidden_state