Skip to content

Commit e62969b

Browse files
committed
fixed issue where failed gguf parsing locked down certain parameters
1 parent faed603 commit e62969b

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

llamacpp-server-launcher.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,11 +2037,14 @@ def _update_ui_after_analysis(self, analysis_result):
20372037
if error or n_layers is None or n_layers <= 0:
20382038
# Analysis failed or layer count invalid/zero
20392039
status_msg = error if error else (message if message else "Layer count not found or invalid")
2040-
self.gpu_layers_status_var.set(f"Analysis Error: {status_msg}" if error else status_msg)
2040+
# Show that manual entry is still available
2041+
full_status = f"Analysis Error: {status_msg}" if error else status_msg
2042+
full_status += " (Manual entry available)"
2043+
self.gpu_layers_status_var.set(full_status)
20412044
# Resetting controls sets max_layers to 0 and disables the slider
2042-
self._reset_gpu_layer_controls()
2043-
# Now, sync the entry/slider based on the existing value in the entry and max_layers=0
2044-
self._sync_gpu_layers_from_entry()
2045+
self._reset_gpu_layer_controls(keep_entry_enabled=True)
2046+
# IMPORTANT: Don't sync from entry when analysis fails to preserve user's value
2047+
# The entry remains enabled and the user can still manually set GPU layers
20452048

20462049
else: # Analysis succeeded, layers found (n_layers > 0)
20472050
self.max_gpu_layers.set(n_layers)
@@ -2133,7 +2136,9 @@ def _set_gpu_layers(self, input_value, from_slider=False):
21332136
# Clamp positive input value to max_layers if max > 0
21342137
int_val = min(input_value, max_layers)
21352138
else:
2136-
int_val = 0 # If max_layers <= 0, any positive input still means 0 layers offloaded internally
2139+
# If max_layers <= 0 (analysis failed), preserve the user's input value
2140+
# This allows users to manually set GPU layers when analysis fails
2141+
int_val = input_value
21372142
# else: input_value < -1 (should be prevented by validation) -> default to 0
21382143

21392144
# Update the Tk integer variable (linked to slider)
@@ -2205,7 +2210,10 @@ def _sync_gpu_layers_from_entry(self, event=None):
22052210
# If max_layers > 0, the entry should represent the *clamped* value
22062211
clamped_int_from_set = self.n_gpu_layers_int.get() # Get the result of _set_gpu_layers
22072212
canonical_str_for_entry = str(clamped_int_from_set) # Always show the actual integer value
2208-
# else: max_layers <= 0, keep current_str (user input)
2213+
else:
2214+
# max_layers <= 0 (analysis failed), preserve user input
2215+
# The internal int value was set to the user's input by _set_gpu_layers
2216+
canonical_str_for_entry = current_str
22092217

22102218
# Update the entry's StringVar only if it's different from the calculated canonical string
22112219
# This prevents loops and ensures the entry displays the correct format (actual number)

0 commit comments

Comments
 (0)