NLP, Deep Learning, Translation, Gpt 3, Data Science.
return_tensors='pt') mask_token_index = torch.where(bert_input == bert_tokenizer.mask_token_id)[1] bert_output = bert_model(bert_input) mask_token_logits = bert_output[0].logits[0, mask_token_index, :] mask_token_probs = torch.softmax(mask_token_logits, dim=1)