File size: 977 Bytes
de15dc5 | 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 37 | from huggingface_hub import HfApi
import os
# 0) ํ๊ฒฝ๋ณ์์ HF_TOKEN์ ๋ฃ์ด๋์ธ์ (์๋ ์ฐธ๊ณ )
HF_TOKEN = os.environ["HF_TOKEN"] # ๊ฐ ์์ผ๋ฉด KeyError๋ก ์ฆ์ ์๋ฆผ
api = HfApi(token=HF_TOKEN)
repo_id = "jaewooo/test" # ๋ณธ์ธ ์ฌ์ฉ์๋ช
/์กฐ์ง๋ช
์ ํํ
repo_type = "model"
from huggingface_hub import HfApi
import os
# api = HfApi(token=os.environ["HF_TOKEN"]) # Write/Admin ๊ถํ ํ ํฐ
# api.delete_repo(repo_id="jaewooo/test", repo_type="model")
# print("โ
deleted")
# 1) ๋ ํฌ ์์ฑ (์ด๋ฏธ ์์ผ๋ฉด ๋ฌด์)
api.create_repo(
repo_id=repo_id,
repo_type=repo_type,
private=True, # ์ํ๋ฉด False
exist_ok=True
)
# 2) ํด๋ ์
๋ก๋
api.upload_folder(
folder_path="/disk/gjw/CLIP4Clip",
repo_id=repo_id,
repo_type=repo_type,
commit_message="Initial upload",
# ํ์์ ์ ์ธ ํจํด
ignore_patterns=["**/.ipynb_checkpoints/**", "**/.git/**", "*.tmp"]
)
print("โ
Upload done!")
|