diff --git a/src/open_clip/pretrained.py b/src/open_clip/pretrained.py index a7ed923a1..4dcbf4ae5 100644 --- a/src/open_clip/pretrained.py +++ b/src/open_clip/pretrained.py @@ -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( diff --git a/src/open_clip/push_to_hf_hub.py b/src/open_clip/push_to_hf_hub.py index dcb8a78b5..26b5594e4 100644 --- a/src/open_clip/push_to_hf_hub.py +++ b/src/open_clip/push_to_hf_hub.py @@ -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. @@ -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, @@ -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)