nielsr HF staff commited on
Commit
6eaf354
1 Parent(s): 89f1b49

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +13 -7
README.md CHANGED
@@ -101,16 +101,22 @@ inp = jnp.array(inp)
101
  </details>
102
 
103
 
104
- ## Pre-trained checkpoints
 
 
105
 
106
- The pre-trained models can be accessed via [PyTorch Hub](https://pytorch.org/hub/) as:
107
  ```python
108
- import torch
 
 
 
109
 
110
- aim_600m = torch.hub.load("apple/ml-aim", "aim_600M")
111
- aim_1b = torch.hub.load("apple/ml-aim", "aim_1B")
112
- aim_3b = torch.hub.load("apple/ml-aim", "aim_3B")
113
- aim_7b = torch.hub.load("apple/ml-aim", "aim_7B")
 
 
114
  ```
115
 
116
  ### Pre-trained backbones
 
101
  </details>
102
 
103
 
104
+ ## Usage
105
+
106
+ The pre-trained models can be used via [Hugging Face hub](https://huggingface.co/collections/apple/aim-65aa3ce948c718a574f09eb7) as follows:
107
 
 
108
  ```python
109
+ from PIL import Image
110
+
111
+ from aim.torch.models import AIMForImageClassification
112
+ from aim.torch.data import val_transforms
113
 
114
+ img = Image.open(...)
115
+ model = AIMForImageClassification.from_pretrained("apple/aim-7B")
116
+ transform = val_transforms()
117
+
118
+ inp = transform(img).unsqueeze(0)
119
+ logits, features = model(inp)
120
  ```
121
 
122
  ### Pre-trained backbones