Skip to content

Commit

Permalink
Refactor model subscription and update model selection options in set…
Browse files Browse the repository at this point in the history
…tings
  • Loading branch information
royshil committed Nov 6, 2024
1 parent 0068e5f commit e515c12
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/llm/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def __init__(self):
# llama_log_set(log_callback, ctypes.c_void_p())
self.set_model(None)
subscribe_to_data("settings.json", "model", self.set_model)
subscribe_to_data("settings.json", "model_file", self.set_model)
subscribe_to_data("settings.json", "context_size", self.set_model)

def set_model(self, _):
Expand Down
13 changes: 10 additions & 3 deletions src/settings_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,15 @@ def compose(self):
(model, model)
for model in [
"bartowski/Llama-3.2-1B-Instruct-GGUF",
"bartowski/SmolLM2-1.7B-Instruct-GGUF",
"bartowski/Phi-3.5-mini-instruct-GGUF",
"MaziyarPanahi/Llama-3.2-1B-Instruct-GGUF",
"MaziyarPanahi/Qwen2-1.5B-Instruct-GGUF",
"unsloth/Llama-3.2-1B-Instruct-GGUF",
"lmstudio-community/Llama-3.2-1B-Instruct-GGUF",
"MaziyarPanahi/SmolLM-1.7B-Instruct-v0.2-GGUF",
"bartowski/Phi-3.5-mini-instruct_Uncensored-GGUF",
"lmstudio-community/Qwen2.5-1.5B-Instruct-GGUF",
"lmstudio-community/SmolLM2-360M-Instruct-GGUF",
"HuggingFaceTB/SmolLM2-1.7B-Instruct-GGUF",
]
],
id="model-select",
Expand Down Expand Up @@ -139,9 +143,12 @@ def compose(self):
def on_select_changed(self, changed: Select.Changed):
if changed.select.id == "model-select":
self.current_model = changed.select.value
store_data("settings.json", "model", self.current_model)
model_file = find_q4_model_file(self.current_model)
if model_file is None:
self.notify("Q4 model file not found.")
return
store_data("settings.json", "model_file", model_file)
store_data("settings.json", "model", self.current_model)
self.notify("Model updated.")
elif changed.select.id == "whisper-model-select":
self.current_whisper_model = changed.select.value
Expand Down

0 comments on commit e515c12

Please sign in to comment.