teowu commited on
Commit
c6e7a7a
1 Parent(s): 0033227

Update modeling_mplug_owl2.py

Browse files
Files changed (1) hide show
  1. modeling_mplug_owl2.py +1 -1
modeling_mplug_owl2.py CHANGED
@@ -271,7 +271,7 @@ class MPLUGOwl2LlamaForCausalLM(LlamaForCausalLM, MPLUGOwl2MetaForCausalLM):
271
  ):
272
  if not hasattr(self, "weight_tensor"):
273
  self.weight_tensor = torch.Tensor([5.,4.,3.,2.,1.]).half().to(self.device)
274
- prompt = "USER: How would you rate the {} of this {}?\n<|image|>\nASSISTANT: The {} of the {} is".format(task_, input_, input_, task_)
275
  if input_ == "image":
276
  images = [expand2square(img, tuple(int(x*255) for x in self.image_processor.image_mean)) for img in images]
277
  input_ids = tokenizer_image_token(prompt, self.tokenizer, IMAGE_TOKEN_INDEX, return_tensors='pt').unsqueeze(0).to(self.device)
 
271
  ):
272
  if not hasattr(self, "weight_tensor"):
273
  self.weight_tensor = torch.Tensor([5.,4.,3.,2.,1.]).half().to(self.device)
274
+ prompt = "USER: How would you rate the {} of this {}?\n<|image|>\nASSISTANT: The {} of the {} is".format(task_, input_, task_, input_)
275
  if input_ == "image":
276
  images = [expand2square(img, tuple(int(x*255) for x in self.image_processor.image_mean)) for img in images]
277
  input_ids = tokenizer_image_token(prompt, self.tokenizer, IMAGE_TOKEN_INDEX, return_tensors='pt').unsqueeze(0).to(self.device)