Enhance LLM runtime and installation script for Linux support
- Added a new function `pick_llamacpp_linux_asset_url` to select appropriate Linux release assets, prioritizing Ubuntu CUDA and Vulkan options while excluding Windows and macOS binaries. - Updated the installation script to build `llama-server` from source when Linux CUDA binaries are unavailable, improving compatibility and flexibility. - Revised documentation to reflect changes in asset handling and installation procedures. - Added tests to validate the new asset selection logic, ensuring correct behavior in various scenarios.
This commit is contained in:
@@ -357,6 +357,42 @@ def llm_remote_port(runtime: str) -> int | None:
|
||||
return None
|
||||
|
||||
|
||||
def pick_llamacpp_linux_asset_url(assets: list[dict[str, Any]]) -> str:
|
||||
"""Choose a Linux llama.cpp release asset URL.
|
||||
|
||||
Upstream ships Windows CUDA zips first; never pick win/macos/cudart-only.
|
||||
Prefer ubuntu+cuda → linux+cuda → ubuntu vulkan x64 → ubuntu x64 CPU.
|
||||
Mirrored in remote/install_llamacpp.sh (pick_linux_asset_url).
|
||||
"""
|
||||
cands: list[tuple[int, str]] = []
|
||||
for a in assets:
|
||||
name = str(a.get("name") or "").lower()
|
||||
url = str(a.get("browser_download_url") or "")
|
||||
if not (url.endswith(".zip") or url.endswith(".tar.gz")):
|
||||
continue
|
||||
if any(x in name for x in ("win", "macos", "android", "darwin", "xcframework", "-ui.")):
|
||||
continue
|
||||
if "cudart" in name:
|
||||
continue
|
||||
score = 0
|
||||
if "ubuntu" in name and "x64" in name and "cuda" in name:
|
||||
score = 100
|
||||
elif "linux" in name and "cuda" in name:
|
||||
score = 90
|
||||
elif "ubuntu" in name and "vulkan" in name and "x64" in name:
|
||||
score = 50
|
||||
elif "ubuntu" in name and "x64" in name and not any(
|
||||
x in name for x in ("sycl", "openvino", "arm", "s390", "rocm")
|
||||
):
|
||||
score = 30
|
||||
elif "ubuntu" in name or "linux" in name:
|
||||
score = 10
|
||||
if score:
|
||||
cands.append((score, url))
|
||||
cands.sort(key=lambda t: t[0], reverse=True)
|
||||
return cands[0][1] if cands else ""
|
||||
|
||||
|
||||
def append_vars_llm_runtime(vars_file: Path, runtime: str) -> None:
|
||||
from gpu_rent.varsfile import upsert_vars
|
||||
|
||||
|
||||
Reference in New Issue
Block a user