jujujulien commited on
Commit
ca2e31f
·
verified ·
1 Parent(s): 75042d6

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +3 -0
  2. vlm_bench/jsonl/action_stat.json +40 -0
  3. vlm_bench/jsonl/test.jsonl +1 -0
  4. vlm_bench/jsonl/test_seeks.jsonl +1 -0
  5. vlm_bench/jsonl/train.jsonl +3 -0
  6. vlm_bench/jsonl/train_seeks.jsonl +0 -0
  7. vlm_bench/jsonl/val.jsonl +3 -0
  8. vlm_bench/jsonl/val_seeks.jsonl +1 -0
  9. vlm_bench/run_infer_gemini_file_api.py +206 -0
  10. vlm_bench/run_infer_gemini_file_api.sh +7 -0
  11. vlm_bench/run_infer_openai_responses.py +213 -0
  12. vlm_bench/run_infer_openai_responses.sh +6 -0
  13. vlm_bench/test_sample/.codex +0 -0
  14. vlm_bench/test_sample/2026-02-09_09-37-20_streaming.json +0 -0
  15. vlm_bench/test_sample/2026-02-09_10-03-48_streaming.json +0 -0
  16. vlm_bench/test_sample/2026-02-09_10-09-29_streaming.json +0 -0
  17. vlm_bench/test_sample/2026-02-09_10-16-43_streaming.json +0 -0
  18. vlm_bench/test_sample/2026-02-09_10-19-05_streaming.json +0 -0
  19. vlm_bench/test_sample/2026-02-09_10-24-08_streaming.json +0 -0
  20. vlm_bench/test_sample/2026-02-09_10-36-17_streaming.json +0 -0
  21. vlm_bench/test_sample/2026-02-09_11-03-39_streaming.json +0 -0
  22. vlm_bench/test_sample/2026-02-09_11-05-37_streaming.json +0 -0
  23. vlm_bench/test_sample/2026-02-09_11-33-29_streaming.json +0 -0
  24. vlm_bench/test_sample/2026-02-09_11-49-01_streaming.json +0 -0
  25. vlm_bench/test_sample/2026-02-09_11-53-51_streaming.json +0 -0
  26. vlm_bench/test_sample/2026-02-09_11-54-21_streaming.json +0 -0
  27. vlm_bench/test_sample/2026-02-09_11-59-05_streaming.json +0 -0
  28. vlm_bench/test_sample/2026-02-09_13-59-44_streaming.json +0 -0
  29. vlm_bench/test_sample/2026-02-09_14-02-27_streaming.json +0 -0
  30. vlm_bench/test_sample/2026-02-09_14-08-03_streaming.json +0 -0
  31. vlm_bench/test_sample/2026-02-09_14-22-04_streaming.json +0 -0
  32. vlm_bench/test_sample/2026-02-09_15-33-02_streaming.json +0 -0
  33. vlm_bench/test_sample/2026-02-09_15-50-44_streaming.json +0 -0
  34. vlm_bench/test_sample/2026-02-09_15-51-30_streaming.json +0 -0
  35. vlm_bench/test_sample/2026-02-09_16-01-22_streaming.json +0 -0
  36. vlm_bench/test_sample/2026-02-09_16-03-23_streaming.json +0 -0
  37. vlm_bench/test_sample/2026-02-09_16-12-18_streaming.json +0 -0
  38. vlm_bench/test_sample/2026-02-09_16-15-33_streaming.json +0 -0
  39. vlm_bench/test_sample/2026-02-09_16-46-23_streaming.json +0 -0
  40. vlm_bench/test_sample/2026-02-09_16-55-54_streaming.json +0 -0
  41. vlm_bench/test_sample/2026-02-09_17-21-43_streaming.json +0 -0
  42. vlm_bench/test_sample/2026-02-09_19-09-07_streaming.json +0 -0
  43. vlm_bench/test_sample/2026-02-10_09-28-51_streaming.json +0 -0
  44. vlm_bench/test_sample/2026-02-10_09-37-43_streaming.json +0 -0
  45. vlm_bench/test_sample/2026-02-10_09-41-50_streaming.json +0 -0
  46. vlm_bench/test_sample/2026-02-10_09-58-58_streaming.json +0 -0
  47. vlm_bench/test_sample/2026-02-10_10-18-36_streaming.json +0 -0
  48. vlm_bench/test_sample/2026-02-10_10-18-57_streaming.json +0 -0
  49. vlm_bench/test_sample/2026-02-10_10-32-37_streaming.json +0 -0
  50. vlm_bench/test_sample/2026-02-10_10-47-30_streaming.json +0 -0
.gitattributes CHANGED
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ vlm_bench/jsonl/train.jsonl filter=lfs diff=lfs merge=lfs -text
37
+ vlm_bench/jsonl/val.jsonl filter=lfs diff=lfs merge=lfs -text
38
+ vlm_bench/test_sample/jsonl/train.jsonl filter=lfs diff=lfs merge=lfs -text
vlm_bench/jsonl/action_stat.json ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "dim_0": {
3
+ "percentile_1": 0.0,
4
+ "percentile_99": 115.92945861816406,
5
+ "min": -5.033192157745361,
6
+ "max": 188.26437377929688,
7
+ "mean": 51.6222038269043,
8
+ "std": 35.073944091796875
9
+ },
10
+ "dim_1": {
11
+ "percentile_1": -25.756540298461914,
12
+ "percentile_99": 25.283449172973633,
13
+ "min": -57.32617950439453,
14
+ "max": 59.892730712890625,
15
+ "mean": -0.019391728565096855,
16
+ "std": 7.043888568878174
17
+ },
18
+ "dim_2": {
19
+ "percentile_1": -41.46500015258789,
20
+ "percentile_99": 12.942999839782715,
21
+ "min": -99.4010009765625,
22
+ "max": 94.98100280761719,
23
+ "mean": -0.947987973690033,
24
+ "std": 7.797375679016113
25
+ },
26
+ "dim_3": {
27
+ "percentile_1": -8.52299976348877,
28
+ "percentile_99": 8.555090255737156,
29
+ "min": -16.365999221801758,
30
+ "max": 15.791999816894531,
31
+ "mean": 0.00621329341083765,
32
+ "std": 2.204838275909424
33
+ },
34
+ "_info": {
35
+ "num_samples": 14501,
36
+ "num_samples_with_actions": 14501,
37
+ "total_action_frames": 2784192,
38
+ "action_dim": 4
39
+ }
40
+ }
vlm_bench/jsonl/test.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"role": "user", "content": [{"type": "video", "video": "2026-02-12_15-27-51.mp4", "video_start": 48, "video_end": 60}, {"type": "text", "text": "You are a professional drone flight assistant. Analyze the following inputs: Previous Modal inference results(History), the video frames, overall mission instruction. Based on the visual context from the video, provide a single, concise paragraph analyzing which mission should be executed next. Your analysis must ONLY address:\n Completion Status: Has the current mission been completed based on the visual evidence? \n Action Plan:\n - If YES: How to execute the next step? \n - If NO: How to proceed to finish the current mission. \n Constraint: Direct output only. Do not include introductory or concluding remarks.The overall mission instruction is: \"Rising above the treetops, the drone turns right above the residential driveway near the gray house, then flies forward along the tree-lined suburban street while passing by the large leafy tree on the left; it proceeds straight past the row of single-story houses and simultaneously approaches the wooden telephone pole on the left before descending toward the paved surface of the road.\" Following is the modal inference history: /n", "previous": "You are a professional drone flight assistant. Analyze the following inputs: Previous Modal inference results(History), the video frames, overall mission instruction. Based on the visual context from the video, provide a single, concise paragraph analyzing which mission should be executed next. Your analysis must ONLY address:\n Completion Status: Has the current mission been completed based on the visual evidence? \n Action Plan:\n - If YES: How to execute the next step? \n - If NO: How to proceed to finish the current mission. \n Constraint: Direct output only. Do not include introductory or concluding remarks.The overall mission instruction is: \"Rising above the treetops, the drone turns right above the residential driveway near the gray house, then flies forward along the tree-lined suburban street while passing by the large leafy tree on the left; it proceeds straight past the row of single-story houses and simultaneously approaches the wooden telephone pole on the left before descending toward the paved surface of the road.\"Following is the modal inference history: /nStatus: Drone is on the ground, ready for first mission. Next: Ascend before trees, then turn right above residential driveway. Status: Drone ascending, still below treetops. Next: Ascend to clear tree line, then turn right above driveway near gray house. Status: Drone completed initial rise, aligned with driveway. Next: Turn right at driveway, then process forwards along tree-lined street. Status: Drone completed right turn near gray house. Next: Process forwards along the tree-lined suburban street. Status: Drone completed right turn, aligned with tree-lined street. Next: Process forwards to follow street's trajectory. Status: Drone is flying along tree-lined suburban street. Next: Process forwards to large leafy tree on the left. Status: Drone is still approaching the large leafy tree. Next: Process forwards to pass by the large leafy tree on the left. Status: Drone is flying along tree-lined street, approaching large leafy tree. Next: Process forwards to pass by the large leafy tree on the left. Status: Drone has not passed the large leafy tree. Next: Process forwards to pass the tree. Status: Drone has not passed the large leafy tree. Next: Process forwards to pass the tree, then proceed past single-story houses. Status: Drone passed the large leafy tree. Next: Process forwards to past the row of single-story houses. Status: Drone mid-street, houses still visible. Next: Process forwards to pass single-story houses. Status: Drone is approaching single-story houses. Next: Process forwards past houses, then approach wooden telephone pole on left. Status: Drone still proceeding past single-story houses. Next: Process forwards to wooden telephone pole, then descend towards road. Status: Drone passed single-story houses and is approaching the wooden telephone pole. Next: Process forwards to wooden telephone pole, then descend towards road surface. Status: Drone completed approach to wooden telephone pole. Next: Descend towards the paved surface of the road.", "title": "2026-02-12_15-27-51.mp4", "category": null}]}, {"role": "assistant", "content": [{"type": "text_stream", "text_stream": [[48, 51, "Status: Drone still at altitude above the road. Next: Descend towards paved surface, then mission completed."], [51, 54, "Status: Drone completed descent to road level. Next: No further action required."], [54, 57, "Status: Drone has landed and completed all missions. Next: None."], [57, 60, "Status: Drone has landed and completed all missions. Next: No further action required."]], "qa_stream": []}], "action": [[[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0,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0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]]], "state": [86.87099999999998, 86.87099999999998, 86.87099999999998, 86.87099999999998]}]
vlm_bench/jsonl/test_seeks.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ [0]
vlm_bench/jsonl/train.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c15ad848b15595ad8b442731a4ce5ae6582cffca6082ec326c0187a3304f3df
3
+ size 248556955
vlm_bench/jsonl/train_seeks.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/jsonl/val.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:23f4f359e3c19f83818e27f28b3c9868dba99f2e3ec577e729b43806c946d767
3
+ size 27539631
vlm_bench/jsonl/val_seeks.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ [0, 17770, 36454, 54569, 73225, 91232, 101601, 117776, 135448, 153363, 170935, 185359, 200365, 220858, 237673, 255487, 273961, 293989, 313390, 332623, 351434, 370685, 389760, 408309, 426521, 442301, 461696, 479450, 495550, 509179, 519737, 535537, 553618, 573376, 582963, 594087, 613029, 631229, 649903, 669011, 687227, 705218, 716347, 733544, 750185, 768206, 786164, 805395, 817903, 837994, 855853, 875795, 894852, 914211, 928787, 945680, 956819, 976030, 993681, 1012387, 1027609, 1037620, 1054916, 1072764, 1091122, 1110565, 1128545, 1148576, 1167548, 1183786, 1201675, 1220980, 1238718, 1257337, 1274515, 1292805, 1312802, 1330589, 1350146, 1361481, 1378793, 1396564, 1414773, 1424269, 1443705, 1462355, 1471085, 1488573, 1499679, 1517404, 1534689, 1554545, 1569981, 1590322, 1608625, 1626623, 1644772, 1664074, 1682445, 1700009, 1717495, 1737133, 1754269, 1775079, 1794823, 1811771, 1829415, 1847977, 1863059, 1882069, 1900757, 1920455, 1938729, 1956275, 1975695, 1993696, 2010927, 2029102, 2040550, 2057648, 2074110, 2093356, 2111736, 2129194, 2139729, 2158999, 2175038, 2185979, 2203826, 2219888, 2239040, 2258767, 2267818, 2288336, 2305268, 2324054, 2342395, 2353115, 2371846, 2389148, 2406972, 2418210, 2437169, 2453700, 2473647, 2482717, 2500367, 2520099, 2538690, 2549990, 2569698, 2589663, 2599685, 2618038, 2638180, 2656654, 2674120, 2692301, 2707823, 2726616, 2738166, 2755733, 2775477, 2795652, 2808151, 2818841, 2830938, 2847802, 2863471, 2883057, 2892974, 2910511, 2928607, 2943701, 2962008, 2971021, 2988796, 3006613, 3024492, 3042050, 3060828, 3077363, 3097468, 3114772, 3133265, 3151318, 3163806, 3183106, 3201160, 3220653, 3237471, 3250994, 3272080, 3291574, 3310322, 3328919, 3346882, 3364501, 3382717, 3400926, 3418374, 3433748, 3454707, 3472509, 3493495, 3512257, 3531467, 3550631, 3570209, 3581761, 3596345, 3615009, 3633467, 3651803, 3670347, 3690192, 3709306, 3727463, 3747139, 3765481, 3784321, 3795924, 3813613, 3830925, 3848485, 3866456, 3885446, 3900659, 3919041, 3928343, 3944182, 3964941, 3985788, 4005321, 4024382, 4043209, 4052120, 4067760, 4085839, 4105011, 4123450, 4142704, 4160517, 4175344, 4193561, 4211481, 4228830, 4247453, 4261717, 4273855, 4291437, 4311389, 4326178, 4344393, 4362674, 4377150, 4387487, 4406159, 4419866, 4434189, 4451617, 4469068, 4487435, 4499402, 4513113, 4531294, 4550516, 4560071, 4577571, 4596541, 4615608, 4625806, 4645984, 4663768, 4684155, 4701992, 4720873, 4740463, 4757807, 4776753, 4786509, 4804604, 4823144, 4840591, 4854611, 4873290, 4894219, 4911357, 4931946, 4945939, 4964876, 4981882, 4999145, 5018194, 5038161, 5048346, 5060884, 5078127, 5099178, 5116814, 5126472, 5144533, 5162493, 5184908, 5200526, 5222022, 5241972, 5259672, 5277436, 5295461, 5306395, 5324507, 5342369, 5360985, 5379990, 5400780, 5418644, 5436399, 5454750, 5472112, 5486532, 5504791, 5522279, 5540846, 5556463, 5574840, 5593358, 5612286, 5632564, 5647639, 5665162, 5683447, 5696058, 5715360, 5732886, 5750815, 5767214, 5778774, 5797983, 5815445, 5834782, 5849381, 5867608, 5886014, 5896434, 5905750, 5921677, 5940636, 5959598, 5977509, 5997459, 6016169, 6034000, 6052331, 6070300, 6087532, 6105164, 6122462, 6132304, 6152080, 6169594, 6186817, 6205942, 6224859, 6244434, 6263325, 6282838, 6297157, 6314893, 6333756, 6351751, 6363505, 6381080, 6398840, 6416615, 6433949, 6451356, 6469893, 6479923, 6499059, 6511246, 6530327, 6549471, 6567659, 6586898, 6597607, 6616148, 6627222, 6648083, 6665575, 6684812, 6704074, 6721600, 6739676, 6758355, 6776567, 6793931, 6811382, 6822507, 6842025, 6862133, 6881766, 6898956, 6916468, 6934922, 6952722, 6966167, 6984082, 7002596, 7022129, 7040997, 7059293, 7077213, 7095111, 7112965, 7133810, 7151865, 7170044, 7188705, 7206447, 7224552, 7241789, 7251933, 7271068, 7281793, 7301395, 7318887, 7330950, 7349453, 7367986, 7386694, 7404891, 7420158, 7429546, 7448374, 7469191, 7489551, 7499674, 7514531, 7533635, 7543113, 7560518, 7579138, 7591009, 7605278, 7622798, 7641320, 7658280, 7676901, 7695046, 7710931, 7730918, 7748975, 7767156, 7787454, 7806264, 7824039, 7842695, 7861594, 7881748, 7900539, 7917677, 7935463, 7951007, 7970111, 7988444, 8008492, 8027652, 8045140, 8062535, 8081137, 8091639, 8109769, 8118987, 8134953, 8155166, 8168708, 8186042, 8205762, 8215477, 8224558, 8242763, 8260797, 8280917, 8298627, 8318542, 8337567, 8356709, 8374832, 8392002, 8411895, 8430532, 8449326, 8459435, 8479082, 8487809, 8504379, 8524427, 8542864, 8559893, 8580830, 8594579, 8614048, 8633591, 8652684, 8671261, 8691360, 8708609, 8727324, 8741771, 8759261, 8779354, 8797923, 8818609, 8833652, 8845025, 8863332, 8880192, 8898314, 8916660, 8934173, 8943788, 8959450, 8978458, 8995993, 9013727, 9033190, 9050920, 9066669, 9085725, 9106598, 9126286, 9144392, 9163485, 9173640, 9190902, 9209479, 9231415, 9250298, 9266740, 9287019, 9306113, 9324649, 9337466, 9348205, 9367376, 9383966, 9393639, 9411234, 9428792, 9446201, 9459143, 9476758, 9494731, 9513087, 9531371, 9548924, 9566664, 9586751, 9598101, 9615515, 9627522, 9648112, 9666783, 9685247, 9703287, 9723426, 9741128, 9758709, 9770904, 9790482, 9808307, 9818818, 9827933, 9846268, 9864166, 9882670, 9902046, 9920781, 9938917, 9957079, 9974296, 9993686, 10012458, 10031620, 10050009, 10059405, 10078188, 10096616, 10113922, 10131101, 10147436, 10165023, 10184480, 10203283, 10222343, 10241422, 10262204, 10279361, 10297633, 10315325, 10327854, 10343855, 10360153, 10380523, 10396608, 10415739, 10430814, 10448971, 10466375, 10485028, 10502727, 10520890, 10538919, 10556828, 10575291, 10586609, 10605374, 10624434, 10642195, 10662691, 10681769, 10703009, 10722175, 10739992, 10752141, 10770852, 10788467, 10807657, 10819471, 10836760, 10857379, 10875167, 10886535, 10906559, 10924415, 10941473, 10961248, 10979815, 10999259, 11016503, 11034872, 11052567, 11070462, 11088998, 11099479, 11118442, 11135974, 11150443, 11168091, 11186344, 11203528, 11215751, 11235592, 11254602, 11272213, 11290340, 11307139, 11325897, 11345797, 11363369, 11382476, 11400230, 11410937, 11429471, 11447033, 11465274, 11483192, 11500694, 11519757, 11541182, 11559555, 11576998, 11596393, 11606997, 11626105, 11639645, 11657080, 11674836, 11693062, 11703913, 11723301, 11739483, 11758175, 11776691, 11794926, 11811687, 11830508, 11848045, 11867271, 11884965, 11904299, 11922966, 11934143, 11952464, 11970460, 11988592, 12007946, 12018248, 12028455, 12045033, 12063857, 12081667, 12099470, 12119010, 12137143, 12150453, 12167930, 12182308, 12201085, 12219646, 12237748, 12256085, 12273516, 12288115, 12305183, 12315892, 12334825, 12352264, 12367717, 12385689, 12403871, 12421232, 12440066, 12459317, 12477808, 12495767, 12514335, 12526669, 12546166, 12565748, 12583866, 12598397, 12618269, 12631043, 12649408, 12668882, 12688183, 12698306, 12716658, 12734269, 12751771, 12769622, 12787237, 12806012, 12823878, 12842658, 12853268, 12864237, 12873906, 12893320, 12909071, 12926905, 12944796, 12962780, 12972963, 12990524, 13010758, 13029286, 13048209, 13066897, 13085390, 13102710, 13116337, 13133207, 13151340, 13166999, 13184405, 13202217, 13219298, 13237418, 13255556, 13266931, 13276441, 13285954, 13303008, 13322838, 13341307, 13350931, 13360323, 13370220, 13380285, 13398197, 13417707, 13435892, 13453593, 13462997, 13480635, 13498164, 13516944, 13537438, 13556980, 13575881, 13594377, 13611886, 13630467, 13642999, 13662217, 13670774, 13688613, 13707212, 13726949, 13744333, 13763396, 13782270, 13800182, 13818172, 13829953, 13848642, 13867527, 13876682, 13892008, 13908316, 13926659, 13946068, 13957924, 13975782, 13988867, 14006599, 14026199, 14045895, 14064371, 14083886, 14102740, 14120545, 14138202, 14157103, 14175251, 14185111, 14195767, 14214504, 14231886, 14249874, 14267632, 14286342, 14303127, 14321606, 14341431, 14359051, 14372377, 14392577, 14410090, 14427595, 14436332, 14452551, 14462139, 14480923, 14498711, 14515743, 14533503, 14551787, 14570907, 14589732, 14607550, 14625484, 14644556, 14664138, 14678253, 14695873, 14714135, 14723090, 14740092, 14753490, 14771702, 14789624, 14803631, 14821595, 14840732, 14859293, 14876784, 14891374, 14910520, 14928881, 14950485, 14970126, 14988681, 15007151, 15019363, 15035604, 15055583, 15074389, 15093618, 15112464, 15129732, 15149001, 15158403, 15175727, 15193524, 15214160, 15232018, 15247810, 15267230, 15285496, 15304610, 15313992, 15333009, 15351482, 15368670, 15380296, 15398046, 15416519, 15433761, 15444037, 15461937, 15471552, 15491728, 15510288, 15521485, 15533319, 15551327, 15568204, 15587017, 15606793, 15624572, 15642821, 15652208, 15671113, 15688519, 15702628, 15712257, 15730228, 15747518, 15762743, 15770989, 15782117, 15800623, 15817994, 15827809, 15848102, 15866160, 15884581, 15904898, 15924216, 15942688, 15960952, 15980265, 15998296, 16016623, 16034537, 16050633, 16059580, 16077786, 16097573, 16106523, 16126105, 16145230, 16163462, 16182484, 16193482, 16212740, 16230770, 16248251, 16263767, 16280470, 16298439, 16316006, 16335120, 16343786, 16363566, 16380842, 16400148, 16419729, 16430427, 16449842, 16469186, 16489437, 16508133, 16525283, 16543680, 16563509, 16573863, 16593589, 16613806, 16633526, 16653136, 16671614, 16692035, 16710530, 16725626, 16738344, 16756061, 16774224, 16791999, 16802954, 16821563, 16839903, 16854305, 16872577, 16891553, 16909507, 16927757, 16945589, 16964148, 16982887, 17000814, 17020349, 17039566, 17057073, 17075528, 17089632, 17098885, 17117060, 17136851, 17155976, 17175194, 17192446, 17210993, 17230350, 17248943, 17267501, 17286694, 17297909, 17315819, 17334346, 17352140, 17363488, 17380642, 17391456, 17412709, 17431537, 17451738, 17462231, 17471679, 17490607, 17509416, 17528875, 17538063, 17555837, 17575536, 17593619, 17604408, 17613553, 17632147, 17641956, 17660878, 17679715, 17699523, 17718718, 17738267, 17756805, 17774732, 17792699, 17812278, 17828773, 17848224, 17859242, 17877271, 17895425, 17913116, 17925737, 17944649, 17962103, 17981328, 17999023, 18016022, 18033280, 18051171, 18070292, 18088585, 18107035, 18124407, 18143513, 18153085, 18173360, 18190917, 18209060, 18218052, 18231245, 18249106, 18264580, 18273955, 18291255, 18311423, 18329048, 18347431, 18367072, 18387219, 18405056, 18424715, 18439450, 18457445, 18476359, 18494859, 18513660, 18532841, 18552785, 18570773, 18590562, 18611085, 18630180, 18649869, 18667449, 18685803, 18704816, 18722326, 18735707, 18754261, 18773140, 18792435, 18810896, 18828669, 18845978, 18864115, 18874461, 18893896, 18912049, 18922667, 18942813, 18964770, 18983280, 18994546, 19004263, 19022530, 19040023, 19062055, 19079554, 19096788, 19114477, 19133313, 19152162, 19170430, 19188430, 19199664, 19219386, 19237109, 19256441, 19275722, 19295078, 19312953, 19332329, 19352618, 19372544, 19391658, 19408545, 19424612, 19442379, 19462427, 19472453, 19490362, 19500378, 19518243, 19528122, 19546373, 19564744, 19585057, 19603978, 19621873, 19633690, 19652988, 19661948, 19677601, 19695888, 19705584, 19725036, 19743998, 19761414, 19779974, 19797429, 19814641, 19832928, 19853112, 19870612, 19887959, 19906832, 19924731, 19941672, 19957285, 19975030, 19994315, 20013845, 20032042, 20050037, 20069237, 20088775, 20106719, 20116122, 20136324, 20154542, 20171570, 20188194, 20209156, 20221272, 20239147, 20256131, 20276035, 20295194, 20312262, 20330366, 20350735, 20368985, 20386780, 20405620, 20414900, 20434615, 20456766, 20473159, 20491766, 20510298, 20526660, 20545436, 20564910, 20582669, 20592025, 20610325, 20622901, 20633038, 20651612, 20670309, 20687726, 20705552, 20724297, 20744920, 20754358, 20775319, 20793556, 20812283, 20825411, 20843576, 20861058, 20878168, 20896501, 20914077, 20933069, 20951213, 20969791, 20980240, 20998107, 21016692, 21034870, 21052434, 21061033, 21080229, 21099451, 21119011, 21138326, 21155264, 21174114, 21191958, 21211308, 21230834, 21249284, 21266788, 21277251, 21289604, 21308954, 21326612, 21346152, 21364636, 21384748, 21402573, 21420605, 21438397, 21450169, 21467562, 21485104, 21494829, 21514589, 21527060, 21543894, 21561624, 21581407, 21592246, 21609894, 21627569, 21646616, 21665584, 21681104, 21698490, 21718140, 21739303, 21757978, 21775851, 21794335, 21813488, 21824643, 21842204, 21862948, 21879424, 21895467, 21913421, 21932035, 21950048, 21970046, 21988169, 22005809, 22018042, 22035528, 22053547, 22071374, 22081521, 22100526, 22118407, 22137454, 22156293, 22174583, 22192579, 22211358, 22223406, 22236962, 22250928, 22269892, 22289595, 22309324, 22327661, 22345223, 22362463, 22377007, 22395007, 22414050, 22433440, 22453591, 22473686, 22484217, 22503449, 22522640, 22541102, 22549563, 22567895, 22586392, 22600914, 22618186, 22631937, 22650989, 22661431, 22680229, 22696854, 22707288, 22726909, 22746597, 22767912, 22777378, 22788668, 22807109, 22826184, 22843754, 22863699, 22882732, 22895313, 22912709, 22932194, 22950418, 22971263, 22990220, 23013315, 23031562, 23050376, 23068417, 23082041, 23099871, 23119118, 23130002, 23148202, 23165225, 23174035, 23191880, 23200982, 23211713, 23230482, 23241796, 23253020, 23271881, 23290570, 23302851, 23320304, 23338623, 23357490, 23376229, 23393684, 23412974, 23431704, 23449085, 23465217, 23483570, 23501952, 23519727, 23537211, 23554944, 23573809, 23591563, 23610717, 23628823, 23646459, 23664385, 23682660, 23692756, 23707252, 23724592, 23742477, 23752286, 23770544, 23788599, 23806723, 23826944, 23845251, 23854783, 23872168, 23881673, 23901815, 23910256, 23927994, 23945360, 23963373, 23983262, 24001671, 24014324, 24032498, 24049841, 24067796, 24080894, 24099040, 24117242, 24136962, 24155878, 24174219, 24191672, 24210549, 24221156, 24239873, 24256051, 24273581, 24291979, 24304268, 24313924, 24328702, 24346678, 24367633, 24385297, 24403350, 24422335, 24440008, 24458816, 24476555, 24494792, 24513074, 24530816, 24545473, 24555069, 24576240, 24595638, 24615356, 24633642, 24650888, 24668722, 24688590, 24708723, 24719349, 24736393, 24746466, 24760684, 24776747, 24796859, 24816133, 24836061, 24853241, 24862422, 24881323, 24892663, 24902884, 24921525, 24939245, 24957437, 24970706, 24990163, 25008799, 25026314, 25044632, 25064014, 25082955, 25099995, 25117176, 25136238, 25154458, 25166157, 25185061, 25203987, 25222069, 25240721, 25250159, 25267989, 25285449, 25305551, 25323520, 25342433, 25361005, 25380542, 25390285, 25400366, 25418969, 25436281, 25448282, 25457976, 25476647, 25493530, 25502495, 25520939, 25539048, 25557931, 25577483, 25595271, 25610776, 25619615, 25637472, 25647277, 25667203, 25685992, 25705161, 25723270, 25733472, 25754043, 25772355, 25781561, 25800043, 25819484, 25836297, 25854272, 25865533, 25884806, 25903018, 25920141, 25940221, 25957500, 25975685, 25992641, 26011385, 26023922, 26033599, 26052470, 26071591, 26089878, 26107152, 26128041, 26147882, 26165590, 26183167, 26200104, 26219710, 26238368, 26257548, 26275373, 26286875, 26305580, 26323515, 26341816, 26359800, 26380116, 26397659, 26415635, 26436090, 26455559, 26475312, 26486401, 26504415, 26525023, 26545787, 26564072, 26581666, 26600233, 26614270, 26623857, 26641220, 26661662, 26677737, 26696829, 26711463, 26729541, 26747801, 26768651, 26786566, 26806997, 26824890, 26842951, 26861559, 26880118, 26900262, 26910027, 26929066, 26948182, 26966124, 26984575, 27002174, 27022848, 27032813, 27044737, 27064416, 27081581, 27100487, 27118366, 27129297, 27147273, 27165005, 27182483, 27192365, 27211869, 27229845, 27248759, 27266803, 27280668, 27289440, 27307557, 27327063, 27345301, 27364631, 27383766, 27403888, 27424787, 27435090, 27453809, 27472601, 27485883, 27504534, 27522599]
vlm_bench/run_infer_gemini_file_api.py ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ import argparse
3
+ import json
4
+ import os
5
+ import subprocess
6
+ import tempfile
7
+ import time
8
+ from pathlib import Path
9
+ from typing import Any, Dict, List, Optional, Tuple
10
+
11
+ import google.generativeai as genai
12
+
13
+
14
+ def parse_args() -> argparse.Namespace:
15
+ parser = argparse.ArgumentParser(
16
+ description="Run Gemini File API inference for 4 video segments per record."
17
+ )
18
+ parser.add_argument(
19
+ "--input-jsonl",
20
+ default="jsonl/val_no_overlap.jsonl",
21
+ help="Input JSONL path.",
22
+ )
23
+ parser.add_argument(
24
+ "--output-jsonl",
25
+ default="jsonl/val_no_overlap_gemini_results.jsonl",
26
+ help="Output JSONL path.",
27
+ )
28
+ parser.add_argument(
29
+ "--video-root",
30
+ default=".",
31
+ help="Root directory containing source video files.",
32
+ )
33
+ parser.add_argument(
34
+ "--model",
35
+ default="gemini-2.5-flash",
36
+ help="Gemini model name.",
37
+ )
38
+ parser.add_argument(
39
+ "--api-key-env",
40
+ default="GEMINI_API_KEY",
41
+ help="Environment variable for Gemini API key.",
42
+ )
43
+ parser.add_argument(
44
+ "--overwrite",
45
+ action="store_true",
46
+ help="Overwrite output file if exists.",
47
+ )
48
+ return parser.parse_args()
49
+
50
+
51
+ def load_jsonl(path: Path) -> List[Any]:
52
+ records: List[Any] = []
53
+ with path.open("r", encoding="utf-8") as f:
54
+ for line in f:
55
+ records.append(json.loads(line))
56
+ return records
57
+
58
+
59
+ def extract_user_video_and_text(record: Any) -> Tuple[str, float, str]:
60
+ if not isinstance(record, list):
61
+ raise ValueError("Record is not a list")
62
+ user_msg = None
63
+ for item in record:
64
+ if isinstance(item, dict) and item.get("role") == "user":
65
+ user_msg = item
66
+ break
67
+ if user_msg is None:
68
+ raise ValueError("No user message found")
69
+ content = user_msg.get("content")
70
+ if not isinstance(content, list):
71
+ raise ValueError("user.content is not a list")
72
+
73
+ video_name: Optional[str] = None
74
+ video_start: Optional[float] = None
75
+ text_prompt: Optional[str] = None
76
+ for c in content:
77
+ if not isinstance(c, dict):
78
+ continue
79
+ if c.get("type") == "video":
80
+ video_name = c.get("video")
81
+ video_start = float(c.get("video_start"))
82
+ elif c.get("type") == "text":
83
+ text_prompt = c.get("text")
84
+
85
+ if not video_name or video_start is None or not text_prompt:
86
+ raise ValueError("Missing video/video_start/text fields")
87
+ return video_name, video_start, text_prompt
88
+
89
+
90
+ def build_segment_ends(video_start: float) -> List[float]:
91
+ return [video_start + 3.0, video_start + 6.0, video_start + 9.0, video_start + 12.0]
92
+
93
+
94
+ def cut_video_prefix(src: Path, end_sec: float, out_path: Path) -> None:
95
+ cmd = [
96
+ "ffmpeg",
97
+ "-y",
98
+ "-i",
99
+ str(src),
100
+ "-ss",
101
+ "0",
102
+ "-to",
103
+ str(end_sec),
104
+ "-c:v",
105
+ "libx264",
106
+ "-c:a",
107
+ "aac",
108
+ str(out_path),
109
+ ]
110
+ subprocess.run(cmd, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
111
+
112
+
113
+ def wait_until_processed(file_obj: Any, timeout_s: int = 300) -> Any:
114
+ start = time.time()
115
+ name = file_obj.name
116
+ while True:
117
+ refreshed = genai.get_file(name=name)
118
+ state = getattr(refreshed, "state", None)
119
+ state_name = getattr(state, "name", None)
120
+ if state_name == "ACTIVE":
121
+ return refreshed
122
+ if state_name == "FAILED":
123
+ raise RuntimeError(f"Gemini file processing failed: {name}")
124
+ if time.time() - start > timeout_s:
125
+ raise TimeoutError(f"Timeout waiting Gemini file processing: {name}")
126
+ time.sleep(2)
127
+
128
+
129
+ def run_one_segment(model_name: str, text_prompt: str, clip_path: Path) -> str:
130
+ model = genai.GenerativeModel(model_name)
131
+ chat = model.start_chat(history=[])
132
+ chat.send_message(text_prompt)
133
+
134
+ uploaded = genai.upload_file(path=str(clip_path))
135
+ uploaded = wait_until_processed(uploaded)
136
+ try:
137
+ resp = chat.send_message(uploaded)
138
+ return (resp.text or "").strip()
139
+ finally:
140
+ try:
141
+ genai.delete_file(name=uploaded.name)
142
+ except Exception:
143
+ pass
144
+
145
+
146
+ def main() -> None:
147
+ args = parse_args()
148
+ input_path = Path(args.input_jsonl).resolve()
149
+ output_path = Path(args.output_jsonl).resolve()
150
+ video_root = Path(args.video_root).resolve()
151
+
152
+ if output_path.exists() and not args.overwrite:
153
+ raise FileExistsError(f"Output exists: {output_path}. Use --overwrite.")
154
+
155
+ api_key = os.environ.get(args.api_key_env)
156
+ if not api_key:
157
+ raise EnvironmentError(f"Missing API key env: {args.api_key_env}")
158
+ genai.configure(api_key=api_key)
159
+
160
+ records = load_jsonl(input_path)
161
+
162
+ output_path.parent.mkdir(parents=True, exist_ok=True)
163
+ with tempfile.TemporaryDirectory(prefix="gemini_clips_") as tmp_dir:
164
+ tmp_dir_path = Path(tmp_dir)
165
+ with output_path.open("w", encoding="utf-8") as fw:
166
+ for idx, record in enumerate(records, start=1):
167
+ item_out: Dict[str, Any] = {
168
+ "record_index": idx,
169
+ "source_file": str(input_path),
170
+ "segments": [],
171
+ }
172
+ try:
173
+ video_name, video_start, text_prompt = extract_user_video_and_text(record)
174
+ src_video = video_root / video_name
175
+ if not src_video.exists():
176
+ raise FileNotFoundError(f"Source video missing: {src_video}")
177
+
178
+ segment_ends = build_segment_ends(video_start)
179
+ item_out["video"] = video_name
180
+ item_out["video_start"] = video_start
181
+
182
+ for seg_i, end_sec in enumerate(segment_ends, start=1):
183
+ clip_path = tmp_dir_path / f"r{idx}_s{seg_i}.mp4"
184
+ cut_video_prefix(src_video, end_sec, clip_path)
185
+ model_out = run_one_segment(args.model, text_prompt, clip_path)
186
+ item_out["segments"].append(
187
+ {
188
+ "segment_id": seg_i,
189
+ "end_sec": end_sec,
190
+ "model_output": model_out,
191
+ }
192
+ )
193
+ if clip_path.exists():
194
+ clip_path.unlink()
195
+ item_out["status"] = "ok"
196
+ except Exception as e:
197
+ item_out["status"] = "error"
198
+ item_out["error"] = str(e)
199
+
200
+ fw.write(json.dumps(item_out, ensure_ascii=False) + "\n")
201
+ fw.flush()
202
+ print(f"[{idx}/{len(records)}] {item_out.get('status')}")
203
+
204
+
205
+ if __name__ == "__main__":
206
+ main()
vlm_bench/run_infer_gemini_file_api.sh ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ export GEMINI_API_KEY=
2
+ python3 run_infer_gemini_file_api.py \
3
+ --input-jsonl jsonl/val_no_overlap.jsonl \
4
+ --output-jsonl jsonl/val_no_overlap_gemini_results.jsonl \
5
+ --video-root /mnt/data3/uav/vln_data/videos_8fps_prolonged \
6
+ --model gemini-3-flash \
7
+ --overwrite
vlm_bench/run_infer_openai_responses.py ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ import argparse
3
+ import json
4
+ import os
5
+ import subprocess
6
+ import tempfile
7
+ from pathlib import Path
8
+ from typing import Any, Dict, List, Optional, Tuple
9
+
10
+ from openai import OpenAI
11
+
12
+
13
+ def parse_args() -> argparse.Namespace:
14
+ parser = argparse.ArgumentParser(
15
+ description="Run OpenAI inference for 4 video segments per record."
16
+ )
17
+ parser.add_argument(
18
+ "--input-jsonl",
19
+ default="jsonl/val_no_overlap.jsonl",
20
+ help="Input JSONL path.",
21
+ )
22
+ parser.add_argument(
23
+ "--output-jsonl",
24
+ default="jsonl/val_no_overlap_openai_results.jsonl",
25
+ help="Output JSONL path.",
26
+ )
27
+ parser.add_argument(
28
+ "--video-root",
29
+ default=".",
30
+ help="Root directory containing source video files.",
31
+ )
32
+ parser.add_argument(
33
+ "--model",
34
+ default="gpt-4.1-mini",
35
+ help="OpenAI model name.",
36
+ )
37
+ parser.add_argument(
38
+ "--api-key-env",
39
+ default="OPENAI_API_KEY",
40
+ help="Environment variable for OpenAI API key.",
41
+ )
42
+ parser.add_argument(
43
+ "--base-url",
44
+ default=None,
45
+ help="Optional OpenAI-compatible base URL, e.g. http://host:port/v1",
46
+ )
47
+ parser.add_argument(
48
+ "--overwrite",
49
+ action="store_true",
50
+ help="Overwrite output file if exists.",
51
+ )
52
+ return parser.parse_args()
53
+
54
+
55
+ def load_jsonl(path: Path) -> List[Any]:
56
+ records: List[Any] = []
57
+ with path.open("r", encoding="utf-8") as f:
58
+ for line in f:
59
+ records.append(json.loads(line))
60
+ return records
61
+
62
+
63
+ def extract_user_video_and_text(record: Any) -> Tuple[str, float, str]:
64
+ if not isinstance(record, list):
65
+ raise ValueError("Record is not a list")
66
+ user_msg = None
67
+ for item in record:
68
+ if isinstance(item, dict) and item.get("role") == "user":
69
+ user_msg = item
70
+ break
71
+ if user_msg is None:
72
+ raise ValueError("No user message found")
73
+ content = user_msg.get("content")
74
+ if not isinstance(content, list):
75
+ raise ValueError("user.content is not a list")
76
+
77
+ video_name: Optional[str] = None
78
+ video_start: Optional[float] = None
79
+ text_prompt: Optional[str] = None
80
+ for c in content:
81
+ if not isinstance(c, dict):
82
+ continue
83
+ if c.get("type") == "video":
84
+ video_name = c.get("video")
85
+ video_start = float(c.get("video_start"))
86
+ elif c.get("type") == "text":
87
+ text_prompt = c.get("text")
88
+
89
+ if not video_name or video_start is None or not text_prompt:
90
+ raise ValueError("Missing video/video_start/text fields")
91
+ return video_name, video_start, text_prompt
92
+
93
+
94
+ def build_segment_ends(video_start: float) -> List[float]:
95
+ return [video_start + 3.0, video_start + 6.0, video_start + 9.0, video_start + 12.0]
96
+
97
+
98
+ def cut_video_prefix(src: Path, end_sec: float, out_path: Path) -> None:
99
+ cmd = [
100
+ "ffmpeg",
101
+ "-y",
102
+ "-i",
103
+ str(src),
104
+ "-ss",
105
+ "0",
106
+ "-to",
107
+ str(end_sec),
108
+ "-c:v",
109
+ "libx264",
110
+ "-c:a",
111
+ "aac",
112
+ str(out_path),
113
+ ]
114
+ subprocess.run(cmd, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
115
+
116
+
117
+ def run_one_segment(client: OpenAI, model_name: str, text_prompt: str, clip_path: Path) -> str:
118
+ text_response = client.responses.create(
119
+ model=model_name,
120
+ input=[
121
+ {
122
+ "role": "user",
123
+ "content": [{"type": "input_text", "text": text_prompt}],
124
+ }
125
+ ],
126
+ )
127
+
128
+ with clip_path.open("rb") as fb:
129
+ uploaded = client.files.create(file=fb, purpose="user_data")
130
+
131
+ try:
132
+ video_response = client.responses.create(
133
+ model=model_name,
134
+ previous_response_id=text_response.id,
135
+ input=[
136
+ {
137
+ "role": "user",
138
+ "content": [{"type": "input_file", "file_id": uploaded.id}],
139
+ }
140
+ ],
141
+ )
142
+ return (video_response.output_text or "").strip()
143
+ finally:
144
+ try:
145
+ client.files.delete(uploaded.id)
146
+ except Exception:
147
+ pass
148
+
149
+
150
+ def main() -> None:
151
+ args = parse_args()
152
+ input_path = Path(args.input_jsonl).resolve()
153
+ output_path = Path(args.output_jsonl).resolve()
154
+ video_root = Path(args.video_root).resolve()
155
+
156
+ if output_path.exists() and not args.overwrite:
157
+ raise FileExistsError(f"Output exists: {output_path}. Use --overwrite.")
158
+
159
+ api_key = os.environ.get(args.api_key_env)
160
+ if not api_key:
161
+ raise EnvironmentError(f"Missing API key env: {args.api_key_env}")
162
+ client_kwargs: Dict[str, Any] = {"api_key": api_key}
163
+ if args.base_url:
164
+ client_kwargs["base_url"] = args.base_url
165
+ client = OpenAI(**client_kwargs)
166
+
167
+ records = load_jsonl(input_path)
168
+
169
+ output_path.parent.mkdir(parents=True, exist_ok=True)
170
+ with tempfile.TemporaryDirectory(prefix="openai_clips_") as tmp_dir:
171
+ tmp_dir_path = Path(tmp_dir)
172
+ with output_path.open("w", encoding="utf-8") as fw:
173
+ for idx, record in enumerate(records, start=1):
174
+ item_out: Dict[str, Any] = {
175
+ "record_index": idx,
176
+ "source_file": str(input_path),
177
+ "segments": [],
178
+ }
179
+ try:
180
+ video_name, video_start, text_prompt = extract_user_video_and_text(record)
181
+ src_video = video_root / video_name
182
+ if not src_video.exists():
183
+ raise FileNotFoundError(f"Source video missing: {src_video}")
184
+
185
+ segment_ends = build_segment_ends(video_start)
186
+ item_out["video"] = video_name
187
+ item_out["video_start"] = video_start
188
+
189
+ for seg_i, end_sec in enumerate(segment_ends, start=1):
190
+ clip_path = tmp_dir_path / f"r{idx}_s{seg_i}.mp4"
191
+ cut_video_prefix(src_video, end_sec, clip_path)
192
+ model_out = run_one_segment(client, args.model, text_prompt, clip_path)
193
+ item_out["segments"].append(
194
+ {
195
+ "segment_id": seg_i,
196
+ "end_sec": end_sec,
197
+ "model_output": model_out,
198
+ }
199
+ )
200
+ if clip_path.exists():
201
+ clip_path.unlink()
202
+ item_out["status"] = "ok"
203
+ except Exception as e:
204
+ item_out["status"] = "error"
205
+ item_out["error"] = str(e)
206
+
207
+ fw.write(json.dumps(item_out, ensure_ascii=False) + "\n")
208
+ fw.flush()
209
+ print(f"[{idx}/{len(records)}] {item_out.get('status')}")
210
+
211
+
212
+ if __name__ == "__main__":
213
+ main()
vlm_bench/run_infer_openai_responses.sh ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ python3 run_infer_openai_responses.py \
2
+ --base-url https://api-vip.codex-for.me/v1 \
3
+ --input-jsonl jsonl/val_no_overlap.jsonl \
4
+ --output-jsonl jsonl/val_no_overlap_openai_results.jsonl \
5
+ --video-root /mnt/data3/uav/vln_data/videos_8fps_prolonged \
6
+ --overwrite
vlm_bench/test_sample/.codex ADDED
File without changes
vlm_bench/test_sample/2026-02-09_09-37-20_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_10-03-48_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_10-09-29_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_10-16-43_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_10-19-05_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_10-24-08_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_10-36-17_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_11-03-39_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_11-05-37_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_11-33-29_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_11-49-01_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_11-53-51_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_11-54-21_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_11-59-05_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_13-59-44_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_14-02-27_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_14-08-03_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_14-22-04_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_15-33-02_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_15-50-44_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_15-51-30_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_16-01-22_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_16-03-23_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_16-12-18_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_16-15-33_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_16-46-23_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_16-55-54_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_17-21-43_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-09_19-09-07_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-10_09-28-51_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-10_09-37-43_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-10_09-41-50_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-10_09-58-58_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-10_10-18-36_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-10_10-18-57_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-10_10-32-37_streaming.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm_bench/test_sample/2026-02-10_10-47-30_streaming.json ADDED
The diff for this file is too large to render. See raw diff