Skip to content

[serve] fix request_id unexpected - #40501

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

SunMarc merged 3 commits into
mainfrom
fix-chat

Conversation

@SunMarc

@SunMarc SunMarc commented Aug 27, 2025 •

Copy link
Copy Markdown
Member

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

gante commented Aug 27, 2025 •

Copy link
Copy Markdown
Contributor

@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

SunMarc commented Aug 27, 2025 •

Copy link
Copy Markdown
Member Author

@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

gante commented Aug 27, 2025

Copy link
Copy Markdown
Contributor

@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

SunMarc commented Aug 27, 2025

Copy link
Copy Markdown
Member Author

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

@SunMarc

SunMarc commented Aug 27, 2025

Copy link
Copy Markdown
Member Author

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

@LysandreJik LysandreJik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok!

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