@@ -277,6 +277,10 @@ def __init__(self, root: tk.Tk):
277277 # --- New Parameters ---
278278 self .ignore_eos = tk .BooleanVar (value = False ) # --ignore-eos
279279 self .n_predict = tk .StringVar (value = "-1" ) # --n-predict
280+
281+ # --- MoE CPU Parameters ---
282+ self .cpu_moe = tk .BooleanVar (value = False ) # --cpu-moe
283+ self .n_cpu_moe = tk .StringVar (value = "" ) # --n-cpu-moe
280284
281285 # --- Chat Template Selection Variables ---
282286 # Controls which template source is used: 'default', 'predefined', or 'custom'.
@@ -417,6 +421,9 @@ def __init__(self, root: tk.Tk):
417421 self .n_predict .trace_add ("write" , lambda * args : self ._update_default_config_name_if_needed ())
418422 # Bind trace to ignore_eos to update default config name if needed
419423 self .ignore_eos .trace_add ("write" , lambda * args : self ._update_default_config_name_if_needed ())
424+ # Bind trace to MoE CPU parameters to update default config name if needed
425+ self .cpu_moe .trace_add ("write" , lambda * args : self ._update_default_config_name_if_needed ())
426+ self .n_cpu_moe .trace_add ("write" , lambda * args : self ._update_default_config_name_if_needed ())
420427 # Bind trace to other variables that affect the default config name
421428 self .cache_type_k .trace_add ("write" , lambda * args : self ._update_default_config_name_if_needed ())
422429 self .threads .trace_add ("write" , lambda * args : self ._update_default_config_name_if_needed ())
@@ -1147,6 +1154,21 @@ def _setup_advanced_tab(self, parent):
11471154 self .prio_combo .grid (column = 1 , row = r , sticky = "w" , padx = 5 , pady = 3 ); r += 1
11481155 ttk .Label (inner , text = "0=Normal, 1=Medium, 2=High, 3=Realtime (OS dependent)" , font = ("TkSmallCaptionFont" ))\
11491156 .grid (column = 2 , row = r - 1 , columnspan = 2 , sticky = "w" , padx = 5 , pady = 3 ); # Re-grid label
1157+
1158+ # --- MoE CPU Settings --- (same row)
1159+ ttk .Label (inner , text = "MoE CPU Settings:" )\
1160+ .grid (column = 0 , row = r , sticky = "w" , padx = 10 , pady = 3 )
1161+ moe_frame = ttk .Frame (inner )
1162+ moe_frame .grid (column = 1 , row = r , columnspan = 3 , sticky = "w" , padx = 5 , pady = 3 )
1163+
1164+ self .cpu_moe_check = ttk .Checkbutton (moe_frame , text = "Keep all MoE in CPU (--cpu-moe)" , variable = self .cpu_moe , state = tk .NORMAL )
1165+ self .cpu_moe_check .pack (side = "left" , padx = (0 , 10 ))
1166+
1167+ ttk .Label (moe_frame , text = "First N layers in CPU (--n-cpu-moe):" )\
1168+ .pack (side = "left" , padx = (0 , 5 ))
1169+ self .n_cpu_moe_entry = ttk .Entry (moe_frame , textvariable = self .n_cpu_moe , width = 8 , state = tk .NORMAL )
1170+ self .n_cpu_moe_entry .pack (side = "left" )
1171+ r += 1
11501172
11511173
11521174 # --- NEW: Generation Settings ---
@@ -1647,7 +1669,8 @@ def _scan_model_dirs(self):
16471669 print ("DEBUG: _scan_model_dirs thread started" , file = sys .stderr )
16481670 found = {} # {display_name: full_path_obj}
16491671 # Pattern to match multi-part files like model-00001-of-00005.gguf or model-F1.gguf
1650- multipart_pattern = re .compile (r"^(.*?)(?:-\d{5}-of-\d{5}|-F\d+)\.gguf$" , re .IGNORECASE )
1672+ # Note: -F[1-9] only matches single-digit F parts to avoid matching precision indicators like F16, F32
1673+ multipart_pattern = re .compile (r"^(.*?)(?:-\d{5}-of-\d{5}|-F[1-9])\.gguf$" , re .IGNORECASE )
16511674 # Pattern to match the FIRST part of a multi-part file (e.g., model-00001-of-00005.gguf or model-F1.gguf)
16521675 first_part_pattern = re .compile (r"^(.*?)-(?:00001-of-\d{5}|F1)\.gguf$" , re .IGNORECASE )
16531676
0 commit comments