nielsr HF staff commited on
Commit
526f02c
1 Parent(s): 9d9dbd9

Add model card

Browse files
Files changed (1) hide show
  1. README.md +9 -9
README.md CHANGED
@@ -7,9 +7,9 @@ datasets:
7
  - imagenet-21k
8
  ---
9
 
10
- # BEiT (large-sized model, fine-tuned on ImageNet-22k)
11
 
12
- BEiT model pre-trained in a self-supervised fashion on ImageNet-22k - also called ImageNet-21k (14 million images, 21,841 classes) at resolution 224x224, and fine-tuned on the same dataset at resolution 224x224. It was introduced in the paper [BEIT: BERT Pre-Training of Image Transformers](https://arxiv.org/abs/2106.08254) by Hangbo Bao, Li Dong and Furu Wei and first released in [this repository](https://github.com/microsoft/unilm/tree/master/beit).
13
 
14
  Disclaimer: The team releasing BEiT did not write a model card for this model so this model card has been written by the Hugging Face team.
15
 
@@ -32,26 +32,26 @@ fine-tuned versions on a task that interests you.
32
  Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
33
 
34
  ```python
35
- from transformers import BEiTFeatureExtractor, BEiTForImageClassification
36
  from PIL import Image
37
  import requests
 
38
  url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
39
  image = Image.open(requests.get(url, stream=True).raw)
40
- feature_extractor = BEiTFeatureExtractor.from_pretrained('microsoft/beit-large-patch16-224-pt22k')
41
- model = BEiTForImageClassification.from_pretrained('microsoft/beit-large-patch16-224-pt22k')
 
 
42
  inputs = feature_extractor(images=image, return_tensors="pt")
43
  outputs = model(**inputs)
44
  logits = outputs.logits
45
- # model predicts one of the 21,841 ImageNet-22k classes
46
- predicted_class_idx = logits.argmax(-1).item()
47
- print("Predicted class:", model.config.id2label[predicted_class_idx])
48
  ```
49
 
50
  Currently, both the feature extractor and model support PyTorch.
51
 
52
  ## Training data
53
 
54
- The BEiT model was pretrained on [ImageNet-21k](http://www.image-net.org/), a dataset consisting of 14 million images and 21k classes, and fine-tuned on the same dataset.
55
 
56
  ## Training procedure
57
 
 
7
  - imagenet-21k
8
  ---
9
 
10
+ # BEiT (large-sized model, pre-trained only)
11
 
12
+ BEiT model pre-trained in a self-supervised fashion on ImageNet-22k - also called ImageNet-21k (14 million images, 21,841 classes) at resolution 224x224. It was introduced in the paper [BEIT: BERT Pre-Training of Image Transformers](https://arxiv.org/abs/2106.08254) by Hangbo Bao, Li Dong and Furu Wei and first released in [this repository](https://github.com/microsoft/unilm/tree/master/beit).
13
 
14
  Disclaimer: The team releasing BEiT did not write a model card for this model so this model card has been written by the Hugging Face team.
15
 
 
32
  Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
33
 
34
  ```python
35
+ from transformers import BeitFeatureExtractor, BeitForMaskedImageModeling
36
  from PIL import Image
37
  import requests
38
+
39
  url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
40
  image = Image.open(requests.get(url, stream=True).raw)
41
+
42
+ feature_extractor = BeitFeatureExtractor.from_pretrained('microsoft/beit-large-patch16-224-pt22k')
43
+ model = BeitForMaskedImageModeling.from_pretrained('microsoft/beit-large-patch16-224-pt22k')
44
+
45
  inputs = feature_extractor(images=image, return_tensors="pt")
46
  outputs = model(**inputs)
47
  logits = outputs.logits
 
 
 
48
  ```
49
 
50
  Currently, both the feature extractor and model support PyTorch.
51
 
52
  ## Training data
53
 
54
+ The BEiT model was pretrained on [ImageNet-21k](http://www.image-net.org/), a dataset consisting of 14 million images and 21k classes.
55
 
56
  ## Training procedure
57