Spaces:
Runtime error
Runtime error
Jay Glidden commited on
Upload mirror.py with huggingface_hub
Browse files
mirror.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
from huggingface_hub import hf_hub_download, upload_file, login
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
# HF Spaces have HF_TOKEN set automatically
|
| 6 |
+
token = os.environ.get("HF_TOKEN", "")
|
| 7 |
+
print("Downloading Z-Image-Turbo Q2_K from unsloth (fast - we're on HF infra)...")
|
| 8 |
+
path = hf_hub_download(
|
| 9 |
+
"unsloth/Z-Image-Turbo-GGUF",
|
| 10 |
+
"z-image-turbo-Q2_K.gguf",
|
| 11 |
+
token=token,
|
| 12 |
+
)
|
| 13 |
+
print(f"Downloaded: {os.path.getsize(path)} bytes")
|
| 14 |
+
|
| 15 |
+
print("Uploading to wannabecomputerscientist/zimage-mirror...")
|
| 16 |
+
upload_file(
|
| 17 |
+
path_or_fileobj=path,
|
| 18 |
+
path_in_repo="z-image-turbo-Q2_K.gguf",
|
| 19 |
+
repo_id="wannabecomputerscientist/zimage-mirror",
|
| 20 |
+
repo_type="model",
|
| 21 |
+
token=token,
|
| 22 |
+
)
|
| 23 |
+
print("Done!")
|