kiyoonkim commited on
Commit
77d904f
·
1 Parent(s): 3d400bf

Upload hfhub.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. hfhub.py +2 -6
hfhub.py CHANGED
@@ -17,18 +17,14 @@ token = os.environ["HF_TOKEN"]
17
  (Path(repo_dir) / "checkpoints").mkdir(parents=True, exist_ok=True)
18
 
19
  hf_api = HfApi(token=token)
 
20
  repo_url = hf_api.create_repo(
21
  repo_id=repo_name, repo_type="model", exist_ok=True, private=True
22
  )
23
- print(repo_url)
24
- repo_path = "/".join(repo_url.split("/")[-2:])
25
- print(repo_path)
26
 
27
  hf_api.upload_file(
28
- repo_id=repo_path,
29
  repo_type="model",
30
  path_or_fileobj="hfhub.py",
31
  path_in_repo="hfhub.py",
32
  )
33
-
34
- print(hf_api.get_full_repo_name(repo_name))
 
17
  (Path(repo_dir) / "checkpoints").mkdir(parents=True, exist_ok=True)
18
 
19
  hf_api = HfApi(token=token)
20
+ repo_name = hf_api.get_full_repo_name(repo_name)
21
  repo_url = hf_api.create_repo(
22
  repo_id=repo_name, repo_type="model", exist_ok=True, private=True
23
  )
 
 
 
24
 
25
  hf_api.upload_file(
26
+ repo_id=repo_name,
27
  repo_type="model",
28
  path_or_fileobj="hfhub.py",
29
  path_in_repo="hfhub.py",
30
  )