Enhance LLM configuration and installation scripts for improved flexibility

- Added new environment variables in `env.example` and `gpu-rent.vars.example` for fine-tuning LLM settings, including CUDA build options and model version pinning.
- Updated `llm.md` documentation to include detailed descriptions of new configuration options and usage cases for LLM setups.
- Enhanced the `provision.py` script to forward new environment variables during remote installations, improving the installation process for LLM components.
- Modified the `install_llamacpp.sh` script to support conditional CUDA builds and asset URL overrides, ensuring better compatibility with various environments.
- Improved logging in the installation scripts to provide clearer feedback during the setup process.
This commit is contained in:
Leonid Pershin
2026-08-21 08:19:37 +03:00
parent ccba40a228
commit 91d2ce0fab
7 changed files with 311 additions and 79 deletions
+27
View File
@@ -0,0 +1,27 @@
from types import SimpleNamespace
from gpu_rent.provision import _LLAMACPP_INSTALL_ENV, _remote_llm_env
def test_remote_llm_env_forwards_llamacpp_vars(monkeypatch):
monkeypatch.setenv("LLAMACPP_TAG", "b10545")
monkeypatch.setenv("LLAMACPP_BUILD_CUDA", "1")
monkeypatch.setenv("LLAMACPP_NGL", "40")
monkeypatch.setenv("LLAMACPP_ASSET_URL", "https://example/a.tar.gz")
monkeypatch.delenv("LLAMACPP_SHA256", raising=False)
cfg = SimpleNamespace(ssh_user="ubuntu")
env = _remote_llm_env(cfg, *_LLAMACPP_INSTALL_ENV)
assert env["SWARM_USER"] == "ubuntu"
assert env["LLAMACPP_TAG"] == "b10545"
assert env["LLAMACPP_BUILD_CUDA"] == "1"
assert env["LLAMACPP_NGL"] == "40"
assert env["LLAMACPP_ASSET_URL"] == "https://example/a.tar.gz"
assert "LLAMACPP_SHA256" not in env
def test_remote_llm_env_skips_empty(monkeypatch):
for key in _LLAMACPP_INSTALL_ENV:
monkeypatch.delenv(key, raising=False)
cfg = SimpleNamespace(ssh_user="ubuntu")
env = _remote_llm_env(cfg, *_LLAMACPP_INSTALL_ENV)
assert env == {"SWARM_USER": "ubuntu"}