File size: 758 Bytes
4c895ac |
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 |
#from huggingface_hub import HfApi, HfFolder, Repository
#
#dataset_dir = "/home/yiyangai/stephenqs/datasets/wikihow"
#repo_name = "my-wikihow-dataset"
#repo_url = f"https://huggingface.co/datasets/StarThomas1002/{repo_name}"
#
#
#api = HfApi()
#token = HfFolder.get_token()
from huggingface_hub import HfApi
# 设置变量
dataset_dir = '/home/yiyangai/stephenqs/datasets/wikihow'
repo_name = 'my-wikihow-dataset'
username = 'StarThomas1002'
# 初始化 API
api = HfApi()
# 上传文件
api.upload_folder(
folder_path=dataset_dir,
path_in_repo=".",
repo_id=f"{username}/{repo_name}",
repo_type="dataset"
)
repo = Repository(local_dir=dataset_dir, clone_from=repo_url)
repo.push_to_hub()
print(f"数据集已上传到 {repo_url}")
|