In text-generation
pipeline, I am looking for a parameter which calculates the confidence score of the generated text. Source: here
I am assuming that, output_scores
(from here) parameter is not returned while prediction,
Code:
predictedText = pipeline('text-generation',model=checkpoint_path, tokenizer=gpt2_tokenizer, config={'max_length':20, 'output_scores':True})
predictedText('This is a ')
Output:
Setting
pad_token_idto
eos_token_id:50256 for open-end generation. [{'generated_text': 'This is a Generated Text'}]
In the output, I am looking for a confidence score of the predicted text to be displayed
1 Like
the text-generation
pipeline doesn’t return scores, however you could the generate
method directly, to get the scores, this should help
3 Likes