okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge f-own-2b (cc8c29f31) into f-own-int: our own GGUF reader/writer and quantizers (gguf-py out of the pack tools)0f1e5e4cb

main
1.9 KiB44 linesraw
1"""The release gate for a feed model's install, as a test in `python tools/check` (py-tools): a REAL synthetic GGUF installed through setup.py from a signed
2test feed (throw-away key) and a local Hugging Face stand-in. See tools/feed_model_install_gate.py for what it does and checks; it catches the Q4-P8 rehearsal's
3F2 (KeyError 'mmproj'), F3 (the Flash-Next draft layer fetched for `drafter: none`), F4 (the shipped expert profile of another shape) and F5 (no RAM budget, a
4second copy of the experts).
5
6    python -m pytest tools/test_feed_model_install_realfile.py
7
8Needs numpy (no llama.cpp checkout and no STRATA_TEST_LLAMA_CPP any more: the preparation tools use tools/strata_gguf.py, not gguf-py); without it the test is SKIPPED
9with that reason, which `tools/check` prints. The engine step (one request) is the gate script's own --engine option and needs a box with an engine built for the file's shape.
10"""
11from __future__ import annotations
12
13import shutil
14import sys
15import tempfile
16import unittest
17from pathlib import Path
18
19ROOT = Path(__file__).resolve().parents[1]
20sys.path.insert(0, str(ROOT / "tools"))
21
22import feed_model_install_gate as gate  # noqa: E402
23
24
25class FeedModelInstallFromRealFile(unittest.TestCase):
26    def test_a_small_synthetic_model_installs_through_setup(self):
27        try:
28            gate.check_gguf_tools()
29            import numpy  # noqa: F401
30        except gate.NotRun as e:
31            self.skipTest(str(e))
32        except ImportError:
33            self.skipTest("numpy is not installed (tools/q4geo_synth.py needs it)")
34        work = Path(tempfile.mkdtemp(prefix="strata-feed-install-"))
35        self.addCleanup(shutil.rmtree, work, True)
36        try:
37            res = gate.check(work, None, gate.TINY, lambda s: None)
38        except gate.NotRun as e:
39            self.skipTest(str(e))
40        self.assertEqual(res["problems"], [], "\n".join(res["out"].splitlines()[-30:]))
41
42
43if __name__ == "__main__":
44    unittest.main()