Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,10 +32,13 @@ def build_latest_llama_server():
|
|
| 32 |
print("Building latest llama.cpp from master source...")
|
| 33 |
|
| 34 |
if not os.path.exists("llama.cpp"):
|
| 35 |
-
subprocess.run(["git", "clone", "https://github.com/
|
| 36 |
else:
|
| 37 |
subprocess.run(["git", "pull"], cwd="llama.cpp", check=True)
|
| 38 |
|
|
|
|
|
|
|
|
|
|
| 39 |
env = os.environ.copy()
|
| 40 |
if "/usr/local/cuda/bin" not in env.get("PATH", ""):
|
| 41 |
env["PATH"] = f"/usr/local/cuda/bin:{env.get('PATH', '')}"
|
|
@@ -74,31 +77,30 @@ def start_llama_server():
|
|
| 74 |
|
| 75 |
from huggingface_hub import hf_hub_download
|
| 76 |
|
| 77 |
-
model_path = hf_hub_download(
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
)
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
filename="UD-Q4_K_XL/Qwen3.8-Flash-Next-UD-Q4_K_XL-00004-of-00004.gguf",
|
| 94 |
)
|
| 95 |
-
|
| 96 |
|
| 97 |
#draft_path = hf_hub_download(
|
| 98 |
# repo_id="unsloth/Qwen3.8-Flash-Next-GGUF",
|
| 99 |
-
# filename="MTP/mtp-Qwen3.8-Flash-Next-
|
| 100 |
#)
|
| 101 |
|
|
|
|
| 102 |
binary_dir = os.path.dirname(os.path.abspath(binary_path))
|
| 103 |
env = os.environ.copy()
|
| 104 |
env["LD_LIBRARY_PATH"] = f"{binary_dir}:{env.get('LD_LIBRARY_PATH', '')}"
|
|
@@ -106,15 +108,15 @@ def start_llama_server():
|
|
| 106 |
cmd = [
|
| 107 |
binary_path,
|
| 108 |
"-m", model_path,
|
|
|
|
|
|
|
| 109 |
"--port", "8000",
|
| 110 |
"--host", "127.0.0.1",
|
| 111 |
"-t", "16",
|
| 112 |
"-tb", "16",
|
| 113 |
"-fa", "on",
|
| 114 |
"--parallel", "1",
|
| 115 |
-
"--load-mode", "
|
| 116 |
-
#"--spec-type", "draft-mtp",
|
| 117 |
-
#"--spec-draft-n-max", "4",
|
| 118 |
"--cache-type-k", "q4_0",
|
| 119 |
"--cache-type-v", "q4_0",
|
| 120 |
"--jinja",
|
|
|
|
| 32 |
print("Building latest llama.cpp from master source...")
|
| 33 |
|
| 34 |
if not os.path.exists("llama.cpp"):
|
| 35 |
+
subprocess.run(["git", "clone", "https://github.com/unslothai/llama.cpp.git"], check=True)
|
| 36 |
else:
|
| 37 |
subprocess.run(["git", "pull"], cwd="llama.cpp", check=True)
|
| 38 |
|
| 39 |
+
subprocess.run(["git", "fetch", "origin", "pull/144/head:mtp"], cwd="llama.cpp", check=True)
|
| 40 |
+
subprocess.run(["git", "checkout", "mtp"], cwd="llama.cpp", check=True)
|
| 41 |
+
|
| 42 |
env = os.environ.copy()
|
| 43 |
if "/usr/local/cuda/bin" not in env.get("PATH", ""):
|
| 44 |
env["PATH"] = f"/usr/local/cuda/bin:{env.get('PATH', '')}"
|
|
|
|
| 77 |
|
| 78 |
from huggingface_hub import hf_hub_download
|
| 79 |
|
| 80 |
+
#model_path = hf_hub_download(
|
| 81 |
+
# repo_id="unsloth/Qwen3.8-Flash-Next-GGUF",
|
| 82 |
+
# filename="UD-Q4_K_XL/Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf",
|
| 83 |
+
#)
|
| 84 |
+
model_path = None
|
| 85 |
+
for i in range(1,34):
|
| 86 |
+
mp = hf_hub_download(
|
| 87 |
+
repo_id="AtomicChat/Qwen3.8-Flash-Next-GGUF",
|
| 88 |
+
filename="Qwen3.8-Flash-Next-AD-4.27bpw-Q4_K_M-M64/Qwen3.8-Flash-Next-AD-4.27bpw-Q4_K_M-M64-{}-of-00033.gguf".format(str(i).zfill(5))
|
| 89 |
+
)
|
| 90 |
+
if not model_path:
|
| 91 |
+
model_path = mp
|
| 92 |
+
|
| 93 |
+
mmproj_path = hf_hub_download(
|
| 94 |
+
repo_id="AtomicChat/Qwen3.8-Flash-Next-GGUF",
|
| 95 |
+
filename="mmproj-Qwen3.8-Flash-Next-F16.gguf",
|
|
|
|
| 96 |
)
|
|
|
|
| 97 |
|
| 98 |
#draft_path = hf_hub_download(
|
| 99 |
# repo_id="unsloth/Qwen3.8-Flash-Next-GGUF",
|
| 100 |
+
# filename="MTP/mtp-Qwen3.8-Flash-Next-Q4_K_M.gguf",
|
| 101 |
#)
|
| 102 |
|
| 103 |
+
|
| 104 |
binary_dir = os.path.dirname(os.path.abspath(binary_path))
|
| 105 |
env = os.environ.copy()
|
| 106 |
env["LD_LIBRARY_PATH"] = f"{binary_dir}:{env.get('LD_LIBRARY_PATH', '')}"
|
|
|
|
| 108 |
cmd = [
|
| 109 |
binary_path,
|
| 110 |
"-m", model_path,
|
| 111 |
+
"-mm", mmproj_path,
|
| 112 |
+
#"-md", draft_path,
|
| 113 |
"--port", "8000",
|
| 114 |
"--host", "127.0.0.1",
|
| 115 |
"-t", "16",
|
| 116 |
"-tb", "16",
|
| 117 |
"-fa", "on",
|
| 118 |
"--parallel", "1",
|
| 119 |
+
"--load-mode", "dio",
|
|
|
|
|
|
|
| 120 |
"--cache-type-k", "q4_0",
|
| 121 |
"--cache-type-v", "q4_0",
|
| 122 |
"--jinja",
|