Instructions to use mlx-community/OpenCodeInterpreter-DS-33B-hf-4bit-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/OpenCodeInterpreter-DS-33B-hf-4bit-mlx 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/OpenCodeInterpreter-DS-33B-hf-4bit-mlx") 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/OpenCodeInterpreter-DS-33B-hf-4bit-mlx 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/OpenCodeInterpreter-DS-33B-hf-4bit-mlx"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "mlx-community/OpenCodeInterpreter-DS-33B-hf-4bit-mlx" # 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/OpenCodeInterpreter-DS-33B-hf-4bit-mlx", "messages": [ {"role": "user", "content": "Hello"} ] }'
Update tokenizer_config.json
Browse files- tokenizer_config.json +2 -1
tokenizer_config.json
CHANGED
|
@@ -190,5 +190,6 @@
|
|
| 190 |
"split_special_tokens": false,
|
| 191 |
"tokenizer_class": "LlamaTokenizer",
|
| 192 |
"unk_token": null,
|
| 193 |
-
"use_default_system_prompt": true
|
|
|
|
| 194 |
}
|
|
|
|
| 190 |
"split_special_tokens": false,
|
| 191 |
"tokenizer_class": "LlamaTokenizer",
|
| 192 |
"unk_token": null,
|
| 193 |
+
"use_default_system_prompt": true,
|
| 194 |
+
"chat_template": "{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% else %}{% set loop_messages = messages %}{% set system_message = false %}{% endif %}{% for message in loop_messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if loop.index0 == 0 and system_message != false %}{% set content = '<<SYS>>\\n' + system_message + '\\n<</SYS>>\\n\\n' + message['content'] %}{% else %}{% set content = message['content'] %}{% endif %}{% if message['role'] == 'user' %}{{ bos_token + '[INST] ' + content.strip() + ' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ ' ' + content.strip() + ' ' + eos_token }}{% endif %}{% endfor %}"
|
| 195 |
}
|