Skip to content
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

[Imports] cache import checks. #7459

Closed
wants to merge 2 commits into from
Closed

[Imports] cache import checks. #7459

wants to merge 2 commits into from

Conversation

sayakpaul
Copy link
Member

@sayakpaul sayakpaul commented Mar 25, 2024

What does this PR do?

Similar to huggingface/peft#1576.

Would have been nicer to use a combination of cache and lru_cache. The latter is in cases where the imports are used more than the others. But our minimum Python requirement is 3.8, so, cache won't be available.

@sayakpaul sayakpaul requested review from BenjaminBossan and DN6 March 25, 2024 01:35
@HuggingFaceDocBuilderDev

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

@BenjaminBossan BenjaminBossan left a comment

Choose a reason for hiding this comment

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

I think this change eshould not be necessary. In diffusers, the importlib.util.find_spec is done on the root level and stored in a constant, e.g. _torch_available. Therefore, the is_torch_available function does not call importlib.util.find_spec again, unlike in PEFT, and the original issue should not manifest here.

@sayakpaul
Copy link
Member Author

Ah right.

@sayakpaul sayakpaul closed this Mar 25, 2024
@sayakpaul sayakpaul deleted the improve-imports branch March 25, 2024 11:18
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.

3 participants