Instructions to use moonbox-dev/flint-MLX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use moonbox-dev/flint-MLX with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("moonbox-dev/flint-MLX") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use moonbox-dev/flint-MLX with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "moonbox-dev/flint-MLX" --prompt "Once upon a time"
- Atomic Chat
8bit: chat_template.jinja
Browse files- 8bit/chat_template.jinja +61 -0
8bit/chat_template.jinja
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- macro flint_text(t) -%}
|
| 2 |
+
{%- if t is string -%}
|
| 3 |
+
{{- t | replace("\x00", "") | replace("<think>", "") | replace("</think>", "") | replace("<|begin_of_text|>", "<|begin_of_text|>") | replace("<|end_of_text|>", "<|end_of_text|>") | replace("<|system|>", "<|system|>") | replace("<|developer|>", "<|developer|>") | replace("<|user|>", "<|user|>") | replace("<|assistant|>", "<|assistant|>") | replace("<|observation|>", "<|observation|>") -}}
|
| 4 |
+
{%- else -%}
|
| 5 |
+
{{- t -}}
|
| 6 |
+
{%- endif -%}
|
| 7 |
+
{%- endmacro -%}
|
| 8 |
+
{%- set tool_preamble -%}
|
| 9 |
+
{%- if tools %}<|system|>
|
| 10 |
+
# Tools
|
| 11 |
+
|
| 12 |
+
You may call one or more functions to assist with the user query.
|
| 13 |
+
|
| 14 |
+
You are provided with function signatures within <tools></tools> XML tags:
|
| 15 |
+
<tools>
|
| 16 |
+
{%- for tool in tools %}
|
| 17 |
+
{%- set fn = tool.function if tool.function is defined else tool %}
|
| 18 |
+
{{ fn | tojson(ensure_ascii=False) }}
|
| 19 |
+
{%- endfor %}
|
| 20 |
+
</tools>
|
| 21 |
+
|
| 22 |
+
For each function call, output the function name and arguments within the following XML format:
|
| 23 |
+
<tool_call>{function-name}<arg_key>{arg-key-1}</arg_key><arg_value>{arg-value-1}</arg_value>...</tool_call>
|
| 24 |
+
{% endif -%}
|
| 25 |
+
{%- endset -%}
|
| 26 |
+
{%- set ns = namespace(tools_pending=true) -%}
|
| 27 |
+
{%- for m in messages -%}
|
| 28 |
+
{%- if ns.tools_pending and m.role != 'system' -%}
|
| 29 |
+
{{ tool_preamble }}
|
| 30 |
+
{%- set ns.tools_pending = false -%}
|
| 31 |
+
{%- endif -%}
|
| 32 |
+
{%- if m.role == 'system' -%}
|
| 33 |
+
<|system|>{{ flint_text(m.content) }}
|
| 34 |
+
{%- elif m.role == 'developer' -%}
|
| 35 |
+
<|developer|>{{ flint_text(m.content) }}
|
| 36 |
+
{%- elif m.role == 'user' -%}
|
| 37 |
+
<|user|>{{ flint_text(m.content) }}
|
| 38 |
+
{%- elif m.role == 'assistant' -%}
|
| 39 |
+
<|assistant|>
|
| 40 |
+
{%- if m.reasoning_content %}<think>{{ m.reasoning_content }}</think>{% endif -%}
|
| 41 |
+
{%- if m.content %}{{ m.content }}{% endif -%}
|
| 42 |
+
{%- if m.tool_calls -%}
|
| 43 |
+
{%- for tc in m.tool_calls -%}
|
| 44 |
+
{%- set fn = tc.function if tc.function is defined else tc -%}
|
| 45 |
+
<tool_call>{{ fn.name }}
|
| 46 |
+
{%- for k, v in fn.arguments.items() -%}
|
| 47 |
+
<arg_key>{{ k }}</arg_key><arg_value>{{ v | tojson(ensure_ascii=False) if v is not string else v }}</arg_value>
|
| 48 |
+
{%- endfor -%}
|
| 49 |
+
</tool_call>
|
| 50 |
+
{%- endfor -%}
|
| 51 |
+
{%- endif -%}
|
| 52 |
+
{%- elif m.role == 'tool' -%}
|
| 53 |
+
<|observation|><tool_response>{{ flint_text(m.content) }}</tool_response>
|
| 54 |
+
{%- endif -%}
|
| 55 |
+
{%- endfor -%}
|
| 56 |
+
{%- if ns.tools_pending -%}
|
| 57 |
+
{{ tool_preamble }}
|
| 58 |
+
{%- endif -%}
|
| 59 |
+
{%- if add_generation_prompt -%}
|
| 60 |
+
<|assistant|>
|
| 61 |
+
{%- endif -%}
|