@@ -24,6 +24,16 @@ def jumpscore_doc_to_visual(doc: Dict[str, Any], lmms_eval_specific_kwargs: Opti
2424 os .path .join (cache_dir , video_ref ),
2525 os .path .join (cache_dir , "videos" , video_ref ),
2626 ]
27+ snapshot_root = os .path .join (hf_home , "hub" , "datasets--lmms-lab-encoder--JumpScore" , "snapshots" )
28+ if os .path .isdir (snapshot_root ):
29+ for snapshot in os .listdir (snapshot_root ):
30+ snapshot_dir = os .path .join (snapshot_root , snapshot )
31+ candidates .extend (
32+ [
33+ os .path .join (snapshot_dir , video_ref ),
34+ os .path .join (snapshot_dir , "videos" , video_ref ),
35+ ]
36+ )
2737 video_path = next ((path for path in candidates if os .path .exists (path )), candidates [0 ])
2838
2939 if not os .path .exists (video_path ):
@@ -48,26 +58,21 @@ def jumpscore_doc_to_target(doc: Dict[str, Any]) -> str:
4858
4959
5060def jumpscore_doc_to_messages (doc : Dict [str , Any ], lmms_eval_specific_kwargs : Optional [Dict [str , Any ]] = None ) -> List [Dict [str , Any ]]:
51- """Build the multi -turn JumpScore conversation used during evaluation."""
61+ """Build the single -turn JumpScore conversation used during evaluation."""
5262 if lmms_eval_specific_kwargs is None :
5363 lmms_eval_specific_kwargs = {}
5464
5565 video_path = jumpscore_doc_to_visual (doc , lmms_eval_specific_kwargs )[0 ]
56- count_question = str (doc .get ("count_question" , "" )).replace ("<image>" , "" ).strip ()
57- count_question = re .sub (r"\n+" , "\n " , count_question ).strip ()
58- count_answer = str (doc .get ("count_answer" , "" )).strip ()
5966 timestamps_question = jumpscore_doc_to_text (doc , lmms_eval_specific_kwargs )
6067
6168 return [
6269 {
6370 "role" : "user" ,
6471 "content" : [
6572 {"type" : "video" , "url" : video_path },
66- {"type" : "text" , "text" : count_question },
73+ {"type" : "text" , "text" : timestamps_question },
6774 ],
6875 },
69- {"role" : "assistant" , "content" : [{"type" : "text" , "text" : count_answer }]},
70- {"role" : "user" , "content" : [{"type" : "text" , "text" : timestamps_question }]},
7176 ]
7277
7378
0 commit comments