InternLM / InternLM/lmdeploy

[Feature] 支持frequency_penalty采样

Open
#704 0 comments 0 reactions 0 assignees View on GitHub
backlog
Dominant language
Python
Stars
8.1k
Forks
748
Avg merge
6d 2h
Merged PRs (30d)
54

Description

### Motivation

当前lmdeploy支持repetition_penalty和presence_penalty。

而实际上只有repetition_penalty有效,LlamaBatch的sampling_params_仅初始化了以下几个参数列表:
![image](https://github.com/InternLM/lmdeploy/assets/103549265/1daa7a6f-81ac-4807-b07d-71cf79da9b30)

可以参考vllm支持frequency_penalty采样吗,frequency_penalty与presence_penalty规则类似,区别在于,presence_penalty只对出现过的token减去一次penalty,而frequency_penalty会对出现过的token减去n次penalty(n为token在序列中出现的次数)。也就是说相同的token出现次数越多,影响越大。
![image](https://github.com/InternLM/lmdeploy/assets/103549265/65e4af2b-1878-4d9a-bc85-024f987019ca)

### Related resources

_No response_

### Additional context

_No response_

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.