okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
aff3a132f
main
1"""0.2.13 (owner, 2026-11-08): one fit label for every family. The model's files, download size MINUS the n-gram / PLE / Engram lookup table's file (the 2"Needs (RAM + VRAM)" column), against the graphics memory plus the RAM: "fits", else "may run slower". Nothing else is said on those rows (no "SSD N GB", no 3"too big", no RAM floor), also with no card or a Mac with little memory. 4 5The screenshot PC: a Tesla V100-PCIE-32GB with 31 GB of RAM (63 GB together): every set up to 63 GB of weights said "fits"; the Unsloth sets said "too big" while 6IQ3_S, with the same 50 GB of experts, said "fits, a bit slower". 7""" 8from __future__import annotations 9 10import unittest 11 12from strata_cli .launch .catalog import FITS ,NO ,SLOWER ,verdict 13from strata_control import fit_label 14from tests .terminal .launch_support import HW_12 ,Home ,catalog 15 16V100 = {"index" :0 ,"name" :"Tesla V100-PCIE-32GB" ,"vram_gb" :32.0 ,"usable" :True ,"vendor" :"nvidia" ,"arch" :70 } 17HW_V100_31 = {** HW_12 ,"ram_gb" :31.0 ,"disk_free_gb" :5000.0 ,"gpus" : [V100 ]} 18 19 20class TheRule (unittest .TestCase ): 21def test_the_table_file_is_taken_off_the_download (self ): 22import setup 23want = {("qwen" ,"IQ3_S" ):54.8 , ("swift" ,"IQ3_XXS" ):47.0 , ("coder" ,"IQ1_M" ):29.6 , ("unsloth" ,"UD-IQ4_XS-v31" ):64.9 , ("unsloth" ,"UD-IQ4_XS" ):64.9 , 24 ("unsloth" ,"UD-Q4_K_XL" ):82.5 , ("unsloth" ,"UD-Q5_K_XL" ):103.9 , ("unsloth" ,"Q8_0" ):133.8 ,# the three big files carry a 54.4 GB Q8_0 table 25 ("gyro" ,"Gyro-S" ):27.6 , ("gyro" ,"Gyro-M" ):35.0 , ("nvfp4" ,"NVFP4" ):76.8 }# Gyro: the table is inside the file, the catalog states the rest 26for (family ,model ),gb in want .items (): 27self .assertEqual (fit_label .files_gb (family ,model ,setup .MODELS [model ]),gb , (family ,model )) 28self .assertEqual (fit_label .files_gb ("nvfp4" ,"NVFP4-QAD" ,setup .MODELS ["NVFP4-QAD" ]),76.8 )# the converted pack that runs, not the 102.2 GB checkpoint minus the table 29self .assertEqual (fit_label .files_gb ("nvfp4" ,"NVFP4-NVIDIA" ,setup .MODELS ["NVFP4-NVIDIA" ]),76.8 ) 30self .assertEqual (fit_label .files_gb ("qwen36" ,"UD-Q6_K_XL" , {"download_gb" :32.6 ,"ram_gb" :44 }),32.6 )# its own path: no table 31self .assertEqual (fit_label .files_gb ("somefeedmodel" ,"X" , {"download_gb" :10.0 ,"ram_gb" :8 }),10.0 )# a family this module does not know counts its whole download 32 33def test_the_label_is_the_weights_against_ram_plus_card (self ): 34self .assertEqual (fit_label .label (63.0 ,31.0 ,32.0 ),"fits" )# exactly as much as there is 35self .assertEqual (fit_label .label (63.1 ,31.0 ,32.0 ),"may run slower" ) 36self .assertEqual (fit_label .label (35.0 ,31.0 ,0.0 ),"may run slower" )# no card: the RAM alone 37 38def test_the_card_that_counts (self ): 39self .assertEqual (fit_label .card_room_gb ([{"vram_gb" :12.0 }, {"vram_gb" :24.0 }]),24.0 )# the largest card 40self .assertEqual (fit_label .card_room_gb ([{"vram_gb" :96.0 ,"uma" :True ,"dedicated_gb" :8.0 }]),8.0 )# a chip that shares the RAM: its carve-out only 41self .assertEqual (fit_label .card_room_gb ([]),0.0 ) 42 43 44class TheTerminalMenu (unittest .TestCase ): 45def rows (self ,hw ): 46with Home (): 47return {(r .family ,r .model ):r for r in catalog (hw ).rows ()} 48 49def test_the_v100_screenshot (self ): 50rows = self .rows (HW_V100_31 ) 51for (family ,model ),r in rows .items (): 52want = FITS if r .fit_gb <= 63.0 else SLOWER 53self .assertEqual ((r .verdict ,r .words ), (want ,"fits" if want == FITS else "may run slower" ), (family ,model ,r .fit_gb )) 54for m in ("UD-IQ1_M" ,"UD-Q2_0" ,"UD-IQ2_XS" ,"UD-Q2_K_XL" ,"UD-IQ3_XXS" ,"UD-Q3_K_XL" ):# the Unsloth sets that were "too big", 39 to 61 GB 55self .assertEqual (rows [("unsloth" ,m )].words ,"fits" ,m ) 56for m in ("UD-IQ4_XS" ,"UD-IQ4_XS-v31" ,"UD-Q4_K_XL" ,"UD-Q5_K_XL" ,"UD-Q6_K_XL" ,"Q8_0" ): 57self .assertEqual (rows [("unsloth" ,m )].words ,"may run slower" ,m ) 58self .assertEqual (round (rows [("unsloth" ,"UD-IQ4_XS-v31" )].fit_gb ,1 ),64.9 )# 93.7 - 28.8: over 63 59self .assertEqual (rows [("qwen" ,"IQ3_S" )].words ,rows [("unsloth" ,"UD-IQ3_XXS" )].words )# same size, same word 60self .assertEqual ({rows [("nvfp4" ,m )].words for m in ("NVFP4" ,"NVFP4-NVIDIA" ,"NVFP4-QAD" )}, {"may run slower" })# QAD too: the pack that runs is 76.8 GB 61self .assertEqual ({round (rows [("nvfp4" ,m )].fit_gb ,1 )for m in ("NVFP4" ,"NVFP4-NVIDIA" ,"NVFP4-QAD" )}, {76.8 }) 62 63def test_no_row_uses_the_old_words (self ): 64for hw in (HW_V100_31 ,HW_12 , {** HW_12 ,"ram_gb" :16.0 ,"gpus" : []}): 65for key ,r in self .rows (hw ).items (): 66self .assertNotEqual (r .verdict ,NO ,key )# nothing is "too big" any more 67for old in ("too big" ,"fits, a bit slower" ,"fits, part read from SSD" ,"much read from SSD" ,"does not fit" ,"slow here" ): 68self .assertNotIn (old ,r .words , (key ,r .words )) 69self .assertIn (r .words , ("fits" ,"may run slower" ),key ) 70 71def test_a_64_gb_pc_with_a_12_gb_card (self ): 72rows = self .rows ({** HW_12 ,"disk_free_gb" :5000.0 })# 76 GB together 73self .assertEqual (rows [("unsloth" ,"UD-IQ4_XS-v31" )].words ,"fits" )# 64.9 GB 74self .assertEqual (rows [("unsloth" ,"UD-Q4_K_XL" )].words ,"may run slower" )# 82.5 GB 75self .assertEqual (rows [("nvfp4" ,"NVFP4" )].words ,"may run slower" )# 76.8 GB against 75.9 76 77def test_the_catalog_words (self ): 78with Home (): 79row = next (x for x in catalog (HW_V100_31 ).strata .model_table (HW_V100_31 )if x ["family" ]== "unsloth" ) 80by = {x ["model" ]:x ["on_this_pc" ]for x in row ["sizes" ]} 81self .assertEqual ({v for k ,v in by .items ()}, {"fits" ,"may run slower" }) 82self .assertEqual (by ["UD-IQ3_XXS" ],"fits" ) 83self .assertEqual (by ["UD-Q4_K_XL" ],"may run slower" ) 84 85def test_the_table_words_in_the_terminal (self ): 86self .assertEqual (verdict ("fits" ), (FITS ,"fits" )) 87self .assertEqual (verdict ("may run slower" ), (SLOWER ,"may run slower" )) 88self .assertEqual (verdict ("does not fit: it needs one or more graphics cards" ), (SLOWER ,"may run slower" ))# an older Control's words 89 90 91if __name__ == "__main__" : 92unittest .main ()