File size: 2,516 Bytes
6d12932
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
"""

Secure Model Upload to Hugging Face

This script will upload your nursing model using your HF token

"""

import os
from huggingface_hub import HfApi, login

# =============================================================================
# IMPORTANT: Set your token as an environment variable for security
# =============================================================================
# In PowerShell, run: $env:HF_TOKEN = "your_actual_token_here"
# Or paste it when prompted below

HF_TOKEN = os.getenv("HF_TOKEN") or input("Paste your HF token: ")

# Login
print("πŸ” Logging in to Hugging Face...")
login(token=HF_TOKEN)

# =============================================================================
# WHERE IS YOUR MODEL?
# =============================================================================
print("\nπŸ“ Where is your trained model saved?")
print("1. Google Colab (/content/...)")
print("2. Google Drive (mounted in Colab)")
print("3. Local computer")
print("4. I don't have the model files")

choice = input("\nEnter choice (1-4): ")

if choice == "4":
    print("\n⚠️  You need to locate or re-train the model first.")
    print("Check your Colab notebooks or Google Drive for:")
    print("  - nursing-llama-3-8b-fons/")
    print("  - Any folder with model.safetensors or pytorch_model.bin")
    exit()

model_path = input("\nEnter the full path to your model folder: ")

# Verify files exist
if not os.path.exists(model_path):
    print(f"❌ Path not found: {model_path}")
    exit()

# =============================================================================
# UPLOAD
# =============================================================================
print(f"\nπŸš€ Uploading from: {model_path}")
print(f"πŸ“€ Destination: NurseCitizenDeveloper/nursing-llama-3-8b-fons")

api = HfApi()

try:
    api.upload_folder(
        folder_path=model_path,
        repo_id="NurseCitizenDeveloper/nursing-llama-3-8b-fons",
        repo_type="model",
        token=HF_TOKEN
    )
    print("\nβœ… Upload successful!")
    print("πŸ”— https://huggingface.co/NurseCitizenDeveloper/nursing-llama-3-8b-fons")
except Exception as e:
    print(f"\n❌ Upload failed: {e}")
    print("\nπŸ’‘ If you see 'permission denied', you need a WRITE token:")
    print("   1. Go to https://huggingface.co/settings/tokens")
    print("   2. Create a new token with 'Write' access")
    print("   3. Run this script again with the new token")