Datasets:
File size: 1,735 Bytes
82cd523 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | #!/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)
|