Enhance Ollama model management and performance tuning
- Updated the `provision_llm` function to utilize the `/api/tags` endpoint for verifying available models, improving accuracy in model management. - Introduced a new `already_have_ollama_tag` function to ensure exact tag matching, preventing mismatches during model checks. - Enhanced the `pull_stream` function to require a successful status from the API before proceeding, ensuring reliable model downloads. - Added logic to handle unwritten blob files, improving the robustness of the model pulling process. - Updated documentation and tests to reflect these changes, ensuring clarity and reliability in Ollama model operations.
This commit is contained in:
@@ -3,6 +3,7 @@ from pathlib import Path
|
||||
import pytest
|
||||
|
||||
from gpu_rent.llm_runtime import (
|
||||
already_have_ollama_tag,
|
||||
decide_runtime,
|
||||
normalize_runtime,
|
||||
parse_ollama_models,
|
||||
@@ -59,3 +60,11 @@ def test_write_preset(tmp_path: Path):
|
||||
assert parse_ollama_models(path)[0].name == "huihui_ai/qwen2.5-vl-abliterated:32b"
|
||||
write_ollama_models_preset(path, "text")
|
||||
assert parse_ollama_models(path)[0].name == "huihui_ai/qwen2.5-abliterate:7b"
|
||||
|
||||
|
||||
def test_already_have_ollama_tag_exact_only():
|
||||
have = {"qwen2.5:7b", "foo:latest"}
|
||||
assert already_have_ollama_tag(have, "qwen2.5:7b")
|
||||
assert not already_have_ollama_tag(have, "qwen2.5:3b")
|
||||
assert already_have_ollama_tag(have, "foo")
|
||||
assert already_have_ollama_tag(have, "foo:latest")
|
||||
|
||||
Reference in New Issue
Block a user