Lightning-AI / Lightning-AI/litgpt

How to apply no_repeat_ngram_size and penalty_alpha in the generation

Open
#906 0 comments 1 reaction 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.