File size: 659 Bytes
b135d1d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
from huggingface_hub import HfApi
import os
# 创建HfApi实例
api = HfApi()
# 定义数据集路径和目标URL
dataset_dir = "/home/yiyangai/stephenqs/datasets/VIST"
repo_url = "StarThomas1002/my-VIST-dataset"
# 遍历临时目录中的文件并分批上传
for root, dirs, files in os.walk(dataset_dir):
for file_name in files:
file_path = os.path.join(root, file_name)
relative_path = os.path.relpath(file_path, dataset_dir)
# 分块上传文件
api.upload_file(
path_or_fileobj=file_path,
path_in_repo=relative_path,
repo_id=repo_url,
repo_type="dataset"
)
|