licyk commited on
Commit
8a00d8e
1 Parent(s): 1ac8b8d

Upload upload_file_to_hf.py

Browse files
Files changed (1) hide show
  1. upload_file_to_hf.py +11 -9
upload_file_to_hf.py CHANGED
@@ -67,15 +67,17 @@ def upload_file_to_hf(hf_access_token: str, repo: str, repo_type: str, upload_fi
67
 
68
  operations.append(CommitOperationAdd(path_in_repo = hf_file_path, path_or_fileobj = local_file_path))
69
 
70
- api.create_commit(
71
- repo_id = repo,
72
- operations = operations,
73
- commit_message = f"upload",
74
- repo_type = repo_type,
75
- token = hf_access_token
76
- )
77
-
78
- logging.warning("上传文件结束")
 
 
79
 
80
 
81
  def get_args():
 
67
 
68
  operations.append(CommitOperationAdd(path_in_repo = hf_file_path, path_or_fileobj = local_file_path))
69
 
70
+ try:
71
+ api.create_commit(
72
+ repo_id = repo,
73
+ operations = operations,
74
+ commit_message = f"upload",
75
+ repo_type = repo_type,
76
+ token = hf_access_token
77
+ )
78
+ logging.warning("上传文件结束")
79
+ except:
80
+ logging.error("上传文件出错")
81
 
82
 
83
  def get_args():