Skip to content

Commit

Permalink
Preparing for final MobileCLIP hub locations (#893)
Browse files Browse the repository at this point in the history
* Preparing for final MobileCLIP hub locations

* Push to HF hub tweaks

* Update MobileCLIP weight locations

* Final MobileCLIP weight loc in apple org
  • Loading branch information
rwightman committed Jun 13, 2024
1 parent cf86ee7 commit 58e4e39
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 4 additions & 8 deletions src/open_clip/pretrained.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,16 +455,12 @@ def _mccfg(url='', hf_hub='', **kwargs):
),

"MobileCLIP-S1": dict(
datacompdr=_mccfg(
url='https://docs-assets.developer.apple.com/ml-research/datasets/mobileclip/mobileclip_s1.pt')),
datacompdr=_mccfg(hf_hub='apple/MobileCLIP-S1-OpenCLIP/')),
"MobileCLIP-S2": dict(
datacompdr=_mccfg(
url='https://docs-assets.developer.apple.com/ml-research/datasets/mobileclip/mobileclip_s2.pt')),
datacompdr=_mccfg(hf_hub='apple/MobileCLIP-S2-OpenCLIP/')),
"MobileCLIP-B": dict(
datacompdr=_mccfg(
url='https://docs-assets.developer.apple.com/ml-research/datasets/mobileclip/mobileclip_b.pt'),
datacompdr_lt=_mccfg(
url='https://docs-assets.developer.apple.com/ml-research/datasets/mobileclip/mobileclip_blt.pt'),
datacompdr=_mccfg(hf_hub='apple/MobileCLIP-B-OpenCLIP/'),
datacompdr_lt=_mccfg(hf_hub='apple/MobileCLIP-B-LT-OpenCLIP/'),
),

"ViTamin-S": dict(
Expand Down
6 changes: 5 additions & 1 deletion src/open_clip/push_to_hf_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def push_to_hf_hub(
private: bool = False,
create_pr: bool = False,
model_card: Optional[dict] = None,
safe_serialization: Union[bool, str] = False,
safe_serialization: Union[bool, str] = 'both',
):
if not isinstance(tokenizer, HFTokenizer):
# FIXME this makes it awkward to push models with new tokenizers, come up with better soln.
Expand Down Expand Up @@ -173,6 +173,7 @@ def push_pretrained_to_hf_hub(
create_pr: bool = False,
model_card: Optional[dict] = None,
hf_tokenizer_self: bool = False,
**kwargs,
):
model, preprocess_eval = create_model_from_pretrained(
model_name,
Expand All @@ -182,8 +183,11 @@ def push_pretrained_to_hf_hub(
image_std=image_std,
image_interpolation=image_interpolation,
image_resize_mode=image_resize_mode,
**kwargs,
)
model_config = get_model_config(model_name)
if pretrained == 'openai':
model_config['quick_gelu'] = True
assert model_config

tokenizer = get_tokenizer(model_name)
Expand Down

0 comments on commit 58e4e39

Please sign in to comment.