diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

cannot import name 'StableDiffusionSafetyChecker' from 'diffusers.pipelines.stable_diffusion

Open The-Ramosian opened this issue 2 years ago • 4 comments

Describe the bug

Whenever you run the convert_original_stable_diffusion_to_diffusers.py in google colab it results in the error cannot import name 'StableDiffusionSafetyChecker' from 'diffusers.pipelines.stable_diffusion

Reproduction

run the code on google colab

Logs

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-9-9a9734a4a917> in <module>
     38 )
     39 from diffusers.pipelines.latent_diffusion.pipeline_latent_diffusion import LDMBertConfig, LDMBertModel
---> 40 from diffusers.pipelines.stable_diffusion import StableDiffusionSafetyChecker
     41 from transformers import AutoFeatureExtractor, BertTokenizerFast, CLIPTextModel, CLIPTokenizer
     42 

ImportError: cannot import name 'StableDiffusionSafetyChecker' from 'diffusers.pipelines.stable_diffusion' (/usr/local/lib/python3.7/dist-packages/diffusers/pipelines/stable_diffusion/__init__.py)

System Info

Google CoLab

The-Ramosian avatar Nov 12 '22 12:11 The-Ramosian

Hey @The-Ramosian,

Thanks for the issue, could you link a copy of a google colab here?

patrickvonplaten avatar Nov 16 '22 21:11 patrickvonplaten

sure, here https://colab.research.google.com/drive/1dYH64Jc9qgfZlyDRUnl96v15FE0KxK3o?usp=sharing

The-Ramosian avatar Nov 18 '22 03:11 The-Ramosian

Hey @The-Ramosian,

Could you instead use the following code snippet to import the safety checker:

from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker

-> tested this and it should work

patrickvonplaten avatar Nov 20 '22 19:11 patrickvonplaten

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Dec 15 '22 15:12 github-actions[bot]