Views
No views yet
cohere2moe architecture, which is not in a stock llama.cpp release yet. Until llama.cpp PR #24260 is merged, build llama.cpp from that PR branch to load these files. Once the PR lands in a release, these same GGUFs will run on stock llama.cpp with no re-download, because they already declare general.architecture = cohere2moe.1git clone https://github.com/ggml-org/llama.cpp
2cd llama.cpp
3git fetch origin pull/24260/head:cohere2-moe
4git checkout cohere2-moe
5
6# CUDA build. Drop -DGGML_CUDA=ON for a CPU only build.
7cmake -B build -DGGML_CUDA=ON
8cmake --build build --config Release -jbuild/bin/ (llama-cli, llama-server, llama-quantize).1pip install huggingface_hub
2
3hf download unsloth/North-Mini-Code-1.0-GGUF \
4 --include "North-Mini-Code-1.0-UD-Q4_K_XL.gguf" \
5 --local-dir North-Mini-Code-1.0-GGUFBF16/, which is split into two shards. To use a split set, download the whole folder and point llama.cpp at the first shard (...-00001-of-00002.gguf); it loads the rest automatically.1./build/bin/llama-cli \
2 --model North-Mini-Code-1.0-GGUF/North-Mini-Code-1.0-UD-Q4_K_XL.gguf \
3 --jinja \
4 --n-gpu-layers 99 \
5 --ctx-size 16384 \
6 --temp 1.0 --top-p 0.95 \
7 -p "Write a python program to check if a string is a palindrome."1./build/bin/llama-server \
2 --model North-Mini-Code-1.0-GGUF/North-Mini-Code-1.0-UD-Q4_K_XL.gguf \
3 --jinja \
4 --n-gpu-layers 99 \
5 --ctx-size 16384 \
6 --host 0.0.0.0 --port 80801curl http://localhost:8080/v1/chat/completions \
2 -H "Content-Type: application/json" \
3 -d '{
4 "messages": [{"role": "user", "content": "Write a python program to check if a string is a palindrome."}],
5 "temperature": 1.0,
6 "top_p": 0.95
7 }'--jinja so the model chat template, including tool calling, is applied.temperature=1.0 and top_p=0.95.--n-gpu-layers 99 to offload all layers to GPU, or lower it to fit your VRAM. Use --ctx-size to set the context window (the model supports up to 256K).imatrix_unsloth.gguf_file is the importance matrix used to build these quants. It is not a model and is not loaded at runtime.
1# pip install transformers
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4model_id = "CohereLabs/North-Mini-Code-1.0"
5tokenizer = AutoTokenizer.from_pretrained(model_id)
6model = AutoModelForCausalLM.from_pretrained(model_id)
7
8prompt = "Write a python program to check if a string is a palindrome or not."
9
10# Format message with the North-Mini-Code-1.0 chat template
11messages = [{"role": "user", "content": prompt}]
12input_ids = tokenizer.apply_chat_template(
13 messages,
14 tokenize=True,
15 add_generation_prompt=True,
16 return_tensors="pt",
17)
18
19gen_tokens = model.generate(
20 **input_ids,
21 max_new_tokens=1024,
22 do_sample=True,
23 temperature=1.0,
24 top_p=0.95
25)
26
27gen_text = tokenizer.decode(gen_tokens[0])
28print(gen_text)pipeline abstraction:1from transformers import pipeline
2import torch
3
4model_id = "CohereLabs/North-Mini-Code-1.0"
5
6prompt = """Given a list of unique words each of size k and an n sized word, w, where n is a multiple of k,
7Write a program in python to determine the number of unique combinations of words in the list that can be concatenated to form an anagram of the word w.
8"""
9
10pipe = pipeline(
11 "text-generation",
12 model=model_id,
13 torch_dtype="auto",
14 device_map="auto",
15)
16
17messages = [
18 {"role": "user", "content": f"{prompt}"},
19]
20
21text = tokenizer.apply_chat_template(
22 messages,
23 tokenize=False,
24 add_generation_prompt=True,
25)
26
27
28outputs = pipe(
29 messages,
30 max_new_tokens=1024,
31 do_sample=True,
32 temperature=1.0,
33 top_p=0.95
34
35)
36
37print(outputs[0]["generated_text"][-1])
381# Define tools
2tools = [{
3 "type": "function",
4 "function": {
5 "name": "bash",
6 "description": "Execute a bash command in the terminal.",
7 "parameters": {
8 "type": "object",
9 "properties": {
10 "command": {
11 "description": "The bash command to execute.",
12 "type": "string"
13 }
14 },
15 "required": ["command"]
16 },
17 }
18}]
19
20# Define conversation input
21conversation = [{"role": "user", "content": "Find out if there is any json file in this folder"}]
22
23
24# Get the Tool Use prompt
25input_prompt = tokenizer.apply_chat_template(conversation=conversation, tools=tools, tokenize=False, add_generation_prompt=True, return_tensors="pt")
26
27# Tokenize the prompt
28input_ids = tokenizer(input_prompt, return_tensors="pt")1# Pass on the tool_call and thinking
2tool_call = {"name": "bash", "arguments": {"command": "ls -al"}}
3reasoning = "The user wants to find if there are any JSON files in the current folder. I should use the `ls` command to list files and then check if there are any JSON files (files ending with .json). Let me first list the files in the current directory."
4
5conversation.append({"role": "assistant", "tool_calls": [{"id": "0", "type": "function", "function": tool_call}], "reasoning": reasoning})1# This needs to be a dictionary
2tool_result = {"stdout": "test.json\ntest.py", "return_code": "0"}
3
4# Append tool results
5conversation.append({"role": "tool", "tool_call_id": "0", "content": tool_result})generate() again to let the model use the tool result in the chat.1uv pip install "git+https://github.com/vllm-project/vllm.git"
2uv pip install cohere_melody>=0.9.01vllm serve CohereLabs/North-Mini-Code-1.0 \
2 -tp 2 \
3 --max-model-len 320000 \
4 --tool-call-parser cohere_command4 \
5 --reasoning-parser cohere_command4 \
6 --enable-auto-tool-choice1# Example commands to install on linux
2git clone https://github.com/anomalyco/opencode.gitcd opencode
3
4# Install Bun
5curl -fsSL https://bun.sh/install | bash
6export BUN_INSTALL="$HOME/.bun"
7export PATH="$BUN_INSTALL/bin:$PATH"
8
9# node-gyp was needed by a dependency
10bun add -g node-gyp
11
12# Install dependencies
13bun install
14
15# Build CLI
16bun run --cwd packages/opencode build/usr/bin/install -m 755 \
17 ./opencode/packages/opencode/dist/opencode-linux-x64/bin/opencode \
18 /root/.local/bin/opencode1{
2 "$schema": "https://opencode.ai/config.json",
3 "model": "vllm/CohereLabs/North-Mini-Code-1.0",
4 "provider": {
5 "vllm": {
6 "npm": "@ai-sdk/openai-compatible",
7 "name": "Local vLLM server",
8 "options": {
9 "baseURL": "http://127.0.0.1:8000/v1",
10 "apiKey": "EMPTY"
11 },
12 "models": {
13 "North-Mini-Code-1.0": {
14 "name": "North-Mini-Code-1.0",
15 "interleaved": {
16 "field": "reasoning"
17 },
18 "limit": {
19 "context": 256000,
20 "output": 64000
21 }
22 }
23 }
24 }
25 }
26}
27