[Feature] Add `logits_processor` to `GenerationConfig`
Open
- 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
Assessment
This issue has not been assessed yet.