- Added support for `llamacpp-models.yaml` in `.gitignore` and implemented logic to copy it in `gpu-rent.ps1` and `gpu-rent.sh`. - Enhanced CLI to prompt for llama.cpp model presets during setup and execution, improving user experience. - Updated configuration handling to include `llamacpp_models_manifest` and related functions for managing llama.cpp models. - Improved documentation in `cli.md` and `llm.md` to reflect changes in llama.cpp integration and model management. - Refactored provisioning logic to handle llama.cpp model downloads and configurations effectively.
32 lines
952 B
Python
32 lines
952 B
Python
from pathlib import Path
|
|
|
|
from gpu_rent.llm_runtime import (
|
|
gguf_filename_from_url,
|
|
parse_llamacpp_models,
|
|
write_llamacpp_models_preset,
|
|
)
|
|
|
|
|
|
def test_gguf_filename_from_url():
|
|
url = (
|
|
"https://huggingface.co/org/repo/resolve/main/"
|
|
"Qwen2.5-3B-Instruct-Q4_K_M.gguf"
|
|
)
|
|
assert gguf_filename_from_url(url) == "Qwen2.5-3B-Instruct-Q4_K_M.gguf"
|
|
|
|
|
|
def test_write_and_parse_llamacpp_preset(tmp_path: Path):
|
|
path = tmp_path / "llamacpp-models.yaml"
|
|
write_llamacpp_models_preset(path, "light")
|
|
entries = parse_llamacpp_models(path)
|
|
assert len(entries) == 1
|
|
assert entries[0].default is True
|
|
assert "Qwen2.5-3B" in entries[0].url
|
|
assert entries[0].url.startswith("https://")
|
|
|
|
|
|
def test_parse_llamacpp_empty(tmp_path: Path):
|
|
path = tmp_path / "llamacpp-models.yaml"
|
|
write_llamacpp_models_preset(path, "empty")
|
|
assert parse_llamacpp_models(path) == []
|