diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

[Dummy imports] Better error message

Open patrickvonplaten opened this issue 3 years ago • 4 comments

This PR adds from_config and from_pretrained dummy class methods to all dummy classes.

Running:

pytest -sv tests/test_pipelines.py::PipelineFastTests::test_stable_diffusion_k_lms

without scipy installed now yields:

E           ImportError: 
E           LMSDiscreteScheduler requires the scipy library but it was not found in your environment. You can install it with pip: `pip install
E           scipy`

as expected. Thanks for flagging @pcuenca

patrickvonplaten avatar Oct 10 '22 16:10 patrickvonplaten

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

Very cool!

Loading the scheduler shows the nice error, but loading the pretrained pipeline still gives the cryptic message to me:

        pipe = StableDiffusionPipeline.from_pretrained("hakurei/waifu-diffusion")

pcuenca avatar Oct 10 '22 16:10 pcuenca

@patrickvonplaten I created a test to load a pipeline that uses the LMS Discrete scheduler. It currently fails with a cryptic error message if scipy is not installed. I'll try to debug it later.

pcuenca avatar Oct 11 '22 19:10 pcuenca

If dummy_torch_and_scipy_objects.LMSDiscreteScheduler inherited from SchedulerMixin then it would be a load candidate and the nice error message would be presented. But I'm not sure how to achieve that with the current system.

Another option is to detect None here and show an error with the class name that we are attempting and failing to load.

What do you think?

pcuenca avatar Oct 11 '22 19:10 pcuenca

@patrickvonplaten I created a test to load a pipeline that uses the LMS Discrete scheduler. It currently fails with a cryptic error message if scipy is not installed. I'll try to debug it later.

Thanks, checking it out now!

patrickvonplaten avatar Oct 12 '22 11:10 patrickvonplaten