Instructions to use Irfanuruchi/SmolLM2-1.7B-Instruct-MLX-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use Irfanuruchi/SmolLM2-1.7B-Instruct-MLX-4bit 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("Irfanuruchi/SmolLM2-1.7B-Instruct-MLX-4bit") 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) - Transformers.js
How to use Irfanuruchi/SmolLM2-1.7B-Instruct-MLX-4bit with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('text-generation', 'Irfanuruchi/SmolLM2-1.7B-Instruct-MLX-4bit'); - Notebooks
- Google Colab
- Kaggle
- Local Apps
- LM Studio
- MLX LM
How to use Irfanuruchi/SmolLM2-1.7B-Instruct-MLX-4bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "Irfanuruchi/SmolLM2-1.7B-Instruct-MLX-4bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "Irfanuruchi/SmolLM2-1.7B-Instruct-MLX-4bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Irfanuruchi/SmolLM2-1.7B-Instruct-MLX-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }'
SmolLM2-1.7B Instruct (MLX, 4-bit)
This is an MLX conversion of HuggingFaceTB/SmolLM2-1.7B-Instruct quantized to 4-bit for fast on-device inference on Apple Silicon.
Quickstart
Install:
pip install -U mlx-lm
Run:
mlx_lm.generate \
--model Irfanuruchi/SmolLM2-1.7B-Instruct-MLX-4bit \
--prompt "Reply with exactly 3 bullet points, 4–8 words each: what can you do offline?" \
--max-tokens 80
Benchmarks (MacBook Pro M3 Pro)
- Disk: 922 MB
- Peak RAM: 1.093 GB
Performance will vary across devices and prompts.
Notes
- Converted/quantized with
mlx_lm.convert. - This repo contains MLX weights and tokenizer/config files.
License & attribution
Upstream model: HuggingFaceTB/SmolLM2-1.7B-Instruct (Apache-2.0).
Please follow the upstream license and attribution requirements.
- Downloads last month
- 20
Model size
0.3B params
Tensor type
BF16
·
U32 ·
Hardware compatibility
Log In to add your hardware
4-bit
Model tree for Irfanuruchi/SmolLM2-1.7B-Instruct-MLX-4bit
Base model
HuggingFaceTB/SmolLM2-1.7B Quantized
HuggingFaceTB/SmolLM2-1.7B-Instruct