-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Add thread-safe wrappers for components in pipeline (examples/server-async/utils/requestscopedpipeline.py) #12515
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: main
Are you sure you want to change the base?
Conversation
…oid race conditions
… and backward-compatible retrieve_timesteps
…eing moved to exmaples/server-async
….5 and Flux Pipelines
Refactor requestscopedpipeline.py to add thread-safe wrappers for tokenizer, VAE, and image processor. Introduce locking mechanisms to ensure thread safety during concurrent access.
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.
Thanks! Could the wrappers be moved to a separate Python file (maybe named wrappers.py
) and we use them from there in examples/server-async/utils/requestscopedpipeline.py
?
WDYT?
Ok, I'm going to move the wrappers to a separate file, and it was just an update to add wrappers to the VAE and the ImageProccesor to avoid memory leaks during decoding and saving of the image when the Pipeline is executed (requestscopedpipeline.py), sorry if it wasn't very clear |
Heeyyy @sayakpaul I already moved the wrappers to wrappers.py, check it out :b |
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. |
@bot /style |
Style bot fixed some files and pushed the changes. |
What does this PR do?
In the file
examples/server-async/utils/requestscopedpipeline.py
, add thread-safe wrappers for the tokenizer, VAE, and image processor. Introduce locking mechanisms to ensure thread safety during concurrent access.This improves memory safety when using the VAE and ImageProcessor wrappers, helping to avoid memory leaks.
Who can review?
Core library / Schedulers / Pipelines: @yiyixuxu, @asomoza, @sayakpaul
General / integrations: @DN6, @stevhliu