[fix] fix image ilen
Browse files- modeling_videochat2.py +3 -1
modeling_videochat2.py
CHANGED
@@ -257,7 +257,7 @@ class InternVideo2_VideoChat2(BaseMLLM):
|
|
257 |
return_history =False,
|
258 |
generation_config={}
|
259 |
):
|
260 |
-
|
261 |
|
262 |
conversation = ""
|
263 |
if instruction:
|
@@ -268,8 +268,10 @@ class InternVideo2_VideoChat2(BaseMLLM):
|
|
268 |
)
|
269 |
|
270 |
if media_type == 'image':
|
|
|
271 |
conversation +=( "<img>" + IMG_TOKEN + "</img>")*ilen
|
272 |
else:
|
|
|
273 |
conversation += ("<vid>" + VID_TOKEN + "</vid>")*ilen
|
274 |
|
275 |
|
|
|
257 |
return_history =False,
|
258 |
generation_config={}
|
259 |
):
|
260 |
+
|
261 |
|
262 |
conversation = ""
|
263 |
if instruction:
|
|
|
268 |
)
|
269 |
|
270 |
if media_type == 'image':
|
271 |
+
ilen = media_tensor.shape[0]
|
272 |
conversation +=( "<img>" + IMG_TOKEN + "</img>")*ilen
|
273 |
else:
|
274 |
+
ilen = media_tensor.shape[1]
|
275 |
conversation += ("<vid>" + VID_TOKEN + "</vid>")*ilen
|
276 |
|
277 |
|