cache packages_distributions#11453
Merged
DN6 merged 5 commits intohuggingface:mainfrom May 1, 2025
vladmandic:import_utils_cache
Merged
cache packages_distributions#11453DN6 merged 5 commits intohuggingface:mainfrom vladmandic:import_utils_cache
DN6 merged 5 commits intohuggingface:mainfrom
vladmandic:import_utils_cache
Conversation
|
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. |
Signed-off-by: Vladimir Mandic <mandic00@live.com>
Collaborator
|
@DN6 could you take a look here too? |
DN6
approved these changes
May 1, 2025
Collaborator
DN6
left a comment
There was a problem hiding this comment.
Small nit. Could we make package_map and internal variable _package_map. Good to merge after.
Contributor
Author
|
@DN6 can you make the edits as you like? I'm really not sure on exactly what do you want as that introduces second variable that is not accessed anywhere else. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pr #11161 refactored
_is_package_available,but it introduced a major performance regression.
diffusers load now takes up to ~5sec while it was taking ~0.5sec earlier.
this is due to very expensive call to
importlib_metadata.packages_distributions()which is done for every single installed package (each call can be ~0.2sec and it quickly adds up).this pr simply changes the logic so the call is done once and cached.
result is that diffusers startup is back to 0.5sec as usual.
cc @yiyixuxu @sayakpaul @a-r-r-o-w