Download inspect_raw.py from DevGwardo/minicpm5-toolcall-code: direct link, hf CLI and curl.
- Browser
- Download file 897 Bytes
-
https://huggingface.co/datasets/DevGwardo/minicpm5-toolcall-code/resolve/main/inspect_raw.py
- Command line
-
hf download hf://datasets/DevGwardo/minicpm5-toolcall-code/inspect_raw.py
-
curl -L -o inspect_raw.py https://huggingface.co/datasets/DevGwardo/minicpm5-toolcall-code/resolve/main/inspect_raw.py
897 Bytes
| import json, sys, collections | |
| data = json.load(open(sys.argv[1], encoding="utf-8")) | |
| d = data[0] | |
| print("=== SYSTEM (first 1200) ===") | |
| print(d["system"][:1200]) | |
| print("\n=== CONVERSATIONS ===") | |
| for m in d["conversations"]: | |
| print(m["from"], "::", m["value"][:700].replace("\n", "\\n")) | |
| # marker survey | |
| markers = collections.Counter() | |
| for row in data: | |
| for m in row["conversations"]: | |
| v = m["value"] | |
| for tag in ("<functioncall>", "<toolcall>", "<|tool_call|>", "<function_call>", "```json"): | |
| if tag in v: | |
| markers[(m["from"], tag)] += 1 | |
| print("\nmarkers:", markers.most_common(10)) | |
| # an assistant turn that looks like a call | |
| for row in data: | |
| for m in row["conversations"]: | |
| if m["from"] == "assistant" and "{" in m["value"]: | |
| print("\n=== ASSISTANT SAMPLE ===") | |
| print(m["value"][:900]) | |
| raise SystemExit | |