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