Skip to content

fix dummy import for AudioLDM2 #4741

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

Merged
merged 2 commits into from
Aug 23, 2023
Merged

fix dummy import for AudioLDM2 #4741

merged 2 commits into from
Aug 23, 2023

Conversation

patil-suraj
Copy link
Contributor

What does this PR do?

fix dummy import for AudioLDM2

@sayakpaul
Copy link
Member

Not sure it wasn't caught in the CI :(

@patil-suraj
Copy link
Contributor Author

I'm getting import errors locally when my transformers version is old, so it should return dummy objects, but the dummy objects are wrong. Also even though it's not caught in CI, why do we import the dummy AudioLDMPipeline instead of the dummy AudioLDM2Pipeline ?

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Aug 23, 2023

The documentation is not available anymore as the PR was closed or merged.

@patil-suraj
Copy link
Contributor Author

Colab to reproduce: https://colab.research.google.com/drive/1BFDZWqHWj1eaQeSZX44SU4kyJXO7g4P3?usp=sharing
This breaks any imports from diffusers if the required transformer version is not met.

@sayakpaul
Copy link
Member

I don't immediately see any problem with make fix-copies. Maybe it slipped through the PR reviews.

@patil-suraj
Copy link
Contributor Author

I've attached colab to reproduce the issue.

@sayakpaul
Copy link
Member

This breaks any imports from diffusers if the required transformer version is not met.

But from the looks of it, the error shouldn't be dependent on the transformers version, no?

@patil-suraj
Copy link
Contributor Author

You can try the colab to reproduce the issue.

@patil-suraj
Copy link
Contributor Author

This should not happen as we don't have hard dep on transformers version, imports should work for transformers<"4.27.0"

@sayakpaul
Copy link
Member

sayakpaul commented Aug 23, 2023

A bit confused here.

I was able to do:

!pip install git+https://github.com/huggingface/diffusers.git

And then:

from diffusers import T2IAdapter

(no transformers installation)

@sayakpaul
Copy link
Member

ImportError: cannot import name 'AudioLDM2Pipeline' from 'diffusers.pipelines.audioldm2' (/usr/local/lib/python3.10/dist-packages/diffusers/pipelines/audioldm2/__init__.py)

Tells me that AudioLDM2Pipeline is not present in https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/__init__.py. Even though it's here:

from .audioldm2 import AudioLDM2Pipeline, AudioLDM2ProjectionModel, AudioLDM2UNet2DConditionModel
, it won't be able to execute because of .

But even with that https://github.com/huggingface/diffusers/blob/main/tests/others/test_dependencies.py should have caught it.

Copy link
Contributor

@patrickvonplaten patrickvonplaten left a comment

Choose a reason for hiding this comment

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

Great thanks! This is a tough issue to spot and here I don't expect our import tester to catch it.

@patrickvonplaten
Copy link
Contributor

@sayakpaul you need to install transformers==4.26 in order to see the bug

@sayakpaul
Copy link
Member

The CLAP model isn't available when transformers version is less than 4.27.0 so it should raise a dependency error.
But I guess it's not giving the right error message because of this:

.

Is my understanding correct?

Copy link
Contributor

@sanchit-gandhi sanchit-gandhi left a comment

Choose a reason for hiding this comment

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

Good catch - thanks @patil-suraj for the fix

@patrickvonplaten patrickvonplaten merged commit 709a642 into main Aug 23, 2023
@patil-suraj patil-suraj deleted the fix-audioldm2-import branch August 24, 2023 10:55
yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
AmericanPresidentJimmyCarter pushed a commit to AmericanPresidentJimmyCarter/diffusers that referenced this pull request Apr 26, 2024
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.

5 participants