unsloth/studio/backend/core
danielhanchen 047d9d4d70 Studio: strip orphaned tool-call markup and byte-fallback chars at the tool-call chokepoints
On an MTP GGUF model, speculative decoding on a quantized target surfaces
byte-fallback garbage as U+FFFD plus an orphaned tool-call close tag whose opener
was drained or mangled, which leaked into chat (issue #7084).

Centralize the scrub at the tool-call chokepoints instead of scattering it
per delta:

- strip_tool_markup now sanitizes control chars / U+FFFD and removes a trailing
  orphan-close run, gated by a </tool_call> style sentinel so code/XML literals
  survive. Kimi and DeepSeek end-of-turn closers join the sentinel set.
- The two streaming-strip entries (safetensors strip_tool_markup_streaming and
  the GGUF _strip_tool_markup_streaming) sanitize at the top and drop trailing
  orphan closes on the final segment, so live display matches the finalized
  answer.
- ToolLoopController.record_result scrubs a tool result before it reaches the
  model or the tool card.

Drops the scattered per-delta content, tool-args, and reasoning-channel scrubs
and the secondary live-stream scrub, which are now covered by the chokepoints
above.
2026-07-20 12:58:21 +00:00
..
data_recipe Replace standalone Studio wording with Unsloth (#7221) 2026-07-19 00:47:04 -07:00
export Studio: quiet noisy logs, log real progress, and speed up Windows/macOS dataset prep (#7087) 2026-07-15 06:49:52 -07:00
inference Studio: strip orphaned tool-call markup and byte-fallback chars at the tool-call chokepoints 2026-07-20 12:58:21 +00:00
rag Studio: hide the RAG embedder and llama.cpp probe from the hub cached inventory (#7018) 2026-07-19 03:20:56 -07:00
training Replace standalone Studio wording with Unsloth (#7221) 2026-07-19 00:47:04 -07:00
__init__.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
_torchao_stub.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
import_guards.py Studio: self-heal unsloth namespace shadows; clearer failed-load messages (#6532) 2026-06-21 22:43:31 -07:00
tool_healing.py Studio: Inkling support fixes (#7153) 2026-07-15 11:22:38 -07:00