Skip to content

[serve] fix request_id unexpected#40501

Merged
SunMarc merged 3 commits intomainfrom
fix-chat
Aug 28, 2025
Merged

[serve] fix request_id unexpected#40501
SunMarc merged 3 commits intomainfrom
fix-chat

Conversation

@SunMarc
Copy link
Copy Markdown
Member

@SunMarc SunMarc commented Aug 27, 2025

What does this PR do?

This PR fixes transformers serve as it is currently not working due to an unexpected field being passed request_id

reproducer

transformers serve
transformers chat localhost:8000 --model-name-or-path HuggingFaceTB/SmolLM3-3B

the second message will trigger an error.

@SunMarc SunMarc requested review from LysandreJik and gante August 27, 2025 15:57
@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@gante
Copy link
Copy Markdown
Contributor

gante commented Aug 27, 2025

@SunMarc it's the other way around, the chat shouldn't pass the request ID (it's not a field in the API) 🤗

I thought this was already solved, a user opened a related PR a few days ago. Perhaps not 🤔

@SunMarc
Copy link
Copy Markdown
Member Author

SunMarc commented Aug 27, 2025

@SunMarc it's the other way around, the chat shouldn't pass the request ID (it's not a field in the API) 🤗

I thought this was already solved, a user opened a related PR a few days ago. Perhaps not 🤔

Yeah, it is not part of the create oai api but this is why we are passing it in extra_body + TransformersCompletionCreateParamsStreaming no so that we can pass it in generate_chat_completion just like generation_config no ?
In generate_chat_completion, we try to get the request_id also request_id = req.get("request_id", "req_0")

@gante
Copy link
Copy Markdown
Contributor

gante commented Aug 27, 2025

@SunMarc that is logic that should be removed :p

The ID is something that is created by the server at generation time, mostly for internal server logging purposes. It is returned by the server (API), but not passed through a request.

@SunMarc
Copy link
Copy Markdown
Member Author

SunMarc commented Aug 27, 2025

Oh okay ! Then i'll just remove the request id from the extra_body then !

@SunMarc
Copy link
Copy Markdown
Member Author

SunMarc commented Aug 27, 2025

updated the logic in chat to not deal with request id ;)

Copy link
Copy Markdown
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

Ok!

@SunMarc SunMarc merged commit 8acbbdc into main Aug 28, 2025
16 checks passed
@SunMarc SunMarc deleted the fix-chat branch August 28, 2025 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants