okami.mom/strata

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

Niko1221Merge f-split-pics2 (ac658f54a) into f-split-int28a66da38a

main
1.3 KiB32 linesraw
1"""strata-vision opens a GGUF with tensor types llama.cpp does not know (Gyro's TQK6 / TQK7), for its vocabulary only.
2
3The check is a C++ program (tools/vision/gguf_meta_test.cpp, CMake target strata-vision-gguf-test) built with the encoder.
4Set STRATA_VISION_GGUF_TEST to the built binary to run it here; without it the test is skipped (no compiler needed).
5"""
6
7import os
8import subprocess
9import tempfile
10import unittest
11from pathlib import Path
12
13
14class VisionGgufMetaTest(unittest.TestCase):
15    def test_unknown_tensor_types_do_not_stop_the_vocabulary_load(self):
16        binary = os.environ.get("STRATA_VISION_GGUF_TEST", "")
17        if not binary or not Path(binary).is_file():
18            self.skipTest("STRATA_VISION_GGUF_TEST is not set (build the strata-vision-gguf-test target)")
19        with tempfile.TemporaryDirectory() as folder:
20            done = subprocess.run([binary, folder], capture_output=True, text=True, timeout=120)
21        self.assertEqual(done.returncode, 0, done.stdout + done.stderr)
22        self.assertIn("GGUF-META PASS", done.stdout)
23
24    def test_the_gyro_sizes_read_pictures(self):
25        import setup
26        for model in ("Gyro-S", "Gyro-M"):
27            self.assertIs(setup.MODELS[model].get("vision"), True)
28        self.assertIs(setup.FAMILIES["gyro"].get("vision"), True)
29
30
31if __name__ == "__main__":
32    unittest.main()