Update modeling_gpt2vision.py
Browse files- modeling_gpt2vision.py +1 -2
modeling_gpt2vision.py
CHANGED
@@ -69,9 +69,8 @@ class GPT2Vision(PreTrainedModel):
|
|
69 |
def generate(self, question, image, max_new_tokens=30, **kwargs):
|
70 |
# Process the image
|
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(
|
75 |
img_embs = self.mlp(img_features)
|
76 |
|
77 |
# Tokenize the question
|
|
|
69 |
def generate(self, question, image, max_new_tokens=30, **kwargs):
|
70 |
# Process the image
|
71 |
# Convert the image to a tensor and add a batch dimension
|
|
|
72 |
with torch.no_grad():
|
73 |
+
img_features = self.vision_encoder(image,device=self.device)
|
74 |
img_embs = self.mlp(img_features)
|
75 |
|
76 |
# Tokenize the question
|