NVIDIA / NeMo-Aligner

Scalable toolkit for efficient model alignment
Apache License 2.0
620 stars 78 forks source link

fix: pad_id=None in tokenizer no longer errors for TRTLLM generation #288

Closed terrykong closed 1 month ago

terrykong commented 2 months ago

What does this PR do ?

Fixes a crash that occurs when using llama3 tokenizers since they don't have a pad_id in their huggingface tokenizer.

The fix is to use an out of bounds id if there's no pad_id, then swap it with eos_id right after generation. Credit to @gshennvm for the idea

Changelog

Usage

# Add a code snippet demonstrating how to use this 

Before your PR is "Ready for review"

Pre checks:

Checklist when contributing a new algorithm

Additional Information