Repository navigation
Studio: train a dataset's system column as the system prompt - #12614
Conversation
#12562 (make carried rows a faintly frosted, darker copy) landed after this branch was cut and restyles the shared ghost rule that #12499 introduced: it relies on --row-ghost-surface and .model-picker-row-ghost, and edits model-picker-pinned-drag-preview.test.ts, all of which the #12499 revert removes. Keeping it without #12499 leaves .sidebar-row-ghost reading an unset variable, so the conflict is resolved by dropping #12562's two hunks as well. It should be re-opened together with #12499. #12563, #12564 and #12597 are kept.
* Train a dataset's system column as the system prompt * Keep rows trainable when the system column cannot be rendered Templates that reject a system role (codegemma's own template, for one) now train the conversation without the column instead of dropping every row that has one. The system turn is also added per row inside the existing error handling, so a malformed row is dropped on its own rather than failing the whole dataset. --------- Co-authored-by: Etherl <[email protected]> (cherry picked from commit ed6d0e8)
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
* Train a dataset's system column as the system prompt * Keep rows trainable when the system column cannot be rendered Templates that reject a system role (codegemma's own template, for one) now train the conversation without the column instead of dropping every row that has one. The system turn is also added per row inside the existing error handling, so a malformed row is dropped on its own rather than failing the whole dataset. --------- Co-authored-by: Etherl <[email protected]> (cherry picked from commit ed6d0e8)
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: de5890816d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| text = _render_conversation(tokenizer, with_system) | ||
| except Exception: | ||
| # A template without a system role still trains the conversation. | ||
| if with_system is convo: | ||
| raise | ||
| text = _render_conversation(tokenizer, convo) |
There was a problem hiding this comment.
Probe injected system turns before choosing a template
When get_tokenizer_chat_template installs an override that renders the original conversation but rejects system roles, while the checkpoint's own template accepts them, resolve_dataset_chat_template keeps the override because its compatibility probe runs before _with_system_turn is applied. This fallback then successfully rerenders every row without the system turn, silently discarding the entire system column even though the original template could have trained it; include the injected system turns in template selection before caching the chosen template.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Every override template in TEMPLATE_TO_MODEL_MAPPER renders a leading system turn (checked by rendering [system, user, assistant] through each), so an override that drops the system column while the model's own template keeps it does not occur with the shipped templates.
| isinstance(system, str) | ||
| and system.strip() | ||
| and convo | ||
| and isinstance(convo[0], dict) |
There was a problem hiding this comment.
Allow the system column to populate an empty conversation
When a detected ChatML dataset contains an empty conversation row with a nonblank system value, this truthiness check prevents creating the otherwise valid system-only conversation. Templates such as the ChatML and Zephyr templates can render a sole system turn, but they instead receive [] and may produce an empty training sample, so that row's only content is silently lost; permit insertion when convo is an empty list as well.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
A row with an empty conversation has no user or assistant turn to train; a system-only sample is not a training example, and the output for such rows is unchanged from before this PR.
| def _format_chatml(examples): | ||
| convos = examples[chat_column] | ||
| systems = examples.get("system") or [None] * len(convos) |
There was a problem hiding this comment.
Handle system columns before format-specific exits
This is the only new read of the separate system column, so supported paths that do not reach the ChatML renderer still discard it: selecting format_type="alpaca" for ChatML/ShareGPT input converts the conversation and removes the source columns before this point, while is_vlm=True returns from format_and_template_dataset and its collators render only messages. In both cases training succeeds but silently omits every separate system prompt; inject the turn before format conversion/dispatch or add equivalent handling to those paths.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in a934538 for the Alpaca target format: convert_chatml_to_alpaca now fills a separate system column in as the leading system turn when the conversation has none. The VLM path renders only messages through its own collator and is left out of this text-dataset change.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…ai#12614) * Revert "Studio: lift a carried model picker row like a sidebar chat, and lighten both drag copies" (unslothai#12499) This reverts commit 9838541. It was merged before Codex review converged; it will be re-opened for review. * Revert "fix(studio): WSL2 Windows localhost hint in startup banner (unslothai#11187)" (unslothai#11361) This reverts commit cd4d5c1. It was merged before Codex review converged; it will be re-opened for review. * Revert "Studio: stop rejecting --mmproj-device CUDA1 when gpu_ids are saved" (unslothai#12505) This reverts commit a91ee37. It was merged before Codex review converged; it will be re-opened for review. * Revert "Studio: renew the chat-run lease while long prefill is still advancing" (unslothai#12523) This reverts commit d8740d3. It was merged before Codex review converged; it will be re-opened for review. * Revert "Count only the lock's own waits in the unlockable-filesystem row" (unslothai#12529) This reverts commit 5b78baf. It was merged before Codex review converged; it will be re-opened for review. * Revert "Studio: move torchao int8 weights back to the GPU after an oversized request streams pinned groups" (unslothai#12526) This reverts commit d883d2d. It was merged before Codex review converged; it will be re-opened for review. * Revert "Studio: use ComfyUI's default settings for FLUX.1, Qwen-Image, Z-Image, Ideogram 4, Wan2.2 and HunyuanVideo-1.5" (unslothai#12516) This reverts commit fd2522b. It was merged before Codex review converged; it will be re-opened for review. * Revert "Parity: keep the reap-margin check off the edge of its own window" (unslothai#12514) This reverts commit dae96ea. It was merged before Codex review converged; it will be re-opened for review. * Revert "Studio: train a dataset's system column as the system prompt" (unslothai#12486) This reverts commit ed6d0e8. It was merged before Codex review converged; it will be re-opened for review. * Revert "fix(studio): prevent IME confirmation from submitting chat renames" (unslothai#12475) This reverts commit 079dc91. It was merged before Codex review converged; it will be re-opened for review. * Studio: train a dataset's system column as the system prompt (unslothai#12486) * Train a dataset's system column as the system prompt * Keep rows trainable when the system column cannot be rendered Templates that reject a system role (codegemma's own template, for one) now train the conversation without the column instead of dropping every row that has one. The system turn is also added per row inside the existing error handling, so a malformed row is dropped on its own rather than failing the whole dataset. --------- Co-authored-by: Etherl <[email protected]> (cherry picked from commit ed6d0e8) * Studio: train a dataset's system column as the system prompt (unslothai#12486) * Train a dataset's system column as the system prompt * Keep rows trainable when the system column cannot be rendered Templates that reject a system role (codegemma's own template, for one) now train the conversation without the column instead of dropping every row that has one. The system turn is also added per row inside the existing error handling, so a malformed row is dropped on its own rather than failing the whole dataset. --------- Co-authored-by: Etherl <[email protected]> (cherry picked from commit ed6d0e8) * Studio: keep a dataset's system column when converting ChatML to Alpaca --------- Co-authored-by: Etherl <[email protected]> Co-authored-by: Nilay <[email protected]>
An Alpaca dataset with a per-row system prompt (system, instruction, input, output, the layout LLaMA-Factory documents) is detected as Alpaca with no mapping needed, but the system text never reaches a training row. Every row gets the fixed "Below is an instruction..." preamble instead, so the persona, rules or tool list kept in that column are silently lost, and nothing in the preview or the run warns about it. A non-empty text system cell now takes the place of the default preamble in that row. For models without their own chat template, this is the same layout Studio saves as the Alpaca chat template, which puts a system message in place of the preamble at inference. Rows with no system column, a blank one, or a non-text value are formatted exactly as before. Only a column named exactly "system" is read, the same rule the ShareGPT and ChatML path follows since unslothai#12614. Mapped Alpaca columns and chat data converted to Alpaca keep their current layout, where system text goes into the Input section. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Re-opens #12486 for review. It was merged before its review converged and was reverted in #12569.
The change is the original squash commit, cherry-picked unchanged (
git cherry-pick -x ed6d0e85a), with authorship kept for @NilayYadav. The full description and discussion are on #12486.#12569 has merged, so this PR targets
mainand its diff shows only this change.