Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,9 +3,7 @@ import tempfile
|
|
| 3 |
import subprocess
|
| 4 |
from huggingface_hub import login, HfApi
|
| 5 |
|
| 6 |
-
# === НАСТРОЙКИ ===
|
| 7 |
REPO_NAME = "Andrewstivan/AURA"
|
| 8 |
-
HF_TOKEN = os.getenv("HF_TOKEN")
|
| 9 |
|
| 10 |
YAML_CONFIG = """slices:
|
| 11 |
- sources:
|
|
@@ -25,13 +23,8 @@ parameters:
|
|
| 25 |
dtype: bfloat16
|
| 26 |
tokenizer_source: union
|
| 27 |
"""
|
| 28 |
-
# ===================
|
| 29 |
|
| 30 |
-
|
| 31 |
-
raise Exception("❌ HF_TOKEN not found. Add it in Settings → Variables and secrets")
|
| 32 |
-
|
| 33 |
-
print("🔄 Starting merge...")
|
| 34 |
-
login(token=HF_TOKEN)
|
| 35 |
|
| 36 |
with tempfile.TemporaryDirectory() as tmpdir:
|
| 37 |
config_path = f"{tmpdir}/config.yaml"
|
|
@@ -50,10 +43,10 @@ with tempfile.TemporaryDirectory() as tmpdir:
|
|
| 50 |
process.wait()
|
| 51 |
|
| 52 |
if process.returncode == 0:
|
| 53 |
-
print("
|
| 54 |
api = HfApi()
|
| 55 |
api.create_repo(REPO_NAME, exist_ok=True)
|
| 56 |
api.upload_folder(folder_path=merged_path, repo_id=REPO_NAME, repo_type="model")
|
| 57 |
-
print(f"
|
| 58 |
else:
|
| 59 |
-
print(f"
|
|
|
|
| 3 |
import subprocess
|
| 4 |
from huggingface_hub import login, HfApi
|
| 5 |
|
|
|
|
| 6 |
REPO_NAME = "Andrewstivan/AURA"
|
|
|
|
| 7 |
|
| 8 |
YAML_CONFIG = """slices:
|
| 9 |
- sources:
|
|
|
|
| 23 |
dtype: bfloat16
|
| 24 |
tokenizer_source: union
|
| 25 |
"""
|
|
|
|
| 26 |
|
| 27 |
+
print("Starting merge...")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
with tempfile.TemporaryDirectory() as tmpdir:
|
| 30 |
config_path = f"{tmpdir}/config.yaml"
|
|
|
|
| 43 |
process.wait()
|
| 44 |
|
| 45 |
if process.returncode == 0:
|
| 46 |
+
print("Merge complete! Uploading...")
|
| 47 |
api = HfApi()
|
| 48 |
api.create_repo(REPO_NAME, exist_ok=True)
|
| 49 |
api.upload_folder(folder_path=merged_path, repo_id=REPO_NAME, repo_type="model")
|
| 50 |
+
print(f"Done! https://huggingface.co/{REPO_NAME}")
|
| 51 |
else:
|
| 52 |
+
print(f"Error: {process.returncode}")
|