Upload modeling_mplug_owl2.py with huggingface_hub
Browse files- modeling_mplug_owl2.py +0 -1
modeling_mplug_owl2.py
CHANGED
|
@@ -267,7 +267,6 @@ class MPLUGOwl2LlamaForCausalLM(LlamaForCausalLM, MPLUGOwl2MetaForCausalLM):
|
|
| 267 |
|
| 268 |
def chat(self, prompt: str, images, **generate_kwargs):
|
| 269 |
input_ids = tokenizer_image_token(prompt, self.tokenizer, -200, return_tensors='pt').unsqueeze(0).to(self.device)
|
| 270 |
-
images = [Image.open("fig/singapore_flyer.jpg"), Image.open("fig/boy_colorful.jpg")]
|
| 271 |
images = [expand2square(img, tuple(int(x*255) for x in self.image_processor.image_mean)) for img in images]
|
| 272 |
image_tensor = model.image_processor.preprocess(images, return_tensors="pt")["pixel_values"].half().to(self.device)
|
| 273 |
|
|
|
|
| 267 |
|
| 268 |
def chat(self, prompt: str, images, **generate_kwargs):
|
| 269 |
input_ids = tokenizer_image_token(prompt, self.tokenizer, -200, return_tensors='pt').unsqueeze(0).to(self.device)
|
|
|
|
| 270 |
images = [expand2square(img, tuple(int(x*255) for x in self.image_processor.image_mean)) for img in images]
|
| 271 |
image_tensor = model.image_processor.preprocess(images, return_tensors="pt")["pixel_values"].half().to(self.device)
|
| 272 |
|