PygmalionAI / aphrodite-engine

Large-scale LLM inference engine
https://aphrodite.pygmalion.chat
GNU Affero General Public License v3.0
926 stars 100 forks source link

[Feature]: Implementation of DRY sampler. #574

Open Abdulhanan535 opened 1 month ago

Abdulhanan535 commented 1 month ago

🚀 The feature, motivation and pitch

Majority of the bots repeat sentences and due to that, it's annoying.

Implementing DRY sampler for Aphrodite Engine.

DRY is a sampler that forces the model to not repeat while mantaining the quality or even improving it, some of the backends have already support for this.

Alternatives

No response

Additional context

No response

81549361 commented 1 month ago

+1 https://github.com/LostRuins/koboldcpp/pull/982

AlpinDale commented 1 month ago

Might be interesting to add. I currently don't have the bandwidth to tackle this. I may have the time after the 0.5.4 release, but if someone else wants to take over for now, it should be quite easy:

  1. Add the parameters related to the DRY sampler here: https://github.com/PygmalionAI/aphrodite-engine/blob/rc_054/aphrodite/common/sampling_params.py

  2. Define the sampler's metadata here. e.g. the conditions for triggering it (could be a related sampler param being set to higher than 0, etc) and create the necessary tensors. Plenty of examples here so you won't be lost: https://github.com/PygmalionAI/aphrodite-engine/blob/rc_054/aphrodite/modeling/sampling_metadata.py

  3. Finally, implement the actual sampler logic here: https://github.com/PygmalionAI/aphrodite-engine/blob/rc_054/aphrodite/modeling/layers/sampler.py

Should be plenty of examples at each step from other samplers. Please make sure you contribute to the rc_054 branch, unless you're reading this in a few weeks and that branch is merged into main.

Abdulhanan535 commented 1 week ago

any chance for this?

Abdulhanan535 commented 1 week ago

like this ``