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

ImportError: cannot import name 'CLIPVisionModelWithProjection' from 'transformers' #95

Open
mothormothormothor opened this issue Nov 23, 2022 · 5 comments

Comments

@mothormothormothor
Copy link

mothormothormothor commented Nov 23, 2022

Hey there,

I get this error since today. I changed nothing until the last time I used the notebook. Does somebody have a solution for this ?
I'm running Colab on a A100.

thanks
xoxo

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /content/stable-dreamfusion/main.py:138 in │
│ │
│ 135 │ │ # scheduler = lambda optimizer: optim.lr_scheduler.OneCycleLR(optimizer, max_lr= │
│ 136 │ │ │
│ 137 │ │ if opt.guidance == 'stable-diffusion': │
│ ❱ 138 │ │ │ from nerf.sd import StableDiffusion │
│ 139 │ │ │ guidance = StableDiffusion(device) │
│ 140 │ │ elif opt.guidance == 'clip': │
│ 141 │ │ │ from nerf.clip import CLIP │
│ │
│ /content/stable-dreamfusion/nerf/sd.py:2 in │
│ │
│ 1 from transformers import CLIPTextModel, CLIPTokenizer, logging │
│ ❱ 2 from diffusers import AutoencoderKL, UNet2DConditionModel, PNDMScheduler │
│ 3 │
│ 4 # suppress partial model loading warning │
│ 5 logging.set_verbosity_error() │
│ │
│ /usr/local/lib/python3.7/dist-packages/diffusers/init.py:32 in │
│ │
│ 29 │ │ get_scheduler, │
│ 30 │ ) │
│ 31 │ from .pipeline_utils import DiffusionPipeline │
│ ❱ 32 │ from .pipelines import ( │
│ 33 │ │ DanceDiffusionPipeline, │
│ 34 │ │ DDIMPipeline, │
│ 35 │ │ DDPMPipeline, │
│ │
│ /usr/local/lib/python3.7/dist-packages/diffusers/pipelines/init.py:18 in │
│ │
│ 15 │ from ..utils.dummy_pt_objects import * # noqa F403 │
│ 16 │
│ 17 if is_torch_available() and is_transformers_available(): │
│ ❱ 18 │ from .alt_diffusion import AltDiffusionImg2ImgPipeline, AltDiffusionPipeline │
│ 19 │ from .latent_diffusion import LDMTextToImagePipeline │
│ 20 │ from .stable_diffusion import ( │
│ 21 │ │ CycleDiffusionPipeline, │
│ │
│ /usr/local/lib/python3.7/dist-packages/diffusers/pipelines/alt_diffusion/init.py:33 in │
│ │
│ │
│ 30 │
│ 31 if is_transformers_available() and is_torch_available(): │
│ 32 │ from .modeling_roberta_series import RobertaSeriesModelWithTransformation │
│ ❱ 33 │ from .pipeline_alt_diffusion import AltDiffusionPipeline │
│ 34 │ from .pipeline_alt_diffusion_img2img import AltDiffusionImg2ImgPipeline │
│ 35 │
│ │
│ /usr/local/lib/python3.7/dist-packages/diffusers/pipelines/alt_diffusion/pipeline_alt_diffusion. │
│ py:35 in │
│ │
│ 32 │ PNDMScheduler, │
│ 33 ) │
│ 34 from ...utils import deprecate, logging │
│ ❱ 35 from ..stable_diffusion.safety_checker import StableDiffusionSafetyChecker │
│ 36 from . import AltDiffusionPipelineOutput, RobertaSeriesModelWithTransformation │
│ 37 │
│ 38 │
│ │
│ /usr/local/lib/python3.7/dist-packages/diffusers/pipelines/stable_diffusion/init.py:33 in │
│ │
│ │
│ 30 if is_transformers_available() and is_torch_available(): │
│ 31 │ from .pipeline_cycle_diffusion import CycleDiffusionPipeline │
│ 32 │ from .pipeline_stable_diffusion import StableDiffusionPipeline │
│ ❱ 33 │ from .pipeline_stable_diffusion_image_variation import StableDiffusionImageVariation │
│ 34 │ from .pipeline_stable_diffusion_img2img import StableDiffusionImg2ImgPipeline │
│ 35 │ from .pipeline_stable_diffusion_inpaint import StableDiffusionInpaintPipeline │
│ 36 │ from .pipeline_stable_diffusion_inpaint_legacy import StableDiffusionInpaintPipeline │
│ │
│ /usr/local/lib/python3.7/dist-packages/diffusers/pipelines/stable_diffusion/pipeline_stable_diff │
│ usion_image_variation.py:22 in │
│ │
│ 19 │
│ 20 import PIL │
│ 21 from diffusers.utils import is_accelerate_available │
│ ❱ 22 from transformers import CLIPFeatureExtractor, CLIPVisionModelWithProjection │
│ 23 │
│ 24 from ...models import AutoencoderKL, UNet2DConditionModel │
│ 25 from ...pipeline_utils import DiffusionPipeline │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ImportError: cannot import name 'CLIPVisionModelWithProjection' from 'transformers'
(/usr/local/lib/python3.7/dist-packages/transformers/init.py)

@gianluigidalessandro
Copy link

I am having the same problem.

@XinandYu
Copy link

huggingface/diffusers#1377

This might be helpful

@anton-l
Copy link

anton-l commented Nov 24, 2022

Fixed in a patch release 0.8.1: https://github.com/huggingface/diffusers/releases/tag/v0.8.1
⚠️ Please upgrade with pip install --upgrade diffusers or pip install diffusers==0.8.1

@mothormothormothor
Copy link
Author

pip install diffusers==0.8.1

this one worked! thank you very much :-)

@saipheblue
Copy link

saipheblue commented Aug 16, 2023

  • pip install diffusers==0.8.1

worked for me as well ! Thank you

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

No branches or pull requests

5 participants