Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
FredyRivera-dev wants to merge 44 commits into huggingface:main
base: main
Choose a base branch
Loading
from FredyRivera-dev:main

Conversation

@FredyRivera-dev
Copy link
Contributor

@FredyRivera-dev FredyRivera-dev commented Oct 21, 2025

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

FredyRivera-dev and others added 10 commits September 15, 2025 13:01
Refactor requestscopedpipeline.py to add thread-safe wrappers for tokenizer, VAE, and image processor. Introduce locking mechanisms to ensure thread safety during concurrent access.
@FredyRivera-dev FredyRivera-dev changed the title (削除) Add thread-safe wrappers for components in pipeline (削除ここまで) (追記) Add thread-safe wrappers for components in pipeline (examples/server-async/utils/requestscopedpipeline.py) (追記ここまで) Oct 21, 2025
Copy link
Member

@sayakpaul sayakpaul left a 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?

Copy link
Contributor Author

FredyRivera-dev commented Oct 21, 2025
edited
Loading

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

Copy link
Contributor Author

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.

Copy link
Member

@bot /style

Copy link
Contributor

github-actions bot commented Oct 21, 2025
edited
Loading

Style bot fixed some files and pushed the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sayakpaul sayakpaul sayakpaul left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /