mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-11-06 21:22:23 +01:00
chore(publication): close pre-integration release blockers
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
import pytest
|
||||
|
||||
from services.hwfit.fit import rank_models
|
||||
from services.hwfit.models import get_models, is_prequantized
|
||||
from tests.hwfit_publication_fixtures import publication_catalog # noqa: F401
|
||||
|
||||
# Rank authored inputs rather than publication catalog snapshots.
|
||||
pytestmark = pytest.mark.usefixtures("publication_catalog")
|
||||
|
||||
|
||||
def _8gb_vram_system():
|
||||
@@ -14,38 +20,63 @@ def _8gb_vram_system():
|
||||
}
|
||||
|
||||
|
||||
def test_gemma4_12b_in_catalog():
|
||||
catalog = {m["name"]: m for m in get_models()}
|
||||
assert "google/gemma-4-12B-it" in catalog, "gemma-4-12B-it missing from catalog"
|
||||
GEMMA = "google/gemma-4-12B-it"
|
||||
|
||||
|
||||
def test_gemma4_12b_has_gguf_source():
|
||||
catalog = {m["name"]: m for m in get_models()}
|
||||
entry = catalog["google/gemma-4-12B-it"]
|
||||
assert entry.get("gguf_sources"), "gemma-4-12B-it has no gguf_sources"
|
||||
repos = [s["repo"] for s in entry["gguf_sources"]]
|
||||
assert "unsloth/gemma-4-12B-it-GGUF" in repos
|
||||
def _input_row(rows, name):
|
||||
return next(r for r in rows if r["name"] == name)
|
||||
|
||||
|
||||
def _qat_rows(rows):
|
||||
return [r for r in rows if r["name"].startswith(GEMMA + "-qat-")]
|
||||
|
||||
|
||||
def test_gemma4_12b_user_catalog_row_wins_the_merge(publication_catalog, monkeypatch):
|
||||
"""A dynamic cache listing the same repo must not replace or duplicate the
|
||||
user-catalog row; rows only the cache knows are still merged in."""
|
||||
from services.hwfit import hf_discovery
|
||||
|
||||
monkeypatch.setattr(hf_discovery, "load_cached_hf_collection_models", lambda: [
|
||||
{"name": GEMMA, "quantization": "F16", "gguf_sources": [{"repo": "test/cache-GGUF", "file": "cache.gguf"}]},
|
||||
{"name": "test/cache-only", "quantization": "F16", "gguf_sources": []},
|
||||
])
|
||||
merged = get_models()
|
||||
names = [m["name"] for m in merged]
|
||||
|
||||
assert names.count(GEMMA) == 1
|
||||
assert "test/cache-only" in names
|
||||
entry = next(m for m in merged if m["name"] == GEMMA)
|
||||
assert entry["gguf_sources"] == _input_row(publication_catalog, GEMMA)["gguf_sources"]
|
||||
|
||||
|
||||
def test_gemma4_12b_ranked_row_carries_its_gguf_source(publication_catalog):
|
||||
hit = next(r for r in rank_models(_8gb_vram_system(), search="gemma-4-12B-it", limit=20) if r["name"] == GEMMA)
|
||||
assert hit["gguf_sources"] == _input_row(publication_catalog, GEMMA)["gguf_sources"]
|
||||
# The F16 input does not fit 8 GB, so the fit falls back to a GGUF quant.
|
||||
assert hit["quant"] == "Q4_K_M"
|
||||
|
||||
|
||||
def test_gemma4_12b_rank_models_returns_it_for_8gb_vram():
|
||||
results = rank_models(_8gb_vram_system(), search="gemma-4-12B-it", limit=20)
|
||||
names = [r["name"] for r in results]
|
||||
assert "google/gemma-4-12B-it" in names, "rank_models did not return gemma-4-12B-it for 8 GB VRAM"
|
||||
assert GEMMA in names, "rank_models did not return gemma-4-12B-it for 8 GB VRAM"
|
||||
|
||||
|
||||
def test_gemma4_12b_qat_entries_in_catalog():
|
||||
def test_gemma4_12b_qat_entries_rank_with_their_native_quant(publication_catalog):
|
||||
qat = _qat_rows(publication_catalog)
|
||||
assert len(qat) == 2
|
||||
ranked = {r["name"]: r for r in rank_models(_8gb_vram_system(), search="gemma-4-12B-it-qat", limit=20)}
|
||||
for row in qat:
|
||||
assert ranked[row["name"]]["quant"] == row["quantization"]
|
||||
|
||||
|
||||
def test_gemma4_12b_qat_entries_are_prequantized(publication_catalog):
|
||||
catalog = {m["name"]: m for m in get_models()}
|
||||
assert "google/gemma-4-12B-it-qat-int4" in catalog
|
||||
assert "google/gemma-4-12B-it-qat-int8" in catalog
|
||||
for row in _qat_rows(publication_catalog):
|
||||
assert is_prequantized(catalog[row["name"]])
|
||||
|
||||
|
||||
def test_gemma4_12b_qat_entries_are_prequantized():
|
||||
catalog = {m["name"]: m for m in get_models()}
|
||||
assert is_prequantized(catalog["google/gemma-4-12B-it-qat-int4"])
|
||||
assert is_prequantized(catalog["google/gemma-4-12B-it-qat-int8"])
|
||||
|
||||
|
||||
def test_gemma4_12b_qat_entries_have_no_gguf():
|
||||
catalog = {m["name"]: m for m in get_models()}
|
||||
assert catalog["google/gemma-4-12B-it-qat-int4"]["gguf_sources"] == []
|
||||
assert catalog["google/gemma-4-12B-it-qat-int8"]["gguf_sources"] == []
|
||||
def test_gemma4_12b_qat_entries_have_no_gguf(publication_catalog):
|
||||
ranked = {r["name"]: r for r in rank_models(_8gb_vram_system(), search="gemma-4-12B-it-qat", limit=20)}
|
||||
for row in _qat_rows(publication_catalog):
|
||||
assert ranked[row["name"]]["gguf_sources"] == []
|
||||
|
||||
Reference in New Issue
Block a user