StreamingBench / download_missing.py
SitongGong's picture
upload StreamingBench (part 8)
82cd523 verified
Raw History Blame Contribute Delete
1.74 kB
#!/usr/bin/env python3
"""下载StreamingBench缺失的zip并解压"""
import os
import sys
import zipfile
from huggingface_hub import hf_hub_download
os.chdir("/mnt/tokyo-ai/gst/StreamingBench")
REPO = "mjuicem/StreamingBench"
FILES = [
"Anomaly Context Understanding.zip",
"Emotion Recognition.zip",
"Misleading Context Understanding.zip",
"Multimodal Alignment.zip",
"Source Discrimination.zip",
"Proactive Output_1-25.zip",
"Proactive Output_26-50.zip",
"Scene Understanding_1-25.zip",
"Scene Understanding_26-50.zip",
"Sequential Question Answering_1-25.zip",
"Sequential Question Answering_26-50.zip",
]
for f in FILES:
print(f"\n{'='*50}", flush=True)
print(f"下载: {f}", flush=True)
print('='*50, flush=True)
local_path = os.path.join(".", f)
if os.path.exists(local_path):
print("已存在,跳过下载", flush=True)
else:
try:
downloaded = hf_hub_download(
repo_id=REPO,
filename=f,
repo_type="dataset",
local_dir=".",
)
print(f"下载完成: {downloaded}", flush=True)
except Exception as e:
print(f"下载失败: {e}", flush=True)
continue
print(f"解压: {f}", flush=True)
try:
with zipfile.ZipFile(f, 'r') as zf:
zf.extractall(".")
print(f"完成: {f}", flush=True)
except Exception as e:
print(f"解压失败: {e}", flush=True)
print(f"\n{'='*50}", flush=True)
print("全部完成!", flush=True)
# 统计
samples = [d for d in os.listdir(".") if d.startswith("sample_") and os.path.isdir(d)]
print(f"sample总数: {len(samples)}", flush=True)