Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tensorrt_llm/serve/openai_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ def to_sampling_params(self, vocab_size: int = 32000) -> SamplingParams:

# TODO: migrate to use logprobs and prompt_logprobs
_return_log_probs=bool(self.logprobs),
)
logprobs=bool(self.logprobs))
return sampling_params

@model_validator(mode='before')
Expand Down
2 changes: 1 addition & 1 deletion tensorrt_llm/serve/postprocess_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def create_logprobs(token_ids: List[int],
# returning multiple logprobs is not supported
first_logprob = ChatCompletionLogProbsContent(
token=token,
logprob=max(logprob, -9999.0),
logprob=max(logprob[token_id].logprob, -9999.0),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break TRT flow IIRC.

@jhaotingc jhaotingc Aug 13, 2025 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't test, but that's the data format I got after I sent "logprobs": true to /v1/chat/completions, for both torch and trt sampler.

What's the way to sent the curl and have you checked if 6097 fix the issue (correctly get logprob from pytorch flow).

If you've verified the function works on 6097, we don't need this fix. Thanks!!

bytes=list(token.encode("utf-8", errors="replace")))
content.append(first_logprob)
chat_logprobs = ChatCompletionLogProbs(content=content)
Expand Down