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!")