Update modeling_gpt2vision.py
Browse files- modeling_gpt2vision.py +1 -1
modeling_gpt2vision.py
CHANGED
|
@@ -71,7 +71,7 @@ class GPT2Vision(PreTrainedModel):
|
|
| 71 |
# Convert the image to a tensor and add a batch dimension
|
| 72 |
image_tensor = self.vision_encoder.image_transform(image).unsqueeze(0).to(self.device)
|
| 73 |
with torch.no_grad():
|
| 74 |
-
img_features = self.vision_encoder(image_tensor)
|
| 75 |
img_embs = self.mlp(img_features)
|
| 76 |
|
| 77 |
# Tokenize the question
|
|
|
|
| 71 |
# Convert the image to a tensor and add a batch dimension
|
| 72 |
image_tensor = self.vision_encoder.image_transform(image).unsqueeze(0).to(self.device)
|
| 73 |
with torch.no_grad():
|
| 74 |
+
img_features = self.vision_encoder(image_tensor,device="cuda")
|
| 75 |
img_embs = self.mlp(img_features)
|
| 76 |
|
| 77 |
# Tokenize the question
|