Set Gemma 2 2B MLX as default local model and add --mlx-model flag
This commit is contained in:
+4
-4
@@ -92,7 +92,7 @@ class MacOSLLM(FrameProcessor):
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
model: str = "mlx-community/Llama-3.2-1B-Instruct-4bit",
|
||||
model: str = "mlx-community/gemma-2-2b-it-4bit",
|
||||
system_prompt: str | None = None,
|
||||
observer=None,
|
||||
**kwargs,
|
||||
@@ -194,20 +194,20 @@ class MacOSLLM(FrameProcessor):
|
||||
loop = asyncio.get_running_loop()
|
||||
def _gen():
|
||||
from mlx_lm import generate
|
||||
from mlx_lm.sample_utils import make_sampler
|
||||
# Keep history concise to avoid context drift and repetition
|
||||
recent_history = self._history[-8:]
|
||||
messages = [{"role": "system", "content": self._system_prompt}] + recent_history
|
||||
prompt = self._mlx_tokenizer.apply_chat_template(
|
||||
messages, add_generation_prompt=True, tokenize=False
|
||||
)
|
||||
sampler = make_sampler(temp=0.7)
|
||||
return generate(
|
||||
self._mlx_model,
|
||||
self._mlx_tokenizer,
|
||||
prompt=prompt,
|
||||
max_tokens=150,
|
||||
temp=0.7,
|
||||
repetition_penalty=1.2,
|
||||
repetition_context_size=30,
|
||||
sampler=sampler,
|
||||
verbose=False,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user