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