Mikrodev commited on
Commit
347f4a5
·
verified ·
1 Parent(s): 52b13f1

Upload Modelfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Modelfile +64 -0
Modelfile ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # stcoder-qwen35-9b - Ollama Modelfile (one file for every quantisation of this model)
2
+ # Repo: https://huggingface.co/Mikrodev/stcoder-qwen35-9b-gguf
3
+ #
4
+ # The FROM line below points at the recommended Q8_0 build (qwen35_9b-tc.q8_0.gguf).
5
+ # If you downloaded a DIFFERENT quantisation, change that one line to its filename:
6
+ # FROM ./qwen35_9b-tc.q6_k.gguf (Q6_K, 7.04 GiB)
7
+ # FROM ./qwen35_9b-tc.q4_k_m.gguf (Q4_K_M, 5.38 GiB)
8
+ #
9
+ # 1) put this file next to the GGUF you downloaded (and edit FROM if needed)
10
+ # 2) ollama create stcoder-qwen35-9b:<quant> -f Modelfile e.g. ollama create stcoder-qwen35-9b:q8_0 -f Modelfile
11
+ # 3) ollama run stcoder-qwen35-9b:<quant> "Motor starts 5 seconds after the start button; stop and E-stop drop it."
12
+ #
13
+ # Requires Ollama 0.32.3 or newer.
14
+ # num_ctx 8192 matches the sequence length this model was fine-tuned at.
15
+ # Published numbers were measured greedily (temperature 0, seed 42) at num_ctx 16384 / num_predict 8192. The values below are the interactive defaults; match those to reproduce the numbers exactly.
16
+ # Ollama 0.32.3 or newer is REQUIRED: earlier builds (0.24 tested) fail to load this architecture. The GGUF is fine - the loader was not.
17
+ # This family reasons before answering and the thinking is drawn from the same budget, which is why num_predict is 8192 here and not 2048. That is the configuration every published number for this model was measured under - reasoning on.
18
+ # One reply in fifteen spent the whole budget thinking and returned no code. If you would rather trade that risk for speed, you can suppress the reasoning by adding an empty <think></think> pair after the final <|im_start|>assistant line in the TEMPLATE above - but note that we did not evaluate the model in that mode.
19
+
20
+ FROM ./qwen35_9b-tc.q8_0.gguf
21
+
22
+ TEMPLATE """{{- if .System }}<|im_start|>system
23
+ {{ .System }}<|im_end|>
24
+ {{ end }}
25
+ {{- range .Messages }}
26
+ {{- if eq .Role "user" }}<|im_start|>user
27
+ {{ .Content }}<|im_end|>
28
+ {{ else if eq .Role "assistant" }}<|im_start|>assistant
29
+ {{ .Content }}<|im_end|>
30
+ {{ end }}
31
+ {{- end }}<|im_start|>assistant
32
+ """
33
+
34
+ PARAMETER stop "<|im_end|>"
35
+ PARAMETER stop "<|endoftext|>"
36
+ PARAMETER stop "<|im_start|>"
37
+
38
+ PARAMETER temperature 0.2
39
+ PARAMETER top_p 0.95
40
+ PARAMETER top_k 20
41
+ PARAMETER min_p 0.0
42
+ PARAMETER repeat_penalty 1.0
43
+ PARAMETER num_ctx 8192
44
+ PARAMETER num_predict 8192
45
+
46
+ SYSTEM """You are STCoder, a conversational coding assistant for the Mikrodev LogicStudio IDE and an expert in IEC 61131-3 Structured Text. You help the user design and understand PLC logic entirely through chat — you do not call tools. Answer the user's message directly and helpfully, and explain briefly when it aids understanding. When the user asks for logic, provide correct, body-only Structured Text in the Mikrodev dialect inside an ```iecst code block, then remind the user to compile it in the IDE.
47
+
48
+ Mikrodev Structured Text rules (always follow):
49
+ - UPPERCASE keywords (IF/THEN/VAR/END_IF); lowercase or mixed case is forbidden
50
+ - Close every block: END_IF / END_FOR / END_CASE / END_WHILE / END_REPEAT; every statement ends with `;`
51
+ - Positional function-block calls only — TON(bStart, 5000); named parameters (IN :=, PT :=) and `=>` are forbidden
52
+ - Read FB outputs via dot notation: bOut := tDelay.Q;
53
+ - Body only — never write POU wrappers (PROGRAM / FUNCTION_BLOCK ... END_*)
54
+ - No TIME literals (T#5s) — use INT milliseconds with VAR CONSTANT (5000 = 5 s, 500 = 500 ms)
55
+ - `:=` assign, `=` compare, `<>` not-equal; AND / OR / NOT / XOR / MOD
56
+ - ENUM and 1-D ARRAY allowed; STRING, STRUCT, TYPE alias, FUNCTION definitions, POINTER, pragmas, VAR_GLOBAL / VAR_EXTERNAL / VAR RETAIN / VAR PERSISTENT are forbidden
57
+ - No explicit casts (INT_TO_REAL, TO_INT) and no MIN / MAX / LIMIT / SEL / `**`
58
+ - No direct addresses (%IX, %QW) — use symbolic names
59
+ - No `/* */` C-style comments — use (* *) or //
60
+ - Do not nest comments — write each comment once, e.g. (* text *), never (* (* text *) *)
61
+ - Identifiers are ASCII; keywords, identifiers and all code comments are written in English; only your conversational prose may match the user's language
62
+ - Politely decline non-PLC requests
63
+
64
+ Keep answers focused and practical."""