Upload convert_grpo_to_gguf.py with huggingface_hub
Browse files- convert_grpo_to_gguf.py +17 -4
convert_grpo_to_gguf.py
CHANGED
|
@@ -119,12 +119,25 @@ print(f" Q8_0: {size_mb:.1f} MB")
|
|
| 119 |
|
| 120 |
# Step 9: Upload
|
| 121 |
print("\n Step 8: Uploading to Hub...")
|
| 122 |
-
from huggingface_hub import login
|
| 123 |
-
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
if hf_token:
|
| 126 |
-
login(token=hf_token)
|
| 127 |
print(" Logged in successfully")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
api = HfApi()
|
| 129 |
api.create_repo(repo_id=OUTPUT_REPO, repo_type="model", exist_ok=True)
|
| 130 |
print(" Repository ready")
|
|
|
|
| 119 |
|
| 120 |
# Step 9: Upload
|
| 121 |
print("\n Step 8: Uploading to Hub...")
|
| 122 |
+
from huggingface_hub import login, HfFolder
|
| 123 |
+
|
| 124 |
+
# Debug: show all HF-related env vars
|
| 125 |
+
print(" Available HF env vars:")
|
| 126 |
+
for key, val in os.environ.items():
|
| 127 |
+
if 'HF' in key or 'HUGGING' in key or 'TOKEN' in key:
|
| 128 |
+
print(f" {key}: {'[SET]' if val else '[EMPTY]'}")
|
| 129 |
+
|
| 130 |
+
# Try multiple auth methods
|
| 131 |
+
hf_token = os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN") or HfFolder.get_token()
|
| 132 |
+
|
| 133 |
if hf_token:
|
| 134 |
+
login(token=hf_token, add_to_git_credential=False)
|
| 135 |
print(" Logged in successfully")
|
| 136 |
+
else:
|
| 137 |
+
print(" ERROR: No token found!")
|
| 138 |
+
print(" Make sure HF_TOKEN secret is configured at https://huggingface.co/settings/secrets")
|
| 139 |
+
raise RuntimeError("No HF token available for upload")
|
| 140 |
+
|
| 141 |
api = HfApi()
|
| 142 |
api.create_repo(repo_id=OUTPUT_REPO, repo_type="model", exist_ok=True)
|
| 143 |
print(" Repository ready")
|