transformers icon indicating copy to clipboard operation
transformers copied to clipboard

How to get the score of each token when using pipeline

Open xin0623 opened this issue 1 year ago • 1 comments

pipe = pipeline( "text-generation", model=model, tokenizer=tokenizer, max_new_tokens=512, do_sample=True, temperature=0.7, top_p=0.95, top_k=40, repetition_penalty=1.1, output_scores=True )

The model I use is Qwen2-7B-Instruct. When I try to output the score of each token by modifying the parameters, it doesn't work.

xin0623 avatar Aug 26 '24 07:08 xin0623

Hey! You might want return_dict_in_generate see https://huggingface.co/docs/transformers/en/internal/generation_utils#generate-outputs

ArthurZucker avatar Aug 27 '24 13:08 ArthurZucker

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Sep 25 '24 08:09 github-actions[bot]

HI, Have you found a way now? How to get the score of each token when using pipeline? @xin0623

dengxiaotian123 avatar Mar 06 '25 08:03 dengxiaotian123