damerajee commited on
Commit
3423e05
·
verified ·
1 Parent(s): c3d5c9a

Update modeling_gpt2vision.py

Browse files
Files changed (1) hide show
  1. modeling_gpt2vision.py +0 -2
modeling_gpt2vision.py CHANGED
@@ -67,7 +67,6 @@ class GPT2Vision(PreTrainedModel):
67
  return_tensors="pt",
68
  ).to(device)
69
 
70
- print("text_inputs",text_inputs)
71
  # Adjust attention mask to account for image tokens and the extra <image> token
72
  batch_size = text_inputs.input_ids.shape[0]
73
  img_attention = torch.ones((batch_size, self.img_tokens + 1), dtype=torch.long, device=device)
@@ -100,7 +99,6 @@ class GPT2Vision(PreTrainedModel):
100
 
101
  def generate(self, question, image, max_new_tokens=30, **kwargs):
102
  prompt = f"\n\nQuestion:<image>{question}\n\nAnswer:"
103
- print("prompt",prompt)
104
  batch = {"image": [image], "text": prompt}
105
  encoded_batch = self.tokenize_encode(batch, self.device)
106
  inputs_embeds, attention_mask = self.preprocess_inputs(encoded_batch)
 
67
  return_tensors="pt",
68
  ).to(device)
69
 
 
70
  # Adjust attention mask to account for image tokens and the extra <image> token
71
  batch_size = text_inputs.input_ids.shape[0]
72
  img_attention = torch.ones((batch_size, self.img_tokens + 1), dtype=torch.long, device=device)
 
99
 
100
  def generate(self, question, image, max_new_tokens=30, **kwargs):
101
  prompt = f"\n\nQuestion:<image>{question}\n\nAnswer:"
 
102
  batch = {"image": [image], "text": prompt}
103
  encoded_batch = self.tokenize_encode(batch, self.device)
104
  inputs_embeds, attention_mask = self.preprocess_inputs(encoded_batch)