anyze commited on
Commit
4b01eec
·
verified ·
1 Parent(s): fdf410d

Add F16 GGUF + tool-aware Modelfile for local runtimes (Ollama/LM Studio/llama.cpp)

Browse files
.gitattributes CHANGED
@@ -34,3 +34,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  tokenizer.json filter=lfs diff=lfs merge=lfs -text
 
 
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  tokenizer.json filter=lfs diff=lfs merge=lfs -text
37
+ gguf/Ze1.5-1.5B-Automotive-Embedded-Instruct-F16.gguf filter=lfs diff=lfs merge=lfs -text
gguf/Modelfile ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ./Ze1.5-1.5B-Automotive-Embedded-Instruct-F16.gguf
2
+ # Tool-aware ChatML template. Two reasons it must reference .Tools:
3
+ # 1) Ollama sets the model's "tools" capability ONLY if the template has a .Tools node — that's
4
+ # what makes GitHub Copilot (and other clients) show Tools / agent mode for this model.
5
+ # 2) When a client passes tools, they're rendered into the system `# Tools` block in the exact
6
+ # format this model expects.
7
+ # NOTE: this model emits tool calls as a ```json code block (not a special tool-call token), so the
8
+ # tool instruction AND the assistant .ToolCalls rendering use a ```json fence, and tool results
9
+ # come back as <tool_response> in a user turn.
10
+ TEMPLATE """{{- if .Messages }}
11
+ {{- if or .System .Tools }}<|im_start|>system
12
+ {{- if .System }}
13
+ {{ .System }}
14
+ {{- end }}
15
+ {{- if .Tools }}
16
+
17
+ # Tools
18
+
19
+ You may call one or more functions to assist with the user query.
20
+
21
+ You are provided with function signatures within <tools></tools> XML tags:
22
+ <tools>
23
+ {{- range .Tools }}
24
+ {"type": "function", "function": {{ .Function }}}
25
+ {{- end }}
26
+ </tools>
27
+
28
+ To call a function, output a ```json code block containing a JSON object with the function name and arguments, then stop:
29
+ ```json
30
+ {"name": <function-name>, "arguments": <args-json-object>}
31
+ ```
32
+ {{- end }}<|im_end|>
33
+ {{ end }}
34
+ {{- range $i, $_ := .Messages }}
35
+ {{- $last := eq (len (slice $.Messages $i)) 1 -}}
36
+ {{- if eq .Role "user" }}<|im_start|>user
37
+ {{ .Content }}<|im_end|>
38
+ {{ else if eq .Role "assistant" }}<|im_start|>assistant
39
+ {{ if .Content }}{{ .Content }}
40
+ {{- else if .ToolCalls }}```json
41
+ {{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
42
+ {{ end }}```
43
+ {{- end }}{{ if not $last }}<|im_end|>
44
+ {{ end }}
45
+ {{- else if eq .Role "tool" }}<|im_start|>user
46
+ <tool_response>
47
+ {{ .Content }}
48
+ </tool_response><|im_end|>
49
+ {{ end }}
50
+ {{- if and (ne .Role "assistant") $last }}<|im_start|>assistant
51
+ {{ end }}
52
+ {{- end }}
53
+ {{- else }}
54
+ {{- if .System }}<|im_start|>system
55
+ {{ .System }}<|im_end|>
56
+ {{ end }}{{ if .Prompt }}<|im_start|>user
57
+ {{ .Prompt }}<|im_end|>
58
+ {{ end }}<|im_start|>assistant
59
+ {{ end }}{{ .Response }}"""
60
+ SYSTEM """You are Ze1.5, an embedded-systems and automotive firmware specialist: C/C++, MCUs, RTOS, drivers/peripherals (UART/SPI/I2C/CAN/LIN/Ethernet), ISRs, UDS/OBD diagnostics, MISRA C, and AUTOSAR (Classic and Adaptive Platform). Answer precisely and, when a tool is provided and useful, call it."""
61
+ PARAMETER temperature 0.7
62
+ PARAMETER top_p 0.8
63
+ PARAMETER top_k 20
64
+ PARAMETER repeat_penalty 1.1
65
+ # Copilot/agent clients send large prompts (system + tool defs + file context). Default num_ctx
66
+ # 4096 truncates those; 16384 fits a typical agent turn on 8 GB (weights ~3GB + KV ~0.5GB).
67
+ PARAMETER num_ctx 16384
68
+ PARAMETER stop "<|im_end|>"
69
+ PARAMETER stop "<|im_start|>"
gguf/README.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Anyze Ze1.5 Instruct — GGUF (Ollama / LM Studio / llama.cpp)
2
+
3
+ This folder contains the model in GGUF for local runtimes:
4
+
5
+ - `Ze1.5-1.5B-Automotive-Embedded-Instruct-F16.gguf` — F16 weights (~3.1 GB).
6
+ - `Modelfile` — tool-aware ChatML template + default system prompt and sampling.
7
+
8
+ Ze1.5 is a 1.5B automotive/embedded specialist (C/C++, MCUs, RTOS, CAN/LIN, UDS,
9
+ MISRA, AUTOSAR) that also handles everyday Python, Linux/systems, and shell work,
10
+ with agentic tool calling. Context window 128k (YaRN); a large KV-cache needs several
11
+ GB, so size `num_ctx` to your hardware.
12
+
13
+ ## Ollama
14
+
15
+ From this folder:
16
+
17
+ ```bash
18
+ ollama create ze1_5-embedded -f Modelfile
19
+ ollama run ze1_5-embedded "Write a ring buffer in C for a UART RX ISR"
20
+ ```
21
+
22
+ The `Modelfile` template exposes the model's **tools** capability, so agent clients
23
+ (e.g. GitHub Copilot) can pass tool definitions and get `json`-fenced tool calls back.
24
+ Override the default system prompt with `/set system "..."` in a running session.
25
+
26
+ ## LM Studio
27
+
28
+ Load the GGUF directly — the ChatML chat template is embedded, so no manual
29
+ prompt-format setup is needed. Set the system prompt to match your task; suggested
30
+ sampling is `temperature 0.7, top_p 0.8, top_k 20, repeat_penalty 1.1`.
31
+
32
+ ## Rebuild / quantize with llama.cpp
33
+
34
+ To regenerate the GGUF from the `../huggingface` export, or make a smaller quant:
35
+
36
+ ```bash
37
+ git clone https://github.com/ggerganov/llama.cpp
38
+ pip install -r llama.cpp/requirements.txt
39
+
40
+ # F16 GGUF from the HF export
41
+ python llama.cpp/convert_hf_to_gguf.py ../huggingface \
42
+ --outfile Ze1.5-1.5B-Automotive-Embedded-Instruct-F16.gguf --outtype f16
43
+
44
+ # optional: quantize (build llama.cpp tools first)
45
+ ./llama.cpp/build/bin/llama-quantize \
46
+ Ze1.5-1.5B-Automotive-Embedded-Instruct-F16.gguf \
47
+ Ze1.5-1.5B-Automotive-Embedded-Instruct-Q4_K_M.gguf Q4_K_M
48
+ ```
49
+
50
+ Then point the `Modelfile` `FROM` at whichever GGUF you built.
51
+
52
+ Licensed under Apache-2.0 (see `../huggingface/LICENSE`). Always review generated
53
+ code before flashing to hardware.
gguf/Ze1.5-1.5B-Automotive-Embedded-Instruct-F16.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2632d19c1abeabfbf4134bc48b94f49c699988455a5e91592e2b75f5d2a44be9
3
+ size 3093669280