24W_GLM_pretrained / upload.py
Syzseisus's picture
Upload upload.py with huggingface_hub
d2311b4 verified
Raw
History Blame Contribute Delete
946 Bytes
import os
from tqdm import tqdm
from huggingface_hub import upload_file
# --- ์„ค์ • ---
repo_id = "Syzseisus/24W_GLM_pretrained"
base_folder = "." # ์—…๋กœ๋“œํ•  ๋กœ์ปฌ ํด๋”
repo_type = "model" # ๋ชจ๋ธ ๋ ˆํฌ์ง€ํ† ๋ฆฌ
# --- ํด๋” ์žฌ๊ท€ ํƒ์ƒ‰ ---
for root, dirs, files in tqdm(os.walk(base_folder), desc="mother"):
for file in tqdm(files, desc="children", leave=False):
local_path = os.path.join(root, file)
# repo ๋‚ด ๊ฒฝ๋กœ: base_folder ์ดํ›„ ๊ฒฝ๋กœ๋งŒ ์‚ฌ์šฉ
repo_path = os.path.relpath(local_path, base_folder)
print(f"Uploading {local_path} -> {repo_path} ...")
try:
upload_file(
path_or_fileobj=local_path,
path_in_repo=repo_path,
repo_id=repo_id,
repo_type=repo_type
)
print("โœ… Done")
except Exception as e:
print(f"โŒ Failed: {e}")