LAION-AI / LAION-AI/Open-Assistant
Tokenizers padding_side was not validate to be "right" in trainer_sft.py
Open
@andreaskoepf is already working on this.
Since Aug 17, 2023.
bug
ml
- Dominant language
- Python
- Stars
- 37.4k
- Forks
- 3.3k
- PR merge metrics
- No merged PRs in 30d
Description
from transformers import AutoTokenizer
AutoTokenizer.from_pretrained("OpenAssistant/llama2-13b-orca-8k-3319").padding_side
>> 'left'
AutoTokenizer.from_pretrained("TheBloke/Llama-2-13B-fp16")
>> 'left'
AutoTokenizer.from_pretrained("mosaicml/mpt-7b").padding_side
>> 'right'
AutoTokenizer.from_pretrained("huggyllama/llama-7b").padding_side
>> 'left'
AutoTokenizer.from_pretrained("OpenAssistant/llama-30b-sft-v8.2-2.4k-steps-system").padding_side
>> 'left'
Since llama models are using left padding, the supervised training dialoguecollator would cause the label_mask to pad in a different direction as the tokenizer.pad (input_ids, attention_mask), as torch.stack (label_mask) implements the right padding strategy.
Printing out the dataloader results in trainer_sft.py would also verify the issue
train_dataloader = DataLoader(train, collate_fn=train_collate_fn, batch_size=9, shuffle=True)
for batch in train_dataloader:
for idx, question in enumerate(batch['input_ids']):
print('-------')
print(tokenizer.decode(question[batch['label_masks'][idx]]).replace('</s>', '')+'\n')
I think there's no padding_side assigned to right in the trainer_sft.py pipeline, so by default llama models we have trained are bit faulty
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.