Upload model
Browse files- model.safetensors +2 -2
- modeling_biomedclip.py +6 -4
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1a3cd354abbc4c07e66bcd2cb74e19741242034545947eec9d79b1128e73527e
|
| 3 |
+
size 783662196
|
modeling_biomedclip.py
CHANGED
|
@@ -12,8 +12,10 @@ class BiomedCLIPModel(PreTrainedModel):
|
|
| 12 |
|
| 13 |
def __init__(self, config: BiomedCLIPConfig):
|
| 14 |
super().__init__(config)
|
| 15 |
-
|
| 16 |
-
self.model
|
|
|
|
|
|
|
| 17 |
embed_dim=config.embed_dim,
|
| 18 |
vision_cfg=CLIPVisionCfg(**config.vision_cfg),
|
| 19 |
text_cfg=CLIPTextCfg(**config.text_cfg),
|
|
@@ -27,7 +29,7 @@ class BiomedCLIPModel(PreTrainedModel):
|
|
| 27 |
text_inputs: Optional[torch.Tensor] = None,
|
| 28 |
**kwargs
|
| 29 |
):
|
| 30 |
-
return self.
|
| 31 |
|
| 32 |
def forward_intermediates(
|
| 33 |
self,
|
|
@@ -35,5 +37,5 @@ class BiomedCLIPModel(PreTrainedModel):
|
|
| 35 |
text_inputs: Optional[torch.Tensor] = None,
|
| 36 |
**kwargs
|
| 37 |
) -> Dict[str, Union[torch.Tensor, List[torch.Tensor]]]:
|
| 38 |
-
return self.
|
| 39 |
|
|
|
|
| 12 |
|
| 13 |
def __init__(self, config: BiomedCLIPConfig):
|
| 14 |
super().__init__(config)
|
| 15 |
+
|
| 16 |
+
# DON'T NAME THIS self.model or self.base_model
|
| 17 |
+
# (cf hardcoded name in transformers)
|
| 18 |
+
self.model_but_not_the_real_one = CustomTextCLIP(
|
| 19 |
embed_dim=config.embed_dim,
|
| 20 |
vision_cfg=CLIPVisionCfg(**config.vision_cfg),
|
| 21 |
text_cfg=CLIPTextCfg(**config.text_cfg),
|
|
|
|
| 29 |
text_inputs: Optional[torch.Tensor] = None,
|
| 30 |
**kwargs
|
| 31 |
):
|
| 32 |
+
return self.model_but_not_the_real_one(vision_inputs, text_inputs, **kwargs)
|
| 33 |
|
| 34 |
def forward_intermediates(
|
| 35 |
self,
|
|
|
|
| 37 |
text_inputs: Optional[torch.Tensor] = None,
|
| 38 |
**kwargs
|
| 39 |
) -> Dict[str, Union[torch.Tensor, List[torch.Tensor]]]:
|
| 40 |
+
return self.model_but_not_the_real_one.forward_intermediates(vision_inputs, text_inputs, **kwargs)
|
| 41 |
|