Skip to content

Regarding the behavior of max_seq_length in SFTTrainer #2400

Description

@Taiki-azrs

The SFTTrainer documentation states:

SFTTrainer always pads by default the sequences to the max_seq_length argument of the SFTTrainer.
https://huggingface.co/docs/trl/main/en/sft_trainer#best-practices

However, when looking at the actual code, the Tokenizer appears to have padding=False, and it does not seem to pad sequences to the max_seq_length value.
https://github.com/huggingface/trl/blob/main/trl/trainer/sft_trainer.py#L420

How does SFTTrainer ensure that sequences are padded to the max_seq_length value?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions