#!/usr/bin/env python3 """ Upload PyTorch wheel collection to HuggingFace Usage: HF_TOKEN=your_token python upload_to_hf.py """ import os from huggingface_hub import HfApi def upload_to_huggingface(): # Get token from environment variable token = os.getenv("HF_TOKEN") if not token: print("āŒ Error: HF_TOKEN environment variable not set") print("Usage: HF_TOKEN=your_token python upload_to_hf.py") return False # Set up API with token api = HfApi(token=token) # Repository details repo_id = "RDHub/pytorch_python_310" folder_path = "/media/acleda/DATA/code/ai-engineer/khmer-nlp/pytorch_python_310" print(f"Uploading folder: {folder_path}") print(f"To repository: {repo_id}") print("This may take a while due to large file sizes...") try: # Upload the entire folder api.upload_folder( folder_path=folder_path, repo_id=repo_id, repo_type="model", ) print("āœ… Upload completed successfully!") print(f"Repository available at: https://huggingface.co/{repo_id}") except Exception as e: print(f"āŒ Upload failed: {e}") return False return True if __name__ == "__main__": success = upload_to_huggingface() if success: print("\nšŸŽ‰ PyTorch wheel collection is now available on HuggingFace!") print("Users can now install with:") print("git clone https://huggingface.co/RDHub/pytorch_python_310") print("cd pytorch_python_310 && pip install lib_wheel/*.whl") else: print("\nāŒ Upload failed. Please check the error messages above.")