Update modeling_internvl_chat.py
Browse files
modeling_internvl_chat.py
CHANGED
@@ -277,16 +277,15 @@ class InternVLChatModel(PreTrainedModel):
|
|
277 |
image_tokens = IMG_START_TOKEN + IMG_CONTEXT_TOKEN * self.num_image_token * num_patches + IMG_END_TOKEN
|
278 |
query = query.replace('<image>', image_tokens, 1)
|
279 |
|
280 |
-
print(self.num_image_token * num_patches)
|
281 |
-
print(query)
|
282 |
-
|
283 |
model_inputs = tokenizer(query, return_tensors='pt')
|
284 |
input_ids = model_inputs['input_ids'].cuda()
|
285 |
attention_mask = model_inputs['attention_mask'].cuda()
|
286 |
|
287 |
-
|
288 |
-
|
289 |
-
|
|
|
|
|
290 |
|
291 |
generation_config['eos_token_id'] = eos_token_id
|
292 |
generation_output = self.generate(
|
|
|
277 |
image_tokens = IMG_START_TOKEN + IMG_CONTEXT_TOKEN * self.num_image_token * num_patches + IMG_END_TOKEN
|
278 |
query = query.replace('<image>', image_tokens, 1)
|
279 |
|
|
|
|
|
|
|
280 |
model_inputs = tokenizer(query, return_tensors='pt')
|
281 |
input_ids = model_inputs['input_ids'].cuda()
|
282 |
attention_mask = model_inputs['attention_mask'].cuda()
|
283 |
|
284 |
+
if verbose:
|
285 |
+
print(f"hehe: {self.num_image_token * num_patches}")
|
286 |
+
print(f"hehe: {query}")
|
287 |
+
print(f"hehe: {input_ids.shape}")
|
288 |
+
print(f"hehe: {attention_mask.shape}")
|
289 |
|
290 |
generation_config['eos_token_id'] = eos_token_id
|
291 |
generation_output = self.generate(
|