| from huggingface_hub import HfApi | |
| # Your repository name on Hugging Face | |
| repo_id = "cranky-coder08/Phi2-Fine-Tuning" | |
| # The local folder to upload (the current directory, represented by ".") | |
| local_folder_path = "." | |
| # Your Hugging Face access token with "write" permissions | |
| # Replace with your actual token or leave it blank if you are already logged in | |
| # token = "hf_..." | |
| # Initialize the Hugging Face API client | |
| api = HfApi() | |
| # Upload the entire folder | |
| print(f"Uploading folder '{local_folder_path}' to '{repo_id}'...") | |
| api.upload_large_folder( | |
| folder_path=local_folder_path, | |
| repo_id=repo_id, | |
| repo_type="model", | |
| # Optional: Set a commit message | |
| #commit_message="Initial upload of fine-tuned Phi2 model." | |
| ) | |
| print("Upload complete!") |