Instructions to use CohereLabs/North-Mini-Code-1.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CohereLabs/North-Mini-Code-1.0 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CohereLabs/North-Mini-Code-1.0") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("CohereLabs/North-Mini-Code-1.0") model = AutoModelForCausalLM.from_pretrained("CohereLabs/North-Mini-Code-1.0") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use CohereLabs/North-Mini-Code-1.0 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CohereLabs/North-Mini-Code-1.0" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CohereLabs/North-Mini-Code-1.0", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/CohereLabs/North-Mini-Code-1.0
- SGLang
How to use CohereLabs/North-Mini-Code-1.0 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "CohereLabs/North-Mini-Code-1.0" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CohereLabs/North-Mini-Code-1.0", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "CohereLabs/North-Mini-Code-1.0" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CohereLabs/North-Mini-Code-1.0", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use CohereLabs/North-Mini-Code-1.0 with Docker Model Runner:
docker model run hf.co/CohereLabs/North-Mini-Code-1.0
fix interleaved reasoning
Browse files- chat_template.jinja +8 -4
chat_template.jinja
CHANGED
|
@@ -125,7 +125,11 @@ These instructions serve as your defaults, but they can be overridden in subsequ
|
|
| 125 |
{%- endif %}
|
| 126 |
{%- endmacro %}
|
| 127 |
{%- macro print_thinking(msg) %}
|
| 128 |
-
{%- if msg.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
{{ msg.thinking }}
|
| 130 |
{%- elif msg.content and msg.content[0].thinking -%}
|
| 131 |
{{ msg.content[0].thinking }}
|
|
@@ -224,7 +228,7 @@ Your output should adhere to the following json schema:
|
|
| 224 |
{% if not skip_thinking %}
|
| 225 |
{% if message.tool_plan -%}
|
| 226 |
<|START_THINKING|>{{ message.tool_plan }}<|END_THINKING|>
|
| 227 |
-
{%- elif message.thinking or (message.content and message.content[0].type == "thinking") -%}
|
| 228 |
<|START_THINKING|>{{ print_thinking(message) }}<|END_THINKING|>
|
| 229 |
{%- endif %}
|
| 230 |
{%- endif %}<|START_ACTION|>[
|
|
@@ -236,7 +240,7 @@ Your output should adhere to the following json schema:
|
|
| 236 |
|
| 237 |
]<|END_ACTION|><|END_OF_TURN_TOKEN|>
|
| 238 |
{%- else -%}
|
| 239 |
-
{% if (message.thinking or (message.content and message.content[0].type == "thinking")) and not skip_thinking -%}
|
| 240 |
<|START_THINKING|>{{ print_thinking(message) }}<|END_THINKING|>
|
| 241 |
{%- endif -%}
|
| 242 |
{{ print_msg(message) }}<|END_OF_TURN_TOKEN|>
|
|
@@ -256,4 +260,4 @@ Your output should adhere to the following json schema:
|
|
| 256 |
|
| 257 |
]<|END_TOOL_RESULT|><|END_OF_TURN_TOKEN|>
|
| 258 |
{%- endif %}
|
| 259 |
-
{%- endfor %}{%- if add_generation_prompt -%}<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>{% if reasoning %}<|START_THINKING|>{% else %}<|START_THINKING|><|END_THINKING|>{% endif %}{%- endif %}
|
|
|
|
| 125 |
{%- endif %}
|
| 126 |
{%- endmacro %}
|
| 127 |
{%- macro print_thinking(msg) %}
|
| 128 |
+
{%- if msg.reasoning -%}
|
| 129 |
+
{{ msg.reasoning }}
|
| 130 |
+
{%- elif msg.reasoning_content -%}
|
| 131 |
+
{{ msg.reasoning_content }}
|
| 132 |
+
{%- elif msg.thinking -%}
|
| 133 |
{{ msg.thinking }}
|
| 134 |
{%- elif msg.content and msg.content[0].thinking -%}
|
| 135 |
{{ msg.content[0].thinking }}
|
|
|
|
| 228 |
{% if not skip_thinking %}
|
| 229 |
{% if message.tool_plan -%}
|
| 230 |
<|START_THINKING|>{{ message.tool_plan }}<|END_THINKING|>
|
| 231 |
+
{%- elif message.reasoning or message.reasoning_content or message.thinking or (message.content and message.content[0].type == "thinking") -%}
|
| 232 |
<|START_THINKING|>{{ print_thinking(message) }}<|END_THINKING|>
|
| 233 |
{%- endif %}
|
| 234 |
{%- endif %}<|START_ACTION|>[
|
|
|
|
| 240 |
|
| 241 |
]<|END_ACTION|><|END_OF_TURN_TOKEN|>
|
| 242 |
{%- else -%}
|
| 243 |
+
{% if (message.reasoning or message.reasoning_content or message.thinking or (message.content and message.content[0].type == "thinking")) and not skip_thinking -%}
|
| 244 |
<|START_THINKING|>{{ print_thinking(message) }}<|END_THINKING|>
|
| 245 |
{%- endif -%}
|
| 246 |
{{ print_msg(message) }}<|END_OF_TURN_TOKEN|>
|
|
|
|
| 260 |
|
| 261 |
]<|END_TOOL_RESULT|><|END_OF_TURN_TOKEN|>
|
| 262 |
{%- endif %}
|
| 263 |
+
{%- endfor %}{%- if add_generation_prompt -%}<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>{% if reasoning %}<|START_THINKING|>{% else %}<|START_THINKING|><|END_THINKING|>{% endif %}{%- endif %}
|