Skip to content

[Bug] UnslothSFTTrainer is outdated and can not recognize dataset with ["messages"] #323

Description

@steveepreston

In trl SFTTrainer you can pass dataset with only ["messages"] and follows system/user/assistant standard messages style.
but UnslothSFTTrainer is not synced with recent versions of SFTTrainer and have struggle:

 File "/workspace/unsloth-ft/wtf.py", line 45, in <module>
    test_labelonly()
  File "/workspace/unsloth-ft/wtf.py", line 21, in test_labelonly
    trainer = SFTTrainer(
              ^^^^^^^^^^^
  File "/workspace/miniconda3/envs/persona/lib/python3.12/site-packages/unsloth/trainer.py", line 209, in new_init
    original_init(self, *args, **kwargs)
  File "/workspace/unsloth-ft/unsloth_compiled_cache/UnslothSFTTrainer.py", line 1219, in __init__
    super().__init__(
  File "/workspace/unsloth-ft/unsloth_compiled_cache/UnslothSFTTrainer.py", line 628, in __init__
    train_dataset = self._prepare_dataset(
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/unsloth-ft/unsloth_compiled_cache/UnslothSFTTrainer.py", line 828, in _prepare_dataset
    raise RuntimeError("Unsloth: You must specify a `formatting_func`")
RuntimeError: Unsloth: You must specify a `formatting_func`

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions