File size: 1,026 Bytes
0160d0b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from huggingface_hub import HfApi
import os
from tqdm import tqdm

TOKEN = os.environ.get("HF_TOKEN", "")
api = HfApi(token=TOKEN)

source = r"D:\desktop\paper\abs\rl_data\ocr_vqa_clean_dataset\train"
repo_id = "zzhowe1207/tet-rl"

api.create_repo(repo_id=repo_id, repo_type="dataset", exist_ok=True)

# 收集 arrow 文件
all_files = []
for root, dirs, files in os.walk(source):
    for file in files:
        if file.endswith('.arrow'):
            fpath = os.path.join(root, file)
            arcname = os.path.join("ocr_vqa_clean_dataset", "train", os.path.relpath(fpath, source)).replace("\\", "/")
            all_files.append((fpath, arcname))

print(f"共 {len(all_files)} 个 arrow 文件")

# 逐个上传
for fpath, arcname in tqdm(all_files, desc="上传", unit="file"):
    api.upload_file(
        path_or_fileobj=fpath,
        path_in_repo=arcname,
        repo_id=repo_id,
        repo_type="dataset"
    )

print(f"搞定!访问: https://huggingface.co/datasets/{repo_id}")