Instructions to use introvoyz041/Devstral-Small-2505-MLX-6bit-mlx-4Bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use introvoyz041/Devstral-Small-2505-MLX-6bit-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("introvoyz041/Devstral-Small-2505-MLX-6bit-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) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use introvoyz041/Devstral-Small-2505-MLX-6bit-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 "introvoyz041/Devstral-Small-2505-MLX-6bit-mlx-4Bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "introvoyz041/Devstral-Small-2505-MLX-6bit-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": "introvoyz041/Devstral-Small-2505-MLX-6bit-mlx-4Bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Atomic Chat
Upload chat_template.jinja with huggingface_hub
Browse files- chat_template.jinja +25 -0
chat_template.jinja
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- set today = strftime_now("%Y-%m-%d") %}
|
| 2 |
+
{%- set default_system_message = "You are Devstral, a Large Language Model (LLM) created by Mistral AI, a French startup headquartered in Paris.\nYour knowledge base was last updated on 2023-10-01. The current date is " + today + ".\n\nWhen you're not sure about some information, you say that you don't have the information and don't make up anything.\nIf the user's question is not clear, ambiguous, or does not provide enough context for you to accurately answer the question, you do not try to answer it right away and you rather ask the user to clarify their request (e.g. \"What are some good restaurants around me?\" => \"Where are you?\" or \"When is the next flight to Tokyo\" => \"Where do you travel from?\")" %}
|
| 3 |
+
|
| 4 |
+
{{- bos_token }}
|
| 5 |
+
|
| 6 |
+
{%- if messages[0]['role'] == 'system' %}
|
| 7 |
+
{%- set system_message = messages[0]['content'] %}
|
| 8 |
+
{%- set loop_messages = messages[1:] %}
|
| 9 |
+
{%- else %}
|
| 10 |
+
{%- set system_message = default_system_message %}
|
| 11 |
+
{%- set loop_messages = messages %}
|
| 12 |
+
{%- endif %}
|
| 13 |
+
{{- '[SYSTEM_PROMPT]' + system_message + '[/SYSTEM_PROMPT]' }}
|
| 14 |
+
|
| 15 |
+
{%- for message in loop_messages %}
|
| 16 |
+
{%- if message['role'] == 'user' %}
|
| 17 |
+
{{- '[INST]' + message['content'] + '[/INST]' }}
|
| 18 |
+
{%- elif message['role'] == 'system' %}
|
| 19 |
+
{{- '[SYSTEM_PROMPT]' + message['content'] + '[/SYSTEM_PROMPT]' }}
|
| 20 |
+
{%- elif message['role'] == 'assistant' %}
|
| 21 |
+
{{- message['content'] + eos_token }}
|
| 22 |
+
{%- else %}
|
| 23 |
+
{{- raise_exception('Only user, system and assistant roles are supported!') }}
|
| 24 |
+
{%- endif %}
|
| 25 |
+
{%- endfor %}
|