# Custom Decoding Strategy

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcustom-decoding-strategy%2F64846%3E%5C
**Category:** Beginners\
**Created:** [December 6, 2023, 9:55pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcustom-decoding-strategy%2F64846 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fcm2001)%5C
**Post date:** [December 6, 2023, 9:55pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcustom-decoding-strategy%2F64846%2F1 "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.
