Instructions to use LiquidAI/LFM2.5-1.2B-Instruct-MLX-bf16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use LiquidAI/LFM2.5-1.2B-Instruct-MLX-bf16 with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("LiquidAI/LFM2.5-1.2B-Instruct-MLX-bf16") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use LiquidAI/LFM2.5-1.2B-Instruct-MLX-bf16 with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "LiquidAI/LFM2.5-1.2B-Instruct-MLX-bf16"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "LiquidAI/LFM2.5-1.2B-Instruct-MLX-bf16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use LiquidAI/LFM2.5-1.2B-Instruct-MLX-bf16 with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "LiquidAI/LFM2.5-1.2B-Instruct-MLX-bf16"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "LiquidAI/LFM2.5-1.2B-Instruct-MLX-bf16" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LiquidAI/LFM2.5-1.2B-Instruct-MLX-bf16", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use LiquidAI/LFM2.5-1.2B-Instruct-MLX-bf16 with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "LiquidAI/LFM2.5-1.2B-Instruct-MLX-bf16"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default LiquidAI/LFM2.5-1.2B-Instruct-MLX-bf16
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use LiquidAI/LFM2.5-1.2B-Instruct-MLX-bf16 with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "LiquidAI/LFM2.5-1.2B-Instruct-MLX-bf16"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "LiquidAI/LFM2.5-1.2B-Instruct-MLX-bf16" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -47,6 +47,16 @@ MLX export of [LFM2.5-1.2B-Instruct](https://huggingface.co/LiquidAI/LFM2.5-1.2B
|
|
| 47 |
| Size | 2.2 GB |
|
| 48 |
| Context Length | 128K |
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
## Use with mlx
|
| 51 |
|
| 52 |
```bash
|
|
@@ -55,6 +65,7 @@ pip install mlx-lm
|
|
| 55 |
|
| 56 |
```python
|
| 57 |
from mlx_lm import load, generate
|
|
|
|
| 58 |
|
| 59 |
model, tokenizer = load("LiquidAI/LFM2.5-1.2B-Instruct-bf16")
|
| 60 |
|
|
@@ -66,7 +77,18 @@ if tokenizer.chat_template is not None:
|
|
| 66 |
messages, tokenize=False, add_generation_prompt=True
|
| 67 |
)
|
| 68 |
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
```
|
| 71 |
|
| 72 |
## License
|
|
|
|
| 47 |
| Size | 2.2 GB |
|
| 48 |
| Context Length | 128K |
|
| 49 |
|
| 50 |
+
## Recommended Sampling Parameters
|
| 51 |
+
|
| 52 |
+
| Parameter | Value |
|
| 53 |
+
|-----------|-------|
|
| 54 |
+
| temperature | 0.1 |
|
| 55 |
+
| top_k | 50 |
|
| 56 |
+
| top_p | 0.1 |
|
| 57 |
+
| repetition_penalty | 1.05 |
|
| 58 |
+
| max_tokens | 512 |
|
| 59 |
+
|
| 60 |
## Use with mlx
|
| 61 |
|
| 62 |
```bash
|
|
|
|
| 65 |
|
| 66 |
```python
|
| 67 |
from mlx_lm import load, generate
|
| 68 |
+
from mlx_lm.sample_utils import make_sampler, make_logits_processors
|
| 69 |
|
| 70 |
model, tokenizer = load("LiquidAI/LFM2.5-1.2B-Instruct-bf16")
|
| 71 |
|
|
|
|
| 77 |
messages, tokenize=False, add_generation_prompt=True
|
| 78 |
)
|
| 79 |
|
| 80 |
+
sampler = make_sampler(temp=0.1, top_k=50, top_p=0.1)
|
| 81 |
+
logits_processors = make_logits_processors(repetition_penalty=1.05)
|
| 82 |
+
|
| 83 |
+
response = generate(
|
| 84 |
+
model,
|
| 85 |
+
tokenizer,
|
| 86 |
+
prompt=prompt,
|
| 87 |
+
max_tokens=512,
|
| 88 |
+
sampler=sampler,
|
| 89 |
+
logits_processors=logits_processors,
|
| 90 |
+
verbose=True,
|
| 91 |
+
)
|
| 92 |
```
|
| 93 |
|
| 94 |
## License
|