okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
4cfeaa0f4
main
1"""tools/strata_inspect.py's verdict, offline: the fingerprints of the files setup installs (data/gguf_fingerprints.json) 2stand in for headers read from the network. 3 4python -m unittest tools.test_strata_inspect 5""" 6from __future__import annotations 7 8import copy 9import sys 10import unittest 11from pathlib import Path 12 13ROOT = Path (__file__ ).resolve ().parents [1 ] 14sys .path .insert (0 ,str (ROOT / "tools" )) 15import strata_inspect as SI # noqa: E402 16 17 18class Verdict (unittest .TestCase ): 19@classmethod 20def setUpClass (cls ): 21cls .table = SI .load_fingerprints () 22 23def fp (self ,key ): 24return copy .deepcopy ({k :v for k ,v in self .table [key ].items ()if k not in ("files" ,"repo" )}) 25 26def test_every_installed_file_is_known (self ): 27for key in (k for k in self .table if not k .startswith ("_" )): 28kind ,sentence = SI .verdict (self .fp (key ),self .table ) 29fam ,model = key .split ("/" ) 30self .assertEqual (kind ,"known" ,key ) 31self .assertIn (f"--family { fam } --model { model } " ,sentence ) 32 33def test_same_layout_other_file (self ): 34fp = self .fp ("qwen/Q2_0" ) 35fp ["bytes" ]+= 1234 # a fine-tune with the same recipe 36kind ,sentence = SI .verdict (fp ,self .table ) 37self .assertEqual (kind ,"layout" ) 38self .assertIn ("qwen/Q2_0" ,sentence ) 39 40def test_other_architecture (self ): 41fp = self .fp ("qwen/Q2_0" ) 42fp ["arch" ]= "qwen3moe" 43self .assertEqual (SI .verdict (fp ,self .table )[0 ],"no" ) 44 45def test_qwen36_runs_on_its_own_path (self ): 46fp = self .fp ("qwen/Q2_0" ) 47fp ["arch" ]= "qwen35moe" 48kind ,sentence = SI .verdict (fp ,self .table ) 49self .assertEqual (kind ,"family" ) 50self .assertIn ("Qwen3.6-35B-A3B" ,sentence ) 51self .assertIn ("--family qwen36" ,sentence ) 52 53def test_expert_type_without_kernel (self ): 54fp = self .fp ("qwen/IQ3_S" ) 55fp ["expert_bytes" ]= {"IQ1_S" :30_000_000_000 } 56kind ,sentence = SI .verdict (fp ,self .table ) 57self .assertEqual (kind ,"no" ) 58self .assertIn ("IQ1_S" ,sentence ) 59 60def test_untested_names_the_new_tensors (self ):# Unsloth UD-Q2_K_XL's case: known expert types, a new head type 61fp = self .fp ("qwen/IQ3_XXS" ) 62fp ["expert_bytes" ]= {"IQ2_XS" :1 ,"IQ3_XXS" :2 ,"IQ4_NL" :3 } 63fp ["roles" ]= {"output.weight" : ["Q4_K" ],"token_embd.weight" : ["Q3_K" ]} 64kind ,sentence = SI .verdict (fp ,self .table ) 65self .assertEqual (kind ,"untested" ) 66self .assertIn ("output.weight Q4_K" ,sentence ) 67self .assertNotIn ("token_embd" ,sentence ) 68 69 70if __name__ == "__main__" : 71unittest .main ()