okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
fefaa985c
main
1"""serve/test_q36_config.py - what the server hands the Qwen3.6-35B-A3B engine (arch qwen35moe): the config's pictures 2("vision" section -> --vision) and parallel requests ("parallel": N -> --batch N), as for Flash-Next's engine. 3 4python -m unittest serve.test_q36_config 5""" 6from __future__import annotations 7 8import unittest 9from unittest import mock 10 11from serve .server import engine_args ,parallel_args 12 13 14def cfg (** kw ): 15base = {"arch" :"qwen35moe" ,"exe" :"strata" ,"args" : ["--native" ,"/m/Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf" , 16"--max-context" ,"32768" ,"--prefill" ,"auto" ,"--mtp" ,"2" ]} 17base .update (kw ) 18return base 19 20 21class Q36Config (unittest .TestCase ): 22def test_parallel_becomes_batch (self ): 23a = engine_args (cfg (parallel = 4 )) 24self .assertEqual (a [a .index ("--batch" )+ 1 ],"4" ) 25self .assertNotIn ("--batch" ,engine_args (cfg ())) 26self .assertNotIn ("--batch" ,engine_args (cfg (parallel = 1 ))) 27 28def test_more_than_the_window_is_said (self ): 29with mock .patch ("builtins.print" )as pr : 30a = engine_args (cfg (parallel = 12 )) 31self .assertEqual (a [a .index ("--batch" )+ 1 ],"12" )# the engine caps it at 8 and says so 32self .assertTrue (any ("at most 8" in str (c )for c in pr .call_args_list )) 33 34def test_a_vision_section_starts_the_engine_with_pictures (self ): 35v = {"exe" :"strata-vision" ,"mmproj" :"/m/mmproj-F16.gguf" ,"model" :"/m/Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf" , 36"gpu" :False ,"max_tokens" :300 } 37self .assertIn ("--vision" ,engine_args (cfg (vision = v ))) 38self .assertIn ("--vision" ,engine_args (cfg (vision = v ,args = cfg ()["args" ]+ ["--vision" ]))) 39self .assertEqual (engine_args (cfg (vision = v ,args = cfg ()["args" ]+ ["--vision" ])).count ("--vision" ),1 ) 40self .assertNotIn ("--vision" ,engine_args (cfg ())) 41 42def test_a_context_the_card_cannot_hold_is_said_before_the_start (self ): 43# #5715: RTX 5070 12 GB (12227 MiB), UD-Q4_K_XL; the start goes on with the context as written 44big = cfg (model_name = "qwen3.6-35b-a3b-ud-q4_k_xl" ,args = ["--native" ,"/m/Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf" ,"--max-context" ,"131072" ]) 45for c ,vram ,said in ((big ,12227.0 ,True ), (cfg (model_name = "qwen3.6-35b-a3b-ud-q4_k_xl" ),12227.0 ,False ), 46 (big ,16311.0 ,False ), (big ,None ,False ), ({** big ,"model_name" :"qwen3.8-flash-next-iq3_s" },12227.0 ,False )): 47with mock .patch ("serve.server.drafting_vram_mib" ,lambda * a ,_v = vram :_v ),mock .patch ("builtins.print" )as pr : 48a = engine_args (c ) 49lines = [str (x )for x in pr .call_args_list if "will probably not start" in str (x )] 50self .assertEqual (len (lines ),1 if said else 0 , (c .get ("model_name" ),vram )) 51self .assertEqual (a [a .index ("--max-context" )+ 1 ],c ["args" ][c ["args" ].index ("--max-context" )+ 1 ]) 52if said : 53self .assertIn ("[strata] At 128K, this model's conversation memory needs about 5.8 GB of graphics memory. With the model itself that " 54"is more than this card's 12 GB, so it will probably not start. 32K fits on this card: choose 32K or less." ,lines [0 ]) 55 56def test_an_explicit_batch_in_the_args_wins (self ): 57c = cfg (parallel = 4 ,args = cfg ()["args" ]+ ["--batch" ,"2" ]) 58self .assertEqual (parallel_args (c ,c ["args" ]), []) 59 60 61if __name__ == "__main__" : 62unittest .main ()