text: 
  
  TITLE
  Print All Tokens Over a Certain Probability Threshold: T5 
  
  COMMENTS
  2
  
  REACTIONS
  +1: 0
  -1: 0
  laugh: 0
  hooray: 0
  heart: 0
  rocket: 0
  eyes: 0
  
  BODY
  `This works with GPT-2, but not with T5. Is it possible to adapt this to make T5 work? This works with GPT-2, but not with T5. Is it possible to adapt this to make T5 work?`
  
  ```
  import torch
  import torch.nn.functional as F
  from transformers import AutoTokenizer, AutoModelWithLMHead
  tokenizer = AutoTokenizer.from_pretrained("t5-base")
  model = AutoModelWithLMHead.from_pretrained("t5-base")
  input_txt = "Hello, my name is Sylvain."
  inputs = tokenizer(input_txt, return_tensors='pt')
  outputs = model(**inputs)
  predictions = F.softmax(outputs[0], dim=-1)
  thresh = 1e-2
  vocab_size = predictions.shape[-1]
  idxs = torch.arange(0, vocab_size)[predictions[0][-1] >= thresh]
  print(tokenizer.convert_ids_to_tokens(idxs))
  ```
  
  `ValueError: You have to specify either decoder_inputs or decoder_inputs_embeds`