Skip to content

[Feature] Support tokenized datasets in Unsloth Studio #7139

Closed

Description

@thomasmaindron

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).

Activity

  1. added
    feature request
    on Jul 15, 2026
  2. Lyxot commented on Jul 16, 2026

    @Lyxot
    Collaborator

    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:

    import unsloth
    
    from unsloth import FastLanguageModel
    from datasets import load_dataset
    from trl import SFTConfig, 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.

  3. thomasmaindron commented on Jul 16, 2026

    @thomasmaindron
    Author

    Yeah I know that's what I've been doing, but I was wondering if this could be supported in Unsloth Studio too.

  4. danielhanchen commented on Oct 15, 2026

    @danielhanchen
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

feature request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions