This commit is contained in:
@@ -75,7 +75,9 @@ class CLIPFrozenBackbone(FrozenBackbone):
|
||||
from transformers import AutoTokenizer, CLIPModel
|
||||
except ImportError as error:
|
||||
raise RuntimeError("Install the 'hf' extra to use the CLIP backbone.") from error
|
||||
self.model = CLIPModel.from_pretrained(model_name)
|
||||
# Keep training and the post-training benchmark on the same cached artifact.
|
||||
# Otherwise Hugging Face may fetch both the legacy .bin and safetensors weights.
|
||||
self.model = CLIPModel.from_pretrained(model_name, use_safetensors=False)
|
||||
self.tokenizer = AutoTokenizer.from_pretrained(model_name)
|
||||
self.model.requires_grad_(False).eval()
|
||||
self.vision_dim = self.model.config.vision_config.hidden_size
|
||||
|
||||
Reference in New Issue
Block a user