Skip to content

Commit f4f052f

Browse files
zzhbrrLuodian
andauthored
[bugfix] fix bug in srt_api.py (#826)
* fix bug * fix: Correct time_instruction variable name and add modality check for video context --------- Co-authored-by: Bo Li <drluodian@gmail.com>
1 parent 5bc4a76 commit f4f052f

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

lmms_eval/models/simple/srt_api.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ async def generate(self, request):
182182
imgs = None
183183
break
184184

185-
time_instruciton = f"The video lasts for {video_time:.2f} seconds, and {len(frames)} frames are uniformly sampled from it. These frames are located at {frame_time}.Please answer the following questions related to this video."
186-
if self.add_time_instruction:
187-
contexts = f"{time_instruciton}\n{contexts}"
185+
time_instruction = f"The video lasts for {video_time:.2f} seconds, and {len(frames)} frames are uniformly sampled from it. These frames are located at {frame_time}.Please answer the following questions related to this video."
186+
if self.add_time_instruction and self.modality == "video" and imgs is not None:
187+
contexts = f"{time_instruction}\n{contexts}"
188188
else:
189189
contexts = f"{contexts}"
190190
# Handling video decode error
@@ -243,9 +243,9 @@ def generate_sync(self, request):
243243
imgs = None
244244
break
245245

246-
time_instruciton = f"The video lasts for {video_time:.2f} seconds, and {len(frames)} frames are uniformly sampled from it. These frames are located at {frame_time}.Please answer the following questions related to this video."
247-
if self.add_time_instruction:
248-
contexts = f"{time_instruciton}\n{contexts}"
246+
time_instruction = f"The video lasts for {video_time:.2f} seconds, and {len(frames)} frames are uniformly sampled from it. These frames are located at {frame_time}.Please answer the following questions related to this video."
247+
if self.add_time_instruction and self.modality == "video" and imgs is not None:
248+
contexts = f"{time_instruction}\n{contexts}"
249249
else:
250250
contexts = f"{contexts}"
251251
# Handling video decode error

0 commit comments

Comments
 (0)