InternLM / InternLM/lmdeploy

[Feature] Add `logits_processor` to `GenerationConfig`

Open
#2,305 3 comments 0 reactions 1 assignee Assigned to @AllentDan View on GitHub
Dominant language
Python
Stars
8.1k
Forks
748
Avg merge
6d 2h
Merged PRs (30d)
54

Description

### Motivation

Many `lmdeploy` counterparts(vllm, transformers, exllamav2...) provide `logits_processors` that allow users to modify the logits before softmax. This enables many useful features like constrained decoding, classifier-free guidance, custom repetition penalty, etc.

### Related resources

Huggingface API: https://huggingface.co/docs/transformers/en/internal/generation_utils#logitsprocessor
Vllm API: https://github.com/vllm-project/vllm/issues/1728

### Additional context

I wrote [a constrained decoding library](https://github.com/Dan-wanna-M/formatron) and is planning to integrate `lmdeploy` into my library.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.