Lightning-AI / Lightning-AI/litgpt
How to apply no_repeat_ngram_size and penalty_alpha in the generation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13.7k
- Forks
- 1.5k
- Avg merge
- 15h 37m
- Merged PRs (30d)
- 1
Description
Hi
I would like to know how to support both of `no_repeat_ngram_size` and `penalty_alpha` in `sample` method here:
[generate/base.py](https://github.com/Lightning-AI/lit-gpt/blob/93b0dc75158f287520db016a6e21f71de865104f/generate/base.py#L30)
references for both parameters:
[penalty_alpha ](https://huggingface.co/docs/transformers/main_classes/text_generation#transformers.GenerationMixin.contrastive_search.example)
[no_repeat_ngram_size](https://huggingface.co/docs/transformers/internal/generation_utils#transformers.NoRepeatNGramLogitsProcessor.example)
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.
Research direction
Start with generate/base.py at the sample method and read how generation options are currently handled. Compare the requested no_repeat_ngram_size and penalty_alpha references with the existing method interface. Done means both options are supported together in sample, with behavior matching their documented purposes; no tests are named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100