Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -100,37 +100,12 @@ def start_llama_server():
|
|
| 100 |
|
| 101 |
binary_path = build_latest_llama_server()
|
| 102 |
|
| 103 |
-
from huggingface_hub import hf_hub_download
|
| 104 |
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
# Discover the real filenames instead of guessing them.
|
| 109 |
-
all_files = list_repo_files(repo_id)
|
| 110 |
-
|
| 111 |
-
model_files = sorted(
|
| 112 |
-
f for f in all_files
|
| 113 |
-
if f.endswith(".gguf") and quant in f and "mmproj" not in f.lower()
|
| 114 |
-
)
|
| 115 |
-
if not model_files:
|
| 116 |
-
raise RuntimeError(
|
| 117 |
-
f"No .gguf files matching '{quant}' found in {repo_id}. "
|
| 118 |
-
f"Available files: {all_files}"
|
| 119 |
-
)
|
| 120 |
-
print(f"Downloading {len(model_files)} model file(s): {model_files}")
|
| 121 |
-
|
| 122 |
-
# Download every shard; llama.cpp loads the rest automatically when
|
| 123 |
-
# pointed at the first one (…-00001-of-0000N.gguf).
|
| 124 |
-
local_paths = [hf_hub_download(repo_id=repo_id, filename=f) for f in model_files]
|
| 125 |
-
model_path = local_paths[0]
|
| 126 |
-
|
| 127 |
-
# Vision projector (optional): prefer BF16, then F16, then anything.
|
| 128 |
-
mmproj_files = [f for f in all_files if "mmproj" in f.lower() and f.endswith(".gguf")]
|
| 129 |
-
mmproj_file = next(
|
| 130 |
-
(f for tag in ("BF16", "F16") for f in mmproj_files if tag in f.upper()),
|
| 131 |
-
mmproj_files[0] if mmproj_files else None,
|
| 132 |
)
|
| 133 |
-
mmproj_path = hf_hub_download(repo_id=repo_id, filename=mmproj_file) if mmproj_file else None
|
| 134 |
|
| 135 |
binary_dir = os.path.dirname(os.path.abspath(binary_path))
|
| 136 |
env = os.environ.copy()
|
|
@@ -139,7 +114,6 @@ def start_llama_server():
|
|
| 139 |
cmd = [
|
| 140 |
binary_path,
|
| 141 |
"-m", model_path,
|
| 142 |
-
*(["-mm", mmproj_path] if mmproj_path else []),
|
| 143 |
"--port", "8000",
|
| 144 |
"--host", "127.0.0.1",
|
| 145 |
"-t", "16",
|
|
|
|
| 100 |
|
| 101 |
binary_path = build_latest_llama_server()
|
| 102 |
|
| 103 |
+
from huggingface_hub import hf_hub_download
|
| 104 |
|
| 105 |
+
model_path = hf_hub_download(
|
| 106 |
+
repo_id="bartowski/moonshotai_Kimi-Linear-48B-A3B-Instruct-GGUF",
|
| 107 |
+
filename="moonshotai_Kimi-Linear-48B-A3B-Instruct-Q4_K_M.gguf",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
)
|
|
|
|
| 109 |
|
| 110 |
binary_dir = os.path.dirname(os.path.abspath(binary_path))
|
| 111 |
env = os.environ.copy()
|
|
|
|
| 114 |
cmd = [
|
| 115 |
binary_path,
|
| 116 |
"-m", model_path,
|
|
|
|
| 117 |
"--port", "8000",
|
| 118 |
"--host", "127.0.0.1",
|
| 119 |
"-t", "16",
|