Update modeling_mplug_owl2.py
Browse files- modeling_mplug_owl2.py +1 -1
modeling_mplug_owl2.py
CHANGED
@@ -281,7 +281,7 @@ class MPLUGOwl2LlamaForCausalLM(LlamaForCausalLM, MPLUGOwl2MetaForCausalLM):
|
|
281 |
images = [expand2square(img, tuple(int(x*255) for x in self.image_processor.image_mean)) for img in images]
|
282 |
image_tensor = self.image_processor.preprocess(images, return_tensors="pt")["pixel_values"].half().to(self.device)
|
283 |
input_ids = tokenizer_image_token(prompt, self.tokenizer, IMAGE_TOKEN_INDEX, return_tensors='pt').unsqueeze(0).to(self.device)
|
284 |
-
with torch.inference_mode():
|
285 |
output_logits = self(input_ids.repeat(image_tensor.shape[0], 1),
|
286 |
images=image_tensor)["logits"][:,-1, self.preferential_ids_]
|
287 |
if return_dict:
|
|
|
281 |
images = [expand2square(img, tuple(int(x*255) for x in self.image_processor.image_mean)) for img in images]
|
282 |
image_tensor = self.image_processor.preprocess(images, return_tensors="pt")["pixel_values"].half().to(self.device)
|
283 |
input_ids = tokenizer_image_token(prompt, self.tokenizer, IMAGE_TOKEN_INDEX, return_tensors='pt').unsqueeze(0).to(self.device)
|
284 |
+
if True: #with torch.inference_mode():
|
285 |
output_logits = self(input_ids.repeat(image_tensor.shape[0], 1),
|
286 |
images=image_tensor)["logits"][:,-1, self.preferential_ids_]
|
287 |
if return_dict:
|