Refactor LLM configuration to remove llamacpp support
- Removed references to llamacpp from configuration files, scripts, and documentation, streamlining the LLM setup process to focus solely on Ollama. - Updated environment variables and paths to eliminate llamacpp-related entries, ensuring clarity in the configuration. - Adjusted CLI commands and help messages to reflect the removal of llamacpp, enhancing user experience and reducing confusion. - Revised documentation to provide clear guidance on using Ollama exclusively, including updates to setup instructions and runtime options.
This commit is contained in:
@@ -5,10 +5,7 @@ import pytest
|
||||
from gpu_rent.llm_runtime import (
|
||||
decide_runtime,
|
||||
normalize_runtime,
|
||||
parse_llamacpp_models,
|
||||
parse_ollama_models,
|
||||
pick_llamacpp_linux_asset_url,
|
||||
remap_llamacpp_url,
|
||||
write_ollama_models_preset,
|
||||
)
|
||||
|
||||
@@ -16,22 +13,20 @@ from gpu_rent.llm_runtime import (
|
||||
def test_normalize_runtime():
|
||||
assert normalize_runtime(None) == "none"
|
||||
assert normalize_runtime("OLLAMA") == "ollama"
|
||||
assert normalize_runtime("llama-cpp") == "llamacpp"
|
||||
with pytest.raises(ValueError):
|
||||
normalize_runtime("llamacpp")
|
||||
with pytest.raises(ValueError):
|
||||
normalize_runtime("foo")
|
||||
|
||||
|
||||
def test_decide_runtime_flags_win():
|
||||
assert (
|
||||
decide_runtime(flag=None, ollama_flag=True, llamacpp_flag=False, from_config="none")
|
||||
== "ollama"
|
||||
decide_runtime(flag=None, ollama_flag=True, from_config="none") == "ollama"
|
||||
)
|
||||
assert (
|
||||
decide_runtime(flag="llamacpp", ollama_flag=False, llamacpp_flag=False, from_config="ollama")
|
||||
== "llamacpp"
|
||||
decide_runtime(flag="ollama", ollama_flag=False, from_config="none") == "ollama"
|
||||
)
|
||||
with pytest.raises(ValueError):
|
||||
decide_runtime(flag=None, ollama_flag=True, llamacpp_flag=True, from_config="none")
|
||||
assert decide_runtime(flag=None, ollama_flag=False, from_config="ollama") == "ollama"
|
||||
|
||||
|
||||
def test_parse_ollama_models(tmp_path: Path):
|
||||
@@ -60,66 +55,3 @@ def test_write_preset(tmp_path: Path):
|
||||
write_ollama_models_preset(path, "recommended")
|
||||
entries = parse_ollama_models(path)
|
||||
assert entries[0].name == "huihui_ai/qwen2.5-vl-abliterated:7b"
|
||||
|
||||
|
||||
def test_write_llamacpp_preset_includes_mmproj(tmp_path: Path):
|
||||
from gpu_rent.llm_runtime import write_llamacpp_models_preset
|
||||
|
||||
path = tmp_path / "lc.yaml"
|
||||
write_llamacpp_models_preset(path, "recommended")
|
||||
entries = parse_llamacpp_models(path)
|
||||
assert len(entries) == 1
|
||||
assert "VL" in entries[0].url or "vl" in entries[0].url.lower()
|
||||
assert entries[0].mmproj_url
|
||||
assert "mmproj" in entries[0].mmproj_url
|
||||
|
||||
|
||||
def test_remap_dead_bartowski_abliterate_url(tmp_path: Path):
|
||||
dead = (
|
||||
"https://huggingface.co/bartowski/huihui-ai_Qwen2.5-7B-Instruct-abliterated-GGUF/"
|
||||
"resolve/main/huihui-ai_Qwen2.5-7B-Instruct-abliterated-Q4_K_M.gguf"
|
||||
)
|
||||
fixed = remap_llamacpp_url(dead)
|
||||
assert "RichardErkhov" in fixed
|
||||
assert "Q4_K_M.gguf" in fixed
|
||||
path = tmp_path / "lc.yaml"
|
||||
path.write_text(f"models:\n - url: {dead}\n default: true\n", encoding="utf-8")
|
||||
entries = parse_llamacpp_models(path)
|
||||
assert len(entries) == 1
|
||||
assert entries[0].url == fixed
|
||||
|
||||
|
||||
def test_pick_llamacpp_linux_asset_skips_windows_cuda():
|
||||
assets = [
|
||||
{
|
||||
"name": "cudart-llama-bin-win-cuda-12.4-x64.zip",
|
||||
"browser_download_url": "https://example/cudart-win.zip",
|
||||
},
|
||||
{
|
||||
"name": "llama-b10545-bin-win-cuda-12.4-x64.zip",
|
||||
"browser_download_url": "https://example/win-cuda.zip",
|
||||
},
|
||||
{
|
||||
"name": "llama-b10545-bin-ubuntu-x64.tar.gz",
|
||||
"browser_download_url": "https://example/ubuntu-cpu.tar.gz",
|
||||
},
|
||||
{
|
||||
"name": "llama-b10545-bin-ubuntu-vulkan-x64.tar.gz",
|
||||
"browser_download_url": "https://example/ubuntu-vulkan.tar.gz",
|
||||
},
|
||||
]
|
||||
assert pick_llamacpp_linux_asset_url(assets) == "https://example/ubuntu-vulkan.tar.gz"
|
||||
|
||||
|
||||
def test_pick_llamacpp_linux_asset_prefers_ubuntu_cuda():
|
||||
assets = [
|
||||
{
|
||||
"name": "llama-b1-bin-ubuntu-vulkan-x64.tar.gz",
|
||||
"browser_download_url": "https://example/vulkan.tar.gz",
|
||||
},
|
||||
{
|
||||
"name": "llama-b1-bin-ubuntu-cuda-12.4-x64.tar.gz",
|
||||
"browser_download_url": "https://example/cuda.tar.gz",
|
||||
},
|
||||
]
|
||||
assert pick_llamacpp_linux_asset_url(assets) == "https://example/cuda.tar.gz"
|
||||
|
||||
Reference in New Issue
Block a user