Fix recent error 'Tensor on device cpu is not on the expected device meta'
Browse files- modeling_cased.py +3 -1
modeling_cased.py
CHANGED
|
@@ -32,7 +32,9 @@ class CaSEDModel(PreTrainedModel):
|
|
| 32 |
self.vision_proj = model.visual_projection
|
| 33 |
self.language_encoder = model.text_model
|
| 34 |
self.language_proj = model.text_projection
|
| 35 |
-
|
|
|
|
|
|
|
| 36 |
self.processor = CLIPProcessor.from_pretrained("openai/clip-vit-large-patch14")
|
| 37 |
|
| 38 |
# set hparams
|
|
|
|
| 32 |
self.vision_proj = model.visual_projection
|
| 33 |
self.language_encoder = model.text_model
|
| 34 |
self.language_proj = model.text_projection
|
| 35 |
+
# directly set the logit scale to 100.0 to avoid a recent error:
|
| 36 |
+
# RuntimeError: Tensor on device cpu is not on the expected device meta!
|
| 37 |
+
self.logit_scale = 100.0
|
| 38 |
self.processor = CLIPProcessor.from_pretrained("openai/clip-vit-large-patch14")
|
| 39 |
|
| 40 |
# set hparams
|