File size: 1,700 Bytes
68a60e6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/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.")