# Custom Decoding Strategy

**URL:** <https://discuss.huggingface.co/t/custom-decoding-strategy/64846>\
**Category:** Beginners\
**Created:** [December 6, 2023, 9:55pm UTC](https://discuss.huggingface.co/t/custom-decoding-strategy/64846 "2023-12-06T21:55:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cm2001](https://avatars.discourse-cdn.com/v4/letter/c/ad7895/32.png) [@cm2001](https://discuss.huggingface.co/u/cm2001)\
**Post date:** [December 6, 2023, 9:55pm UTC](https://discuss.huggingface.co/t/custom-decoding-strategy/64846/1 "2023-12-06T21:55:33Z")

</div>

Hi,

I am currently working on a project that involves controllable text generation.  
To do this, I am making a ‘post-processing module’ which involves reranking the logits during the decoding process.

To start, I have forked transformers, and added a new GenerationMode to the GenerationMixin.  
(GenerationMode.TEST\_GREEDY\_SEARCH) for this example.

Within the greedy\_search(), I believe next\_tokens\_scores would be the logits scores for the tokens? I am not sure.

One of the problems is I need to decode the tokens of the logits into the human readable word to use it in my post processing module. At the moment I am just importing the tokeniser I need into the function, but I do not know how to get the current tokens.

In summary, I need the token, and its probability, for each of the logits.

Any help would be greatly appreciated.
