bfuzzy1 commited on
Commit
78d2164
·
verified ·
1 Parent(s): 5d29b8d

Upload 13 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip 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
 
 
33
  *.zip 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
chat_template.jinja ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if message.content is string %}
27
+ {%- set content = message.content %}
28
+ {%- else %}
29
+ {%- set content = '' %}
30
+ {%- endif %}
31
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
32
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
33
+ {%- elif message.role == "assistant" %}
34
+ {%- set reasoning_content = '' %}
35
+ {%- if message.reasoning_content is string %}
36
+ {%- set reasoning_content = message.reasoning_content %}
37
+ {%- else %}
38
+ {%- if '</think>' in content %}
39
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
40
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
41
+ {%- endif %}
42
+ {%- endif %}
43
+ {%- if loop.index0 > ns.last_query_index %}
44
+ {%- if loop.last or (not loop.last and reasoning_content) %}
45
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
46
+ {%- else %}
47
+ {{- '<|im_start|>' + message.role + '\n' + content }}
48
+ {%- endif %}
49
+ {%- else %}
50
+ {{- '<|im_start|>' + message.role + '\n' + content }}
51
+ {%- endif %}
52
+ {%- if message.tool_calls %}
53
+ {%- for tool_call in message.tool_calls %}
54
+ {%- if (loop.first and content) or (not loop.first) %}
55
+ {{- '\n' }}
56
+ {%- endif %}
57
+ {%- if tool_call.function %}
58
+ {%- set tool_call = tool_call.function %}
59
+ {%- endif %}
60
+ {{- '<tool_call>\n{"name": "' }}
61
+ {{- tool_call.name }}
62
+ {{- '", "arguments": ' }}
63
+ {%- if tool_call.arguments is string %}
64
+ {{- tool_call.arguments }}
65
+ {%- else %}
66
+ {{- tool_call.arguments | tojson }}
67
+ {%- endif %}
68
+ {{- '}\n</tool_call>' }}
69
+ {%- endfor %}
70
+ {%- endif %}
71
+ {{- '<|im_end|>\n' }}
72
+ {%- elif message.role == "tool" %}
73
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
74
+ {{- '<|im_start|>user' }}
75
+ {%- endif %}
76
+ {{- '\n<tool_response>\n' }}
77
+ {{- content }}
78
+ {{- '\n</tool_response>' }}
79
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
80
+ {{- '<|im_end|>\n' }}
81
+ {%- endif %}
82
+ {%- endif %}
83
+ {%- endfor %}
84
+ {%- if add_generation_prompt %}
85
+ {{- '<|im_start|>assistant\n' }}
86
+ {%- if enable_thinking is defined and enable_thinking is false %}
87
+ {{- '<think>\n\n</think>\n\n' }}
88
+ {%- endif %}
89
+ {%- endif %}
claude-code/build_from_raw.py ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Build TinyGuide dataset from RAW Claude Code transcripts (not skeletons).
2
+
3
+ Raw transcripts keep full tool inputs AND results — tracebacks, grep output,
4
+ test pass/fail, error text — which the skeleton dropped. That lets every rule
5
+ fire with real signal. One {prompt, completion} row per tool call.
6
+
7
+ Usage:
8
+ python build_from_raw.py [glob ...]
9
+ (default sources: ~/.claude/projects/**/*.jsonl and /tmp/cc*/**/*.jsonl)
10
+ """
11
+ import json, re, sys, glob, os, collections, random
12
+ from pathlib import Path
13
+
14
+ sys.path.insert(0, str(Path(__file__).parent))
15
+ from label_rules import choose_label, HINTS
16
+ from format_prompt import format_prompt
17
+
18
+ random.seed(0)
19
+ ROOT = Path(__file__).resolve().parents[1]
20
+ OUT = ROOT / "data"
21
+
22
+ TEST_RE = re.compile(r"\b(pytest|npm test|pnpm test|yarn test|cargo test|go test|bun test|unittest|jest|vitest|tox)\b")
23
+ PY_TB_RE = re.compile(r'File "([^"]+\.\w+)", line \d+')
24
+ PYTEST_PATH_RE = re.compile(r"\b([\w./-]+\.\w+):\d+\b")
25
+ TEST_FAIL_RE = re.compile(r"\b(FAILED|failed|AssertionError|Error|Traceback|\d+ failed|exit code [1-9])", re.I)
26
+ TEST_PASS_RE = re.compile(r"\b(\d+ passed|all tests passed|PASSED|\bOK\b|0 failed)\b")
27
+ ENV_RE = re.compile(r"command not found|ModuleNotFoundError|No module named|is not recognized|ENOENT|cannot find module|: not found", re.I)
28
+ NOTREAD_RE = re.compile(r"not been read yet|Read it first", re.I)
29
+ SYMBOL_RE = re.compile(r"(?:NameError|AttributeError|ImportError|cannot import name).*?['\"`](\w+)['\"`]")
30
+
31
+
32
+ def result_text(content):
33
+ if isinstance(content, str):
34
+ return content
35
+ if isinstance(content, list):
36
+ return " ".join(x.get("text", "") for x in content if isinstance(x, dict))
37
+ return str(content or "")
38
+
39
+
40
+ def iter_pairs(path):
41
+ """Yield (tool_name, input_dict, result_text, is_error) in order."""
42
+ pending = {}
43
+ try:
44
+ rows = [json.loads(l) for l in open(path) if l.strip()]
45
+ except Exception:
46
+ return
47
+ goal = ""
48
+ for r in rows:
49
+ msg = r.get("message", {}) or {}
50
+ content = msg.get("content")
51
+ if r.get("type") == "user" and isinstance(content, str) and not goal:
52
+ goal = content.strip()
53
+ if not isinstance(content, list):
54
+ continue
55
+ for c in content:
56
+ if not isinstance(c, dict):
57
+ continue
58
+ if c.get("type") == "text" and not goal and r.get("type") == "user":
59
+ goal = c.get("text", "").strip()
60
+ if c.get("type") == "tool_use":
61
+ pending[c.get("id")] = (c.get("name"), c.get("input", {}) or {})
62
+ if c.get("type") == "tool_result":
63
+ tid = c.get("tool_use_id")
64
+ if tid in pending:
65
+ name, inp = pending.pop(tid)
66
+ yield goal, name, inp, result_text(c.get("content")), bool(c.get("is_error"))
67
+
68
+
69
+ def first_path(text):
70
+ m = PY_TB_RE.search(text) or PYTEST_PATH_RE.search(text)
71
+ return m.group(1) if m else None
72
+
73
+
74
+ def session_rows(path):
75
+ state = {
76
+ "observed_files": [], "edited_files": [], "traceback_paths": [],
77
+ "command_history": [], "last_test_status": "unknown",
78
+ "code_changed_since_last_test": False, "traceback_symbols": [],
79
+ "last_failure_type": None, "last_error_signature": None,
80
+ "previous_error_signature": None, "last_search_result_class": None,
81
+ "last_test_failed_same_error_after_edit": False,
82
+ }
83
+ traj, rows, goal_final = [], [], "Continue the task."
84
+ for goal, name, inp, res, is_err in iter_pairs(path):
85
+ goal_final = goal or goal_final
86
+ prop = {"name": name, "args": inp}
87
+ # NOTE: no back-to-back cooldown here. Cooldown is a RUNTIME hook
88
+ # concern; baking it into labels gives identical signal patterns two
89
+ # different labels (VERIFY vs NO_HINT) -> ambiguous supervision ->
90
+ # model collapses to NO_HINT on real prompts. Label the true rule.
91
+ key = choose_label(state, prop)
92
+ prompt = format_prompt(goal_final, traj, state, prop)
93
+ rows.append({"key": key, "prompt": prompt, "completion": HINTS[key]})
94
+ _advance(state, traj, name, inp, res, is_err)
95
+ return rows
96
+
97
+
98
+ def _advance(state, traj, name, inp, res, is_err):
99
+ fp = inp.get("file_path")
100
+ cmd = inp.get("command", "") or inp.get("pattern", "")
101
+ short = (fp or cmd or json.dumps(inp))[:60]
102
+ traj.append({"tool": name, "arg": short,
103
+ "result": ("ERR " + res[:70]) if is_err else (res[:70] or "ok")})
104
+ if len(traj) > 14:
105
+ del traj[0]
106
+
107
+ if name == "Read" and fp and not is_err:
108
+ state["observed_files"].append(fp)
109
+ if name in {"Edit", "Write", "MultiEdit", "NotebookEdit"} and fp:
110
+ if NOTREAD_RE.search(res):
111
+ return # failed edit; nothing changed, state already triggered the hint
112
+ state["edited_files"].append(fp)
113
+ if fp not in state["observed_files"]:
114
+ state["observed_files"].append(fp)
115
+ state["code_changed_since_last_test"] = True
116
+ if name in {"Grep", "Glob"}:
117
+ n = len(re.findall(r"\n", res))
118
+ state["last_search_result_class"] = ("search_no_results" if not res.strip()
119
+ else "search_many_results" if n > 30 else "search_few")
120
+ if name == "Bash":
121
+ state["command_history"].append(cmd)
122
+ sig = (res.strip().splitlines() or [""])[-1][:80]
123
+ # failure type reflects only THIS command's result (not sticky)
124
+ state["last_failure_type"] = "missing_package" if ENV_RE.search(res) else None
125
+ if TEST_RE.search(cmd):
126
+ if TEST_FAIL_RE.search(res) and not TEST_PASS_RE.search(res):
127
+ state["last_test_status"] = "failed"
128
+ tb = first_path(res)
129
+ if tb:
130
+ state["traceback_paths"].append(tb)
131
+ sym = SYMBOL_RE.search(res)
132
+ if sym:
133
+ state["traceback_symbols"].append(sym.group(1))
134
+ state["last_test_failed_same_error_after_edit"] = (sig == state.get("last_error_signature"))
135
+ else:
136
+ state["last_test_status"] = "passed"
137
+ state["last_failure_type"] = None
138
+ state["code_changed_since_last_test"] = False
139
+ if is_err or TEST_FAIL_RE.search(res):
140
+ state["previous_error_signature"] = state.get("last_error_signature")
141
+ state["last_error_signature"] = sig
142
+
143
+
144
+ def main():
145
+ pats = sys.argv[1:] or [
146
+ os.path.expanduser("~/.claude/projects/**/*.jsonl"),
147
+ "/tmp/cc*/**/*.jsonl", "/tmp/cc*/*.jsonl",
148
+ "/tmp/mimo/**/*.jsonl",
149
+ ]
150
+ files = sorted({f for p in pats for f in glob.glob(p, recursive=True)})
151
+ print(f"transcripts found: {len(files)}")
152
+
153
+ sessions = []
154
+ for f in files:
155
+ rs = session_rows(f)
156
+ if rs:
157
+ sessions.append((Path(f).stem, rs))
158
+ print(f"sessions with tool calls: {len(sessions)}")
159
+
160
+ random.shuffle(sessions)
161
+ split = int(len(sessions) * 0.9)
162
+
163
+ def emit(sess, path, balance):
164
+ allrows = [r for _sid, rs in sess for r in rs]
165
+ # drop consecutive duplicate hints within nothing -> dedup globally per session done below
166
+ hints = [r for r in allrows if r["key"] != "NO_HINT"]
167
+ nohint = [r for r in allrows if r["key"] == "NO_HINT"]
168
+ random.shuffle(hints); random.shuffle(nohint)
169
+ if balance and hints:
170
+ # cap any single hint class to 35% of hints to avoid one rule dominating
171
+ cap = max(50, int(len(hints) * 0.35))
172
+ seen = collections.Counter(); kept = []
173
+ for r in hints:
174
+ if seen[r["key"]] < cap:
175
+ kept.append(r); seen[r["key"]] += 1
176
+ hints = kept
177
+ # target ~75% NO_HINT
178
+ keep_no = min(len(nohint), int(len(hints) / 0.25 * 0.75))
179
+ nohint = nohint[:keep_no]
180
+ out = hints + nohint
181
+ random.shuffle(out)
182
+ with open(path, "w") as fh:
183
+ for r in out:
184
+ fh.write(json.dumps({"prompt": r["prompt"], "completion": r["completion"]}) + "\n")
185
+ return out
186
+
187
+ OUT.mkdir(exist_ok=True)
188
+ tr = emit(sessions[:split], OUT / "train.jsonl", balance=True)
189
+ va = emit(sessions[split:], OUT / "valid.jsonl", balance=True)
190
+
191
+ # dump ALL rows (unbalanced, with key), session-split preserved, for build_scaled.py
192
+ def dump_all(sess, path):
193
+ with open(path, "w") as fh:
194
+ for sid, rs in sess:
195
+ for r in rs:
196
+ fh.write(json.dumps({"key": r["key"], "prompt": r["prompt"],
197
+ "completion": r["completion"],
198
+ "source": "real", "session_id": sid}) + "\n")
199
+ dump_all(sessions[:split], OUT / "all_train.jsonl")
200
+ dump_all(sessions[split:], OUT / "all_valid.jsonl")
201
+
202
+ def dist(rows):
203
+ c = collections.Counter("NO_HINT" if r["completion"] == "NO_HINT" else "HINT" for r in rows)
204
+ return dict(c)
205
+ print(f"train rows: {len(tr)} {dist(tr)}")
206
+ print(f"valid rows: {len(va)} {dist(va)}")
207
+ spread = collections.Counter(r["completion"][:34] for _sid, rs in sessions for r in rs)
208
+ print("label spread (all sessions, pre-balance):")
209
+ for k, n in spread.most_common():
210
+ print(f" {n:6d} {k}")
211
+
212
+
213
+ if __name__ == "__main__":
214
+ main()
claude-code/clean_output.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Strict filter on model output. Returns hint str or None."""
2
+
3
+ KNOWN_HINTS = [
4
+ "Read the traceback file before editing.",
5
+ "Read the file before editing it.",
6
+ "Run the focused failing test now.",
7
+ "Do not patch the same hypothesis again.",
8
+ "Search the exact symbol from the error.",
9
+ "Change strategy; this command already failed.",
10
+ "Check the project's package manager first.",
11
+ "Use the latest error, not the original one.",
12
+ "Verify the change before finalizing.",
13
+ ]
14
+
15
+ BANNED = ["<think>", "</think>", "because", "step 1", "first,", "second,", "plan:", "i think"]
16
+
17
+
18
+ import re
19
+ _THINK = re.compile(r"<think>.*?</think>", re.S)
20
+
21
+
22
+ def clean_hint(text):
23
+ text = _THINK.sub("", text).strip() # drop empty think block
24
+ text = text.splitlines()[0].strip() if text.strip() else ""
25
+ if text == "NO_HINT":
26
+ return None
27
+ if any(x in text.lower() for x in BANNED):
28
+ return None
29
+ if len(text.split()) > 12:
30
+ return None
31
+ marks = text.count(".") + text.count("!") + text.count("?")
32
+ if marks > 1:
33
+ return None
34
+ if marks == 0:
35
+ text += "."
36
+ if text not in KNOWN_HINTS:
37
+ return None
38
+ return text
39
+
40
+
41
+ def demo():
42
+ assert clean_hint("NO_HINT") is None
43
+ assert clean_hint("Read the file before editing it.") == "Read the file before editing it."
44
+ assert clean_hint("Read the file before editing it") == "Read the file before editing it." # adds period
45
+ assert clean_hint("First, I think we should because reasons.") is None # banned + not known
46
+ assert clean_hint("blah blah not a known hint at all here.") is None
47
+ assert clean_hint("This is a very long sentence with way more than twelve words in it indeed yes.") is None
48
+ print("clean_output ok")
49
+
50
+
51
+ if __name__ == "__main__":
52
+ demo()
claude-code/format_prompt.py ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Build the PreToolUse prompt from session state + proposed action.
2
+
3
+ The <signals> block surfaces the actual decision features as explicit
4
+ booleans so the model latches onto them instead of re-deriving from raw
5
+ state. Both the synthetic and real builders call format_prompt, so train
6
+ and inference prompts stay identical.
7
+ """
8
+ import re
9
+
10
+ TEST_RE = re.compile(r"\b(pytest|npm test|pnpm test|yarn test|cargo test|go test|bun test|unittest|jest|vitest|tox)\b")
11
+
12
+ TEMPLATE = """<task>
13
+ {goal}
14
+ </task>
15
+
16
+ <recent_trajectory>
17
+ {trajectory}
18
+ </recent_trajectory>
19
+
20
+ <state>
21
+ observed_files: {observed_files}
22
+ edited_files: {edited_files}
23
+ traceback_path: {traceback_path}
24
+ traceback_symbols: {traceback_symbols}
25
+ last_test_status: {last_test_status}
26
+ last_search_result_class: {last_search_result_class}
27
+ code_changed_since_last_test: {code_changed_since_last_test}
28
+ </state>
29
+
30
+ <proposed_action>
31
+ Tool: {tool}
32
+ Args: {args}
33
+ </proposed_action>
34
+
35
+ <signals>
36
+ proposed_edit_path: {proposed_edit_path}
37
+ proposed_action_is_test: {proposed_action_is_test}
38
+ traceback_file_read: {traceback_file_read}
39
+ edit_target_read: {edit_target_read}
40
+ last_failure_type: {last_failure_type}
41
+ repeated_command: {repeated_command}
42
+ </signals>
43
+
44
+ <instruction>
45
+ Output exactly one short sentence of guidance, or NO_HINT.
46
+ </instruction>
47
+ """
48
+
49
+
50
+ def _join(v, last=None):
51
+ if not v:
52
+ return "none"
53
+ if isinstance(v, (list, tuple)):
54
+ v = list(v)[-last:] if last else list(v)
55
+ return ", ".join(str(x) for x in v) if v else "none"
56
+ return str(v)
57
+
58
+
59
+ def _b(x):
60
+ return str(bool(x)).lower()
61
+
62
+
63
+ def format_prompt(goal, trajectory, state, proposed):
64
+ goal = goal.strip()
65
+ if len(goal) > 500:
66
+ goal = goal[:500] + " …"
67
+ tool = proposed["name"]
68
+ args = proposed.get("args", {}) or {}
69
+ cmd = args.get("command", "") or ""
70
+ edit_path = args.get("file_path") if tool in {"Edit", "Write", "MultiEdit", "NotebookEdit"} else None
71
+ observed = set(state.get("observed_files") or [])
72
+ tb = (state.get("traceback_paths") or [None])[-1]
73
+ hist = state.get("command_history") or []
74
+
75
+ return TEMPLATE.format(
76
+ goal=goal,
77
+ trajectory=trajectory.strip() if isinstance(trajectory, str) else _fmt_traj(trajectory),
78
+ observed_files=_join(state.get("observed_files"), last=20),
79
+ edited_files=_join(state.get("edited_files"), last=20),
80
+ traceback_path=tb or "none",
81
+ traceback_symbols=_join(state.get("traceback_symbols"), last=5),
82
+ last_test_status=state.get("last_test_status", "unknown"),
83
+ last_search_result_class=state.get("last_search_result_class") or "none",
84
+ code_changed_since_last_test=_b(state.get("code_changed_since_last_test")),
85
+ tool=tool,
86
+ args=_join(edit_path or cmd or args)[:200],
87
+ proposed_edit_path=edit_path or "none",
88
+ proposed_action_is_test=_b(tool == "Bash" and TEST_RE.search(cmd)),
89
+ traceback_file_read=_b(tb and tb in observed),
90
+ edit_target_read=_b(edit_path and edit_path in observed),
91
+ last_failure_type=state.get("last_failure_type") or "none",
92
+ repeated_command=_b(tool == "Bash" and cmd and sum(1 for x in hist[-3:] if x == cmd) >= 2),
93
+ )
94
+
95
+
96
+ def _fmt_traj(calls):
97
+ lines = []
98
+ for i, c in enumerate(calls[-12:], 1):
99
+ lines.append(f"{i}. {c['tool']}: {c.get('arg','')}\n Result: {c.get('result','')}")
100
+ return "\n".join(lines) if lines else "none"
claude-code/hook_pretooluse.py ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Claude Code PreToolUse hook -> TinyGuide hint (advisory, non-blocking).
3
+
4
+ Reads the PreToolUse JSON on stdin, replays transcript_path to rebuild the
5
+ agent state, asks the local mlx_lm.server for a hint, and surfaces it to
6
+ Claude. Never blocks the tool: any error / no-hint -> silent exit 0.
7
+
8
+ A tiny on-disk cooldown file enforces the runtime suppression that we
9
+ deliberately kept OUT of the training labels.
10
+ """
11
+ import json, sys
12
+ from pathlib import Path
13
+
14
+ HERE = Path(__file__).resolve().parent
15
+ sys.path.insert(0, str(HERE))
16
+ from build_from_raw import iter_pairs, _advance
17
+ from format_prompt import format_prompt
18
+ from infer import get_hint
19
+
20
+ COOLDOWN = Path("/tmp/tinyguide_cooldown.json")
21
+ MIN_CALLS_BETWEEN = 3 # >=3 tool calls between hints
22
+ MAX_PER_SESSION = 5 # cap hints per session
23
+
24
+
25
+ def base_state():
26
+ return {"observed_files": [], "edited_files": [], "traceback_paths": [],
27
+ "command_history": [], "last_test_status": "unknown",
28
+ "code_changed_since_last_test": False, "traceback_symbols": [],
29
+ "last_failure_type": None, "last_error_signature": None,
30
+ "previous_error_signature": None, "last_search_result_class": None,
31
+ "last_test_failed_same_error_after_edit": False}
32
+
33
+
34
+ def rebuild(transcript_path):
35
+ """Replay completed tool calls -> (state, traj, goal, n_calls)."""
36
+ state, traj, goal, n = base_state(), [], "Continue the task.", 0
37
+ try:
38
+ for g, name, inp, res, is_err in iter_pairs(transcript_path):
39
+ goal = g or goal
40
+ _advance(state, traj, name, inp, res, is_err)
41
+ n += 1
42
+ except Exception:
43
+ pass
44
+ return state, traj, goal, n
45
+
46
+
47
+ def cooldown_ok(session_id, n_calls):
48
+ """True if allowed to hint now; updates the cooldown file when it returns True."""
49
+ try:
50
+ data = json.loads(COOLDOWN.read_text()) if COOLDOWN.exists() else {}
51
+ except Exception:
52
+ data = {}
53
+ s = data.get(session_id, {"count": 0, "last_call": -999})
54
+ if s["count"] >= MAX_PER_SESSION:
55
+ return False, data, s
56
+ if n_calls - s["last_call"] < MIN_CALLS_BETWEEN:
57
+ return False, data, s
58
+ return True, data, s
59
+
60
+
61
+ def main():
62
+ try:
63
+ payload = json.load(sys.stdin)
64
+ except Exception:
65
+ sys.exit(0)
66
+
67
+ tool = payload.get("tool_name")
68
+ inp = payload.get("tool_input", {}) or {}
69
+ transcript = payload.get("transcript_path", "")
70
+ session_id = payload.get("session_id", "default")
71
+ if not tool or not transcript:
72
+ sys.exit(0)
73
+
74
+ state, traj, goal, n_calls = rebuild(transcript)
75
+ proposed = {"name": tool, "args": inp}
76
+ prompt = format_prompt(goal, traj, state, proposed)
77
+
78
+ hint = get_hint(prompt)
79
+ if not hint:
80
+ sys.exit(0)
81
+
82
+ ok, data, s = cooldown_ok(session_id, n_calls)
83
+ if not ok:
84
+ sys.exit(0)
85
+ # record
86
+ data[session_id] = {"count": s["count"] + 1, "last_call": n_calls}
87
+ try:
88
+ COOLDOWN.write_text(json.dumps(data))
89
+ except Exception:
90
+ pass
91
+
92
+ # advisory context to Claude, non-blocking
93
+ print(json.dumps({
94
+ "hookSpecificOutput": {
95
+ "hookEventName": "PreToolUse",
96
+ "permissionDecision": "allow",
97
+ "additionalContext": f"TinyGuide hint: {hint}",
98
+ }
99
+ }))
100
+ sys.exit(0)
101
+
102
+
103
+ if __name__ == "__main__":
104
+ main()
claude-code/infer.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Call the local mlx_lm.server for one hint. Returns hint str or None."""
2
+ import json, urllib.request
3
+ from pathlib import Path
4
+ import sys
5
+
6
+ sys.path.insert(0, str(Path(__file__).parent))
7
+ from clean_output import clean_hint
8
+
9
+ URL = "http://127.0.0.1:8080/v1/chat/completions"
10
+
11
+
12
+ def get_hint(prompt, timeout=8.0):
13
+ body = json.dumps({
14
+ "messages": [{"role": "user", "content": prompt}],
15
+ "max_tokens": 24,
16
+ "temperature": 0.0,
17
+ }).encode()
18
+ req = urllib.request.Request(URL, data=body, headers={"Content-Type": "application/json"})
19
+ try:
20
+ with urllib.request.urlopen(req, timeout=timeout) as r:
21
+ out = json.load(r)
22
+ text = out["choices"][0]["message"]["content"]
23
+ except Exception:
24
+ return None # server down / timeout so no hint, never break the tool
25
+ return clean_hint(text)
26
+
27
+
28
+ if __name__ == "__main__":
29
+ print(get_hint(sys.stdin.read()))
claude-code/settings.snippet.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "//": "Merge this into ~/.claude/settings.json. Adjust PYTHON and HOOK paths.",
3
+ "//python": "Use the venv python that has mlx_lm + outlines installed.",
4
+ "hooks": {
5
+ "PreToolUse": [
6
+ {
7
+ "matcher": "Edit|Write|Bash",
8
+ "hooks": [
9
+ {
10
+ "type": "command",
11
+ "command": "/ABS/PATH/.venv/bin/python /ABS/PATH/claude-code/hook_pretooluse.py"
12
+ }
13
+ ]
14
+ }
15
+ ]
16
+ }
17
+ }
config.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 151643,
8
+ "eos_token_id": [
9
+ 151645,
10
+ 151643
11
+ ],
12
+ "head_dim": 128,
13
+ "hidden_act": "silu",
14
+ "hidden_size": 1024,
15
+ "initializer_range": 0.02,
16
+ "intermediate_size": 3072,
17
+ "max_position_embeddings": 40960,
18
+ "max_window_layers": 28,
19
+ "model_type": "qwen3",
20
+ "num_attention_heads": 16,
21
+ "num_hidden_layers": 28,
22
+ "num_key_value_heads": 8,
23
+ "rms_norm_eps": 1e-06,
24
+ "rope_scaling": null,
25
+ "rope_theta": 1000000,
26
+ "sliding_window": null,
27
+ "tie_word_embeddings": true,
28
+ "torch_dtype": "bfloat16",
29
+ "transformers_version": "4.51.0",
30
+ "use_cache": true,
31
+ "use_sliding_window": false,
32
+ "vocab_size": 151936
33
+ }
generation_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "temperature": 0.6,
10
+ "top_k": 20,
11
+ "top_p": 0.95,
12
+ "transformers_version": "4.51.0"
13
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d87519aa0367b990688f74acdcdedb3aca2d371a2ba830c533dda10c8d70b317
3
+ size 1192134935
model.safetensors.index.json ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 1192099840,
4
+ "total_parameters": 596049920
5
+ },
6
+ "weight_map": {
7
+ "model.embed_tokens.weight": "model.safetensors",
8
+ "model.layers.0.input_layernorm.weight": "model.safetensors",
9
+ "model.layers.0.mlp.down_proj.weight": "model.safetensors",
10
+ "model.layers.0.mlp.gate_proj.weight": "model.safetensors",
11
+ "model.layers.0.mlp.up_proj.weight": "model.safetensors",
12
+ "model.layers.0.post_attention_layernorm.weight": "model.safetensors",
13
+ "model.layers.0.self_attn.k_norm.weight": "model.safetensors",
14
+ "model.layers.0.self_attn.k_proj.weight": "model.safetensors",
15
+ "model.layers.0.self_attn.o_proj.weight": "model.safetensors",
16
+ "model.layers.0.self_attn.q_norm.weight": "model.safetensors",
17
+ "model.layers.0.self_attn.q_proj.weight": "model.safetensors",
18
+ "model.layers.0.self_attn.v_proj.weight": "model.safetensors",
19
+ "model.layers.1.input_layernorm.weight": "model.safetensors",
20
+ "model.layers.1.mlp.down_proj.weight": "model.safetensors",
21
+ "model.layers.1.mlp.gate_proj.weight": "model.safetensors",
22
+ "model.layers.1.mlp.up_proj.weight": "model.safetensors",
23
+ "model.layers.1.post_attention_layernorm.weight": "model.safetensors",
24
+ "model.layers.1.self_attn.k_norm.weight": "model.safetensors",
25
+ "model.layers.1.self_attn.k_proj.weight": "model.safetensors",
26
+ "model.layers.1.self_attn.o_proj.weight": "model.safetensors",
27
+ "model.layers.1.self_attn.q_norm.weight": "model.safetensors",
28
+ "model.layers.1.self_attn.q_proj.weight": "model.safetensors",
29
+ "model.layers.1.self_attn.v_proj.weight": "model.safetensors",
30
+ "model.layers.10.input_layernorm.weight": "model.safetensors",
31
+ "model.layers.10.mlp.down_proj.weight": "model.safetensors",
32
+ "model.layers.10.mlp.gate_proj.weight": "model.safetensors",
33
+ "model.layers.10.mlp.up_proj.weight": "model.safetensors",
34
+ "model.layers.10.post_attention_layernorm.weight": "model.safetensors",
35
+ "model.layers.10.self_attn.k_norm.weight": "model.safetensors",
36
+ "model.layers.10.self_attn.k_proj.weight": "model.safetensors",
37
+ "model.layers.10.self_attn.o_proj.weight": "model.safetensors",
38
+ "model.layers.10.self_attn.q_norm.weight": "model.safetensors",
39
+ "model.layers.10.self_attn.q_proj.weight": "model.safetensors",
40
+ "model.layers.10.self_attn.v_proj.weight": "model.safetensors",
41
+ "model.layers.11.input_layernorm.weight": "model.safetensors",
42
+ "model.layers.11.mlp.down_proj.weight": "model.safetensors",
43
+ "model.layers.11.mlp.gate_proj.weight": "model.safetensors",
44
+ "model.layers.11.mlp.up_proj.weight": "model.safetensors",
45
+ "model.layers.11.post_attention_layernorm.weight": "model.safetensors",
46
+ "model.layers.11.self_attn.k_norm.weight": "model.safetensors",
47
+ "model.layers.11.self_attn.k_proj.weight": "model.safetensors",
48
+ "model.layers.11.self_attn.o_proj.weight": "model.safetensors",
49
+ "model.layers.11.self_attn.q_norm.weight": "model.safetensors",
50
+ "model.layers.11.self_attn.q_proj.weight": "model.safetensors",
51
+ "model.layers.11.self_attn.v_proj.weight": "model.safetensors",
52
+ "model.layers.12.input_layernorm.weight": "model.safetensors",
53
+ "model.layers.12.mlp.down_proj.weight": "model.safetensors",
54
+ "model.layers.12.mlp.gate_proj.weight": "model.safetensors",
55
+ "model.layers.12.mlp.up_proj.weight": "model.safetensors",
56
+ "model.layers.12.post_attention_layernorm.weight": "model.safetensors",
57
+ "model.layers.12.self_attn.k_norm.weight": "model.safetensors",
58
+ "model.layers.12.self_attn.k_proj.weight": "model.safetensors",
59
+ "model.layers.12.self_attn.o_proj.weight": "model.safetensors",
60
+ "model.layers.12.self_attn.q_norm.weight": "model.safetensors",
61
+ "model.layers.12.self_attn.q_proj.weight": "model.safetensors",
62
+ "model.layers.12.self_attn.v_proj.weight": "model.safetensors",
63
+ "model.layers.13.input_layernorm.weight": "model.safetensors",
64
+ "model.layers.13.mlp.down_proj.weight": "model.safetensors",
65
+ "model.layers.13.mlp.gate_proj.weight": "model.safetensors",
66
+ "model.layers.13.mlp.up_proj.weight": "model.safetensors",
67
+ "model.layers.13.post_attention_layernorm.weight": "model.safetensors",
68
+ "model.layers.13.self_attn.k_norm.weight": "model.safetensors",
69
+ "model.layers.13.self_attn.k_proj.weight": "model.safetensors",
70
+ "model.layers.13.self_attn.o_proj.weight": "model.safetensors",
71
+ "model.layers.13.self_attn.q_norm.weight": "model.safetensors",
72
+ "model.layers.13.self_attn.q_proj.weight": "model.safetensors",
73
+ "model.layers.13.self_attn.v_proj.weight": "model.safetensors",
74
+ "model.layers.14.input_layernorm.weight": "model.safetensors",
75
+ "model.layers.14.mlp.down_proj.weight": "model.safetensors",
76
+ "model.layers.14.mlp.gate_proj.weight": "model.safetensors",
77
+ "model.layers.14.mlp.up_proj.weight": "model.safetensors",
78
+ "model.layers.14.post_attention_layernorm.weight": "model.safetensors",
79
+ "model.layers.14.self_attn.k_norm.weight": "model.safetensors",
80
+ "model.layers.14.self_attn.k_proj.weight": "model.safetensors",
81
+ "model.layers.14.self_attn.o_proj.weight": "model.safetensors",
82
+ "model.layers.14.self_attn.q_norm.weight": "model.safetensors",
83
+ "model.layers.14.self_attn.q_proj.weight": "model.safetensors",
84
+ "model.layers.14.self_attn.v_proj.weight": "model.safetensors",
85
+ "model.layers.15.input_layernorm.weight": "model.safetensors",
86
+ "model.layers.15.mlp.down_proj.weight": "model.safetensors",
87
+ "model.layers.15.mlp.gate_proj.weight": "model.safetensors",
88
+ "model.layers.15.mlp.up_proj.weight": "model.safetensors",
89
+ "model.layers.15.post_attention_layernorm.weight": "model.safetensors",
90
+ "model.layers.15.self_attn.k_norm.weight": "model.safetensors",
91
+ "model.layers.15.self_attn.k_proj.weight": "model.safetensors",
92
+ "model.layers.15.self_attn.o_proj.weight": "model.safetensors",
93
+ "model.layers.15.self_attn.q_norm.weight": "model.safetensors",
94
+ "model.layers.15.self_attn.q_proj.weight": "model.safetensors",
95
+ "model.layers.15.self_attn.v_proj.weight": "model.safetensors",
96
+ "model.layers.16.input_layernorm.weight": "model.safetensors",
97
+ "model.layers.16.mlp.down_proj.weight": "model.safetensors",
98
+ "model.layers.16.mlp.gate_proj.weight": "model.safetensors",
99
+ "model.layers.16.mlp.up_proj.weight": "model.safetensors",
100
+ "model.layers.16.post_attention_layernorm.weight": "model.safetensors",
101
+ "model.layers.16.self_attn.k_norm.weight": "model.safetensors",
102
+ "model.layers.16.self_attn.k_proj.weight": "model.safetensors",
103
+ "model.layers.16.self_attn.o_proj.weight": "model.safetensors",
104
+ "model.layers.16.self_attn.q_norm.weight": "model.safetensors",
105
+ "model.layers.16.self_attn.q_proj.weight": "model.safetensors",
106
+ "model.layers.16.self_attn.v_proj.weight": "model.safetensors",
107
+ "model.layers.17.input_layernorm.weight": "model.safetensors",
108
+ "model.layers.17.mlp.down_proj.weight": "model.safetensors",
109
+ "model.layers.17.mlp.gate_proj.weight": "model.safetensors",
110
+ "model.layers.17.mlp.up_proj.weight": "model.safetensors",
111
+ "model.layers.17.post_attention_layernorm.weight": "model.safetensors",
112
+ "model.layers.17.self_attn.k_norm.weight": "model.safetensors",
113
+ "model.layers.17.self_attn.k_proj.weight": "model.safetensors",
114
+ "model.layers.17.self_attn.o_proj.weight": "model.safetensors",
115
+ "model.layers.17.self_attn.q_norm.weight": "model.safetensors",
116
+ "model.layers.17.self_attn.q_proj.weight": "model.safetensors",
117
+ "model.layers.17.self_attn.v_proj.weight": "model.safetensors",
118
+ "model.layers.18.input_layernorm.weight": "model.safetensors",
119
+ "model.layers.18.mlp.down_proj.weight": "model.safetensors",
120
+ "model.layers.18.mlp.gate_proj.weight": "model.safetensors",
121
+ "model.layers.18.mlp.up_proj.weight": "model.safetensors",
122
+ "model.layers.18.post_attention_layernorm.weight": "model.safetensors",
123
+ "model.layers.18.self_attn.k_norm.weight": "model.safetensors",
124
+ "model.layers.18.self_attn.k_proj.weight": "model.safetensors",
125
+ "model.layers.18.self_attn.o_proj.weight": "model.safetensors",
126
+ "model.layers.18.self_attn.q_norm.weight": "model.safetensors",
127
+ "model.layers.18.self_attn.q_proj.weight": "model.safetensors",
128
+ "model.layers.18.self_attn.v_proj.weight": "model.safetensors",
129
+ "model.layers.19.input_layernorm.weight": "model.safetensors",
130
+ "model.layers.19.mlp.down_proj.weight": "model.safetensors",
131
+ "model.layers.19.mlp.gate_proj.weight": "model.safetensors",
132
+ "model.layers.19.mlp.up_proj.weight": "model.safetensors",
133
+ "model.layers.19.post_attention_layernorm.weight": "model.safetensors",
134
+ "model.layers.19.self_attn.k_norm.weight": "model.safetensors",
135
+ "model.layers.19.self_attn.k_proj.weight": "model.safetensors",
136
+ "model.layers.19.self_attn.o_proj.weight": "model.safetensors",
137
+ "model.layers.19.self_attn.q_norm.weight": "model.safetensors",
138
+ "model.layers.19.self_attn.q_proj.weight": "model.safetensors",
139
+ "model.layers.19.self_attn.v_proj.weight": "model.safetensors",
140
+ "model.layers.2.input_layernorm.weight": "model.safetensors",
141
+ "model.layers.2.mlp.down_proj.weight": "model.safetensors",
142
+ "model.layers.2.mlp.gate_proj.weight": "model.safetensors",
143
+ "model.layers.2.mlp.up_proj.weight": "model.safetensors",
144
+ "model.layers.2.post_attention_layernorm.weight": "model.safetensors",
145
+ "model.layers.2.self_attn.k_norm.weight": "model.safetensors",
146
+ "model.layers.2.self_attn.k_proj.weight": "model.safetensors",
147
+ "model.layers.2.self_attn.o_proj.weight": "model.safetensors",
148
+ "model.layers.2.self_attn.q_norm.weight": "model.safetensors",
149
+ "model.layers.2.self_attn.q_proj.weight": "model.safetensors",
150
+ "model.layers.2.self_attn.v_proj.weight": "model.safetensors",
151
+ "model.layers.20.input_layernorm.weight": "model.safetensors",
152
+ "model.layers.20.mlp.down_proj.weight": "model.safetensors",
153
+ "model.layers.20.mlp.gate_proj.weight": "model.safetensors",
154
+ "model.layers.20.mlp.up_proj.weight": "model.safetensors",
155
+ "model.layers.20.post_attention_layernorm.weight": "model.safetensors",
156
+ "model.layers.20.self_attn.k_norm.weight": "model.safetensors",
157
+ "model.layers.20.self_attn.k_proj.weight": "model.safetensors",
158
+ "model.layers.20.self_attn.o_proj.weight": "model.safetensors",
159
+ "model.layers.20.self_attn.q_norm.weight": "model.safetensors",
160
+ "model.layers.20.self_attn.q_proj.weight": "model.safetensors",
161
+ "model.layers.20.self_attn.v_proj.weight": "model.safetensors",
162
+ "model.layers.21.input_layernorm.weight": "model.safetensors",
163
+ "model.layers.21.mlp.down_proj.weight": "model.safetensors",
164
+ "model.layers.21.mlp.gate_proj.weight": "model.safetensors",
165
+ "model.layers.21.mlp.up_proj.weight": "model.safetensors",
166
+ "model.layers.21.post_attention_layernorm.weight": "model.safetensors",
167
+ "model.layers.21.self_attn.k_norm.weight": "model.safetensors",
168
+ "model.layers.21.self_attn.k_proj.weight": "model.safetensors",
169
+ "model.layers.21.self_attn.o_proj.weight": "model.safetensors",
170
+ "model.layers.21.self_attn.q_norm.weight": "model.safetensors",
171
+ "model.layers.21.self_attn.q_proj.weight": "model.safetensors",
172
+ "model.layers.21.self_attn.v_proj.weight": "model.safetensors",
173
+ "model.layers.22.input_layernorm.weight": "model.safetensors",
174
+ "model.layers.22.mlp.down_proj.weight": "model.safetensors",
175
+ "model.layers.22.mlp.gate_proj.weight": "model.safetensors",
176
+ "model.layers.22.mlp.up_proj.weight": "model.safetensors",
177
+ "model.layers.22.post_attention_layernorm.weight": "model.safetensors",
178
+ "model.layers.22.self_attn.k_norm.weight": "model.safetensors",
179
+ "model.layers.22.self_attn.k_proj.weight": "model.safetensors",
180
+ "model.layers.22.self_attn.o_proj.weight": "model.safetensors",
181
+ "model.layers.22.self_attn.q_norm.weight": "model.safetensors",
182
+ "model.layers.22.self_attn.q_proj.weight": "model.safetensors",
183
+ "model.layers.22.self_attn.v_proj.weight": "model.safetensors",
184
+ "model.layers.23.input_layernorm.weight": "model.safetensors",
185
+ "model.layers.23.mlp.down_proj.weight": "model.safetensors",
186
+ "model.layers.23.mlp.gate_proj.weight": "model.safetensors",
187
+ "model.layers.23.mlp.up_proj.weight": "model.safetensors",
188
+ "model.layers.23.post_attention_layernorm.weight": "model.safetensors",
189
+ "model.layers.23.self_attn.k_norm.weight": "model.safetensors",
190
+ "model.layers.23.self_attn.k_proj.weight": "model.safetensors",
191
+ "model.layers.23.self_attn.o_proj.weight": "model.safetensors",
192
+ "model.layers.23.self_attn.q_norm.weight": "model.safetensors",
193
+ "model.layers.23.self_attn.q_proj.weight": "model.safetensors",
194
+ "model.layers.23.self_attn.v_proj.weight": "model.safetensors",
195
+ "model.layers.24.input_layernorm.weight": "model.safetensors",
196
+ "model.layers.24.mlp.down_proj.weight": "model.safetensors",
197
+ "model.layers.24.mlp.gate_proj.weight": "model.safetensors",
198
+ "model.layers.24.mlp.up_proj.weight": "model.safetensors",
199
+ "model.layers.24.post_attention_layernorm.weight": "model.safetensors",
200
+ "model.layers.24.self_attn.k_norm.weight": "model.safetensors",
201
+ "model.layers.24.self_attn.k_proj.weight": "model.safetensors",
202
+ "model.layers.24.self_attn.o_proj.weight": "model.safetensors",
203
+ "model.layers.24.self_attn.q_norm.weight": "model.safetensors",
204
+ "model.layers.24.self_attn.q_proj.weight": "model.safetensors",
205
+ "model.layers.24.self_attn.v_proj.weight": "model.safetensors",
206
+ "model.layers.25.input_layernorm.weight": "model.safetensors",
207
+ "model.layers.25.mlp.down_proj.weight": "model.safetensors",
208
+ "model.layers.25.mlp.gate_proj.weight": "model.safetensors",
209
+ "model.layers.25.mlp.up_proj.weight": "model.safetensors",
210
+ "model.layers.25.post_attention_layernorm.weight": "model.safetensors",
211
+ "model.layers.25.self_attn.k_norm.weight": "model.safetensors",
212
+ "model.layers.25.self_attn.k_proj.weight": "model.safetensors",
213
+ "model.layers.25.self_attn.o_proj.weight": "model.safetensors",
214
+ "model.layers.25.self_attn.q_norm.weight": "model.safetensors",
215
+ "model.layers.25.self_attn.q_proj.weight": "model.safetensors",
216
+ "model.layers.25.self_attn.v_proj.weight": "model.safetensors",
217
+ "model.layers.26.input_layernorm.weight": "model.safetensors",
218
+ "model.layers.26.mlp.down_proj.weight": "model.safetensors",
219
+ "model.layers.26.mlp.gate_proj.weight": "model.safetensors",
220
+ "model.layers.26.mlp.up_proj.weight": "model.safetensors",
221
+ "model.layers.26.post_attention_layernorm.weight": "model.safetensors",
222
+ "model.layers.26.self_attn.k_norm.weight": "model.safetensors",
223
+ "model.layers.26.self_attn.k_proj.weight": "model.safetensors",
224
+ "model.layers.26.self_attn.o_proj.weight": "model.safetensors",
225
+ "model.layers.26.self_attn.q_norm.weight": "model.safetensors",
226
+ "model.layers.26.self_attn.q_proj.weight": "model.safetensors",
227
+ "model.layers.26.self_attn.v_proj.weight": "model.safetensors",
228
+ "model.layers.27.input_layernorm.weight": "model.safetensors",
229
+ "model.layers.27.mlp.down_proj.weight": "model.safetensors",
230
+ "model.layers.27.mlp.gate_proj.weight": "model.safetensors",
231
+ "model.layers.27.mlp.up_proj.weight": "model.safetensors",
232
+ "model.layers.27.post_attention_layernorm.weight": "model.safetensors",
233
+ "model.layers.27.self_attn.k_norm.weight": "model.safetensors",
234
+ "model.layers.27.self_attn.k_proj.weight": "model.safetensors",
235
+ "model.layers.27.self_attn.o_proj.weight": "model.safetensors",
236
+ "model.layers.27.self_attn.q_norm.weight": "model.safetensors",
237
+ "model.layers.27.self_attn.q_proj.weight": "model.safetensors",
238
+ "model.layers.27.self_attn.v_proj.weight": "model.safetensors",
239
+ "model.layers.3.input_layernorm.weight": "model.safetensors",
240
+ "model.layers.3.mlp.down_proj.weight": "model.safetensors",
241
+ "model.layers.3.mlp.gate_proj.weight": "model.safetensors",
242
+ "model.layers.3.mlp.up_proj.weight": "model.safetensors",
243
+ "model.layers.3.post_attention_layernorm.weight": "model.safetensors",
244
+ "model.layers.3.self_attn.k_norm.weight": "model.safetensors",
245
+ "model.layers.3.self_attn.k_proj.weight": "model.safetensors",
246
+ "model.layers.3.self_attn.o_proj.weight": "model.safetensors",
247
+ "model.layers.3.self_attn.q_norm.weight": "model.safetensors",
248
+ "model.layers.3.self_attn.q_proj.weight": "model.safetensors",
249
+ "model.layers.3.self_attn.v_proj.weight": "model.safetensors",
250
+ "model.layers.4.input_layernorm.weight": "model.safetensors",
251
+ "model.layers.4.mlp.down_proj.weight": "model.safetensors",
252
+ "model.layers.4.mlp.gate_proj.weight": "model.safetensors",
253
+ "model.layers.4.mlp.up_proj.weight": "model.safetensors",
254
+ "model.layers.4.post_attention_layernorm.weight": "model.safetensors",
255
+ "model.layers.4.self_attn.k_norm.weight": "model.safetensors",
256
+ "model.layers.4.self_attn.k_proj.weight": "model.safetensors",
257
+ "model.layers.4.self_attn.o_proj.weight": "model.safetensors",
258
+ "model.layers.4.self_attn.q_norm.weight": "model.safetensors",
259
+ "model.layers.4.self_attn.q_proj.weight": "model.safetensors",
260
+ "model.layers.4.self_attn.v_proj.weight": "model.safetensors",
261
+ "model.layers.5.input_layernorm.weight": "model.safetensors",
262
+ "model.layers.5.mlp.down_proj.weight": "model.safetensors",
263
+ "model.layers.5.mlp.gate_proj.weight": "model.safetensors",
264
+ "model.layers.5.mlp.up_proj.weight": "model.safetensors",
265
+ "model.layers.5.post_attention_layernorm.weight": "model.safetensors",
266
+ "model.layers.5.self_attn.k_norm.weight": "model.safetensors",
267
+ "model.layers.5.self_attn.k_proj.weight": "model.safetensors",
268
+ "model.layers.5.self_attn.o_proj.weight": "model.safetensors",
269
+ "model.layers.5.self_attn.q_norm.weight": "model.safetensors",
270
+ "model.layers.5.self_attn.q_proj.weight": "model.safetensors",
271
+ "model.layers.5.self_attn.v_proj.weight": "model.safetensors",
272
+ "model.layers.6.input_layernorm.weight": "model.safetensors",
273
+ "model.layers.6.mlp.down_proj.weight": "model.safetensors",
274
+ "model.layers.6.mlp.gate_proj.weight": "model.safetensors",
275
+ "model.layers.6.mlp.up_proj.weight": "model.safetensors",
276
+ "model.layers.6.post_attention_layernorm.weight": "model.safetensors",
277
+ "model.layers.6.self_attn.k_norm.weight": "model.safetensors",
278
+ "model.layers.6.self_attn.k_proj.weight": "model.safetensors",
279
+ "model.layers.6.self_attn.o_proj.weight": "model.safetensors",
280
+ "model.layers.6.self_attn.q_norm.weight": "model.safetensors",
281
+ "model.layers.6.self_attn.q_proj.weight": "model.safetensors",
282
+ "model.layers.6.self_attn.v_proj.weight": "model.safetensors",
283
+ "model.layers.7.input_layernorm.weight": "model.safetensors",
284
+ "model.layers.7.mlp.down_proj.weight": "model.safetensors",
285
+ "model.layers.7.mlp.gate_proj.weight": "model.safetensors",
286
+ "model.layers.7.mlp.up_proj.weight": "model.safetensors",
287
+ "model.layers.7.post_attention_layernorm.weight": "model.safetensors",
288
+ "model.layers.7.self_attn.k_norm.weight": "model.safetensors",
289
+ "model.layers.7.self_attn.k_proj.weight": "model.safetensors",
290
+ "model.layers.7.self_attn.o_proj.weight": "model.safetensors",
291
+ "model.layers.7.self_attn.q_norm.weight": "model.safetensors",
292
+ "model.layers.7.self_attn.q_proj.weight": "model.safetensors",
293
+ "model.layers.7.self_attn.v_proj.weight": "model.safetensors",
294
+ "model.layers.8.input_layernorm.weight": "model.safetensors",
295
+ "model.layers.8.mlp.down_proj.weight": "model.safetensors",
296
+ "model.layers.8.mlp.gate_proj.weight": "model.safetensors",
297
+ "model.layers.8.mlp.up_proj.weight": "model.safetensors",
298
+ "model.layers.8.post_attention_layernorm.weight": "model.safetensors",
299
+ "model.layers.8.self_attn.k_norm.weight": "model.safetensors",
300
+ "model.layers.8.self_attn.k_proj.weight": "model.safetensors",
301
+ "model.layers.8.self_attn.o_proj.weight": "model.safetensors",
302
+ "model.layers.8.self_attn.q_norm.weight": "model.safetensors",
303
+ "model.layers.8.self_attn.q_proj.weight": "model.safetensors",
304
+ "model.layers.8.self_attn.v_proj.weight": "model.safetensors",
305
+ "model.layers.9.input_layernorm.weight": "model.safetensors",
306
+ "model.layers.9.mlp.down_proj.weight": "model.safetensors",
307
+ "model.layers.9.mlp.gate_proj.weight": "model.safetensors",
308
+ "model.layers.9.mlp.up_proj.weight": "model.safetensors",
309
+ "model.layers.9.post_attention_layernorm.weight": "model.safetensors",
310
+ "model.layers.9.self_attn.k_norm.weight": "model.safetensors",
311
+ "model.layers.9.self_attn.k_proj.weight": "model.safetensors",
312
+ "model.layers.9.self_attn.o_proj.weight": "model.safetensors",
313
+ "model.layers.9.self_attn.q_norm.weight": "model.safetensors",
314
+ "model.layers.9.self_attn.q_proj.weight": "model.safetensors",
315
+ "model.layers.9.self_attn.v_proj.weight": "model.safetensors",
316
+ "model.norm.weight": "model.safetensors"
317
+ }
318
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506
3
+ size 11422650
tokenizer_config.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<|im_start|>",
10
+ "<|im_end|>",
11
+ "<|object_ref_start|>",
12
+ "<|object_ref_end|>",
13
+ "<|box_start|>",
14
+ "<|box_end|>",
15
+ "<|quad_start|>",
16
+ "<|quad_end|>",
17
+ "<|vision_start|>",
18
+ "<|vision_end|>",
19
+ "<|vision_pad|>",
20
+ "<|image_pad|>",
21
+ "<|video_pad|>"
22
+ ],
23
+ "is_local": true,
24
+ "local_files_only": false,
25
+ "model_max_length": 131072,
26
+ "pad_token": "<|endoftext|>",
27
+ "split_special_tokens": false,
28
+ "tokenizer_class": "Qwen2Tokenizer",
29
+ "tool_parser_type": "json_tools",
30
+ "unk_token": null
31
+ }