mobileclip
fartashf commited on
Commit
3136ea5
·
verified ·
1 Parent(s): 3f7e49e

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +5 -2
README.md CHANGED
@@ -25,7 +25,7 @@ This repository contains the **MobileCLIP2-S0** checkpoint.
25
 
26
  | Model | # Seen <BR>Samples (B) | # Params (M) <BR> (img + txt) | Latency (ms) <BR> (img + txt) | IN-1k Zero-Shot <BR> Top-1 Acc. (%) | Avg. Perf. (%) <BR> on 38 datasets |
27
  |:----------------------------------------------------------|:----------------------:|:-----------------------------:|:-----------------------------:|:-----------------------------------:|:----------------------------------:|
28
- | [MobileCLIP2-S0](https://hf.co/apple/MobileCLIP2-S0) | 13 | 11.4 + 42.4 | 1.5 + 1.6 | 71.5 | 59.7 |
29
  | [MobileCLIP2-S2](https://hf.co/apple/MobileCLIP2-S2) | 13 | 35.7 + 63.4 | 3.6 + 3.3 | 77.2 | 64.1 |
30
  | [MobileCLIP2-B](https://hf.co/apple/MobileCLIP2-B) | 13 | 86.3 + 63.4 | 10.4 + 3.3 | 79.4 | 65.8 |
31
  | [MobileCLIP2-S3](https://hf.co/apple/MobileCLIP2-S3) | 13 | 125.1 + 123.6 | 8.0 + 6.6 | 80.7 | 66.8 |
@@ -62,8 +62,11 @@ from mobileclip.modules.common.mobileone import reparameterize_model
62
  model, _, preprocess = open_clip.create_model_and_transforms('MobileCLIP2-S0', pretrained='/path/to/mobileclip2_s0.pt')
63
  tokenizer = open_clip.get_tokenizer('MobileCLIP2-S0')
64
 
 
 
 
65
  # For inference/model exporting purposes, please reparameterize first
66
- model = reparameterize_model(model.eval())
67
 
68
  image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
69
  text = tokenizer(["a diagram", "a dog", "a cat"])
 
25
 
26
  | Model | # Seen <BR>Samples (B) | # Params (M) <BR> (img + txt) | Latency (ms) <BR> (img + txt) | IN-1k Zero-Shot <BR> Top-1 Acc. (%) | Avg. Perf. (%) <BR> on 38 datasets |
27
  |:----------------------------------------------------------|:----------------------:|:-----------------------------:|:-----------------------------:|:-----------------------------------:|:----------------------------------:|
28
+ | [MobileCLIP2-S0](https://hf.co/apple/MobileCLIP2-S0) | 13 | 11.4 + 63.4 | 1.5 + 3.3 | 71.5 | 59.7 |
29
  | [MobileCLIP2-S2](https://hf.co/apple/MobileCLIP2-S2) | 13 | 35.7 + 63.4 | 3.6 + 3.3 | 77.2 | 64.1 |
30
  | [MobileCLIP2-B](https://hf.co/apple/MobileCLIP2-B) | 13 | 86.3 + 63.4 | 10.4 + 3.3 | 79.4 | 65.8 |
31
  | [MobileCLIP2-S3](https://hf.co/apple/MobileCLIP2-S3) | 13 | 125.1 + 123.6 | 8.0 + 6.6 | 80.7 | 66.8 |
 
62
  model, _, preprocess = open_clip.create_model_and_transforms('MobileCLIP2-S0', pretrained='/path/to/mobileclip2_s0.pt')
63
  tokenizer = open_clip.get_tokenizer('MobileCLIP2-S0')
64
 
65
+ # Model needs to be in eval mode for inference because of batchnorm layers unlike ViTs
66
+ model.eval()
67
+
68
  # For inference/model exporting purposes, please reparameterize first
69
+ model = reparameterize_model(model)
70
 
71
  image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
72
  text = tokenizer(["a diagram", "a dog", "a cat"])