Hi, one way to do that is to modify generation_utils

  
      
      huggingface.co
  
  
    

transformers.generation_utils — transformers 3.5.0 documentation 38



  
  
    
    
  
  


For examples, we can extract logits of greedy search in the scores variable (there are many options on next-token search eg. greedy, beam or sample searches)