-
Notifications
You must be signed in to change notification settings - Fork 657
[Logprobs]Support prompt_logprobs and max_logprobs #4897
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
Changes from all commits
fbd6840
58334f0
29b14f0
eb8747d
6bdb4d9
6394644
62a39b4
a2119ba
b152064
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -285,6 +285,19 @@ def _process_batch_output_use_zmq(self, receive_datas): | |||||||||||
| finished=False, | ||||||||||||
| metrics=metrics, | ||||||||||||
| ) | ||||||||||||
| if self.use_logprobs: | ||||||||||||
| if getattr(stream_data, "logprobs", None) is not None: | ||||||||||||
| try: | ||||||||||||
| logprobs_list: LogprobsLists = stream_data.logprobs.tolists() | ||||||||||||
| result.outputs.logprob = float(logprobs_list.logprobs[0][0]) | ||||||||||||
| result.outputs.top_logprobs = logprobs_list | ||||||||||||
| except Exception as e: | ||||||||||||
| llm_logger.warning(f"Failed to parse logprobs from StreamTransferData: {e}") | ||||||||||||
| if getattr(stream_data, "prompt_logprobs", None) is not None: | ||||||||||||
| try: | ||||||||||||
| result.prompt_logprobs_tensors = stream_data.prompt_logprobs | ||||||||||||
| except Exception as e: | ||||||||||||
| llm_logger.warning(f"Failed to parse prompt_logprobs from StreamTransferData: {e}") | ||||||||||||
|
Comment on lines
+297
to
+300
|
||||||||||||
| try: | |
| result.prompt_logprobs_tensors = stream_data.prompt_logprobs | |
| except Exception as e: | |
| llm_logger.warning(f"Failed to parse prompt_logprobs from StreamTransferData: {e}") | |
| result.prompt_logprobs_tensors = stream_data.prompt_logprobs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable name shadowing in dictionary comprehension. The parameter
rankon line 465 is shadowed by the loop variablerankon line 493. This causes the function to use the loop variable instead of the parameter value, which is incorrect. The loop variable should be renamed (e.g.,token_rank) to avoid shadowing the parameter.