-
Notifications
You must be signed in to change notification settings - Fork 20k
feat(ollama): logprobs support in Ollama #34218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat(ollama): logprobs support in Ollama #34218
Conversation
CodSpeed Performance ReportMerging #34218 will not alter performanceComparing Summary
Footnotes
|
|
Hi there, KeenBorder. It's my first time doing a pull request in a Github public repository and maybe you can help me. I've checked your modification in order to make my code work but it is harder than just add the params "logprobs" and "top_logprobs" to the constructor. I've modify the file with and it is working with the UQLM library. I needed to modify the functions "_chat_stream_with_aggregation" and "_iterate_over_stream" and its async counterparts in order to make it work. Here is the modified version: It is not finished yet because the top_logprobs does not work, but my plan is to finish it. How can I create the pull request when I have finished the job? Regards, |
|
Hi there @keenborder786 Thanks for your replies. With your solution I get:
With mine I get:
Regards, |
|
I've modify the last part to make the top_logprobs work if you want to check it out. Thanks in advance, Pablo |
|
@paascorb, I liked your approach better since it is synced with how we are getting other |
|
Hi @keenborder786 , the key is that it is not only necessary to add the parameters from the constructor, but also to receive the logprobs in each chunk. Please see the methods _chat_stream_with_aggregation and _iterate_over_stream. Especially lines 1089, 1090 and 1091. |
|
It will be passed through |


Issue: #34207
Description: Log probabilities have been enabled. The _chat method already returns a logprobs field (see source), which is inserted into generation_info and metadata is updated accordingly. Only the parameters need to be added to activate this feature.