gmastrapas
commited on
Commit
•
6ba3c14
1
Parent(s):
6e76918
fix: throw warnings if xformers or flash-attn cant be used
Browse files- modeling_clip.py +6 -0
modeling_clip.py
CHANGED
@@ -203,6 +203,12 @@ class JinaCLIPPreTrainedModel(PreTrainedModel):
|
|
203 |
if isinstance(module, nn.Linear) and module.bias is not None:
|
204 |
module.bias.data.zero_()
|
205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
|
207 |
class JinaCLIPTextModel(JinaCLIPPreTrainedModel):
|
208 |
config_class = JinaCLIPTextConfig
|
|
|
203 |
if isinstance(module, nn.Linear) and module.bias is not None:
|
204 |
module.bias.data.zero_()
|
205 |
|
206 |
+
@classmethod
|
207 |
+
def from_pretrained(cls, *args, **kwargs):
|
208 |
+
if 'torch_dtype' not in kwargs:
|
209 |
+
kwargs['torch_dtype'] = 'auto'
|
210 |
+
return super().from_pretrained(*args, **kwargs)
|
211 |
+
|
212 |
|
213 |
class JinaCLIPTextModel(JinaCLIPPreTrainedModel):
|
214 |
config_class = JinaCLIPTextConfig
|