Instructions to use mlx-community/Olmo-3-7B-Think-bfloat16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/Olmo-3-7B-Think-bfloat16 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("mlx-community/Olmo-3-7B-Think-bfloat16") 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
- LM Studio
- MLX LM
How to use mlx-community/Olmo-3-7B-Think-bfloat16 with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "mlx-community/Olmo-3-7B-Think-bfloat16"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "mlx-community/Olmo-3-7B-Think-bfloat16" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/Olmo-3-7B-Think-bfloat16", "messages": [ {"role": "user", "content": "Hello"} ] }'
| {% set has_system = messages|selectattr('role', 'equalto', 'system')|list|length > 0 %}{% if not has_system %}{{ '<|im_start|>system | |
| You are OLMo, a helpful function-calling AI assistant built by Ai2. Your date cutoff is November 2024, and your model weights are available at https://huggingface.co/allenai. You do not currently have access to any functions. <functions></functions><|im_end|> | |
| ' }}{% endif %}{% for message in messages %}{% if message['role'] == 'system' %}{{ '<|im_start|>system | |
| ' + message['content'] }}{% if message.get('functions', none) is not none %}{{ ' <functions>' + message['functions'] + '</functions><|im_end|> | |
| ' }}{% else %}{{ ' You do not currently have access to any functions. <functions></functions><|im_end|> | |
| ' }}{% endif %}{% elif message['role'] == 'user' %}{% if message.get('functions', none) is not none %}{{ '<|im_start|>user | |
| ' + message['content'] + ' | |
| ' + '<functions>' + message['functions'] + '</functions><|im_end|> | |
| ' }}{% else %}{{ '<|im_start|>user | |
| ' + message['content'] + '<|im_end|> | |
| ' }}{% endif %}{% elif message['role'] == 'assistant' %}{{ '<|im_start|>assistant | |
| ' }}{% if message.get('content', none) is not none %}{{ message['content'] }}{% endif %}{% if message.get('function_calls', none) is not none %}{{ '<function_calls>' + message['function_calls'] + '</function_calls>' }}{% endif %}{% if not loop.last %}{{ '<|im_end|>' + ' | |
| ' }}{% else %}{{ eos_token }}{% endif %}{% elif message['role'] == 'environment' %}{{ '<|im_start|>environment | |
| ' + message['content'] + '<|im_end|> | |
| ' }}{% endif %}{% if loop.last and add_generation_prompt %}{{ '<|im_start|>assistant | |
| <think>' }}{% endif %}{% endfor %} |