You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature] Support tokenized datasets in Unsloth Studio #7139
Would it be possible to add tokenized datasets support for training In Unsloth Studio? This is in order to use a mixed dataset with multiple formats (FIM, conversational...) pre-tokenized with a custom function (computing assistant loss too, with fields input_ids, attention_mask, labels).
Pretokenized datasets are already supported by the underlying trainers on both CUDA and MLX, but Unsloth Studio does not currently route this dataset format.
On CUDA, you can pass the dataset directly to TRL:
importunslothfromunslothimportFastLanguageModelfromdatasetsimportload_datasetfromtrlimportSFTConfig, SFTTrainer# Load the model and configure LoRA as in the regular Unsloth notebook.model, tokenizer=FastLanguageModel.from_pretrained(...)
model=FastLanguageModel.get_peft_model(...)
dataset=load_dataset("your_dataset", split="train")
trainer=SFTTrainer(
model=model,
processing_class=tokenizer,
train_dataset=dataset,
args=SFTConfig(
max_length=2048,
packing=False,
),
)
Rows can contain input_ids and custom labels; the labels will be preserved. Don’t provide a formatting function or apply train_on_responses_only, since your labels already define the training objective. Use unpadded token sequences and keep packing disabled for custom labels.
Fixed! Sorry on the delay. Studio now recognises datasets that only hold input_ids (plus optional attention_mask and labels) as pre-tokenized and trains on them as-is, so the column mapping prompt no longer appears. Your custom labels are kept as the training target, rows longer than the max sequence length are truncated, and token ids outside the model's vocabulary give a clear error. Fixed in #13816.
To update: Unsloth Desktop will have an update banner. For Studio, use unsloth studio update. For Docker, use docker exec <container> unsloth-studio-update. Reopen if it still happens.
Activity
Lyxot commentedon Jul 16, 2026
Pretokenized datasets are already supported by the underlying trainers on both CUDA and MLX, but Unsloth Studio does not currently route this dataset format.
On CUDA, you can pass the dataset directly to TRL:
Rows can contain
input_idsand customlabels; the labels will be preserved. Don’t provide a formatting function or applytrain_on_responses_only, since your labels already define the training objective. Use unpadded token sequences and keep packing disabled for custom labels.thomasmaindron commentedon Jul 16, 2026
Yeah I know that's what I've been doing, but I was wondering if this could be supported in Unsloth Studio too.
danielhanchen commentedon Oct 15, 2026
Fixed! Sorry on the delay. Studio now recognises datasets that only hold
input_ids(plus optionalattention_maskandlabels) as pre-tokenized and trains on them as-is, so the column mapping prompt no longer appears. Your customlabelsare kept as the training target, rows longer than the max sequence length are truncated, and token ids outside the model's vocabulary give a clear error. Fixed in #13816.To update: Unsloth Desktop will have an update banner. For Studio, use
unsloth studio update. For Docker, usedocker exec <container> unsloth-studio-update. Reopen if it still happens.