ashawkey / stable-dreamfusion

Text-to-3D & Image-to-3D & Mesh Exportation with NeRF + Diffusion.
Apache License 2.0
8.05k stars 713 forks source link

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

Open mothormothormothor opened 1 year ago

mothormothormothor commented 1 year ago

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 commented 1 year ago

I am having the same problem.

XinandYu commented 1 year ago

https://github.com/huggingface/diffusers/issues/1377

This might be helpful

anton-l commented 1 year ago

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

mothormothormothor commented 1 year ago

pip install diffusers==0.8.1

this one worked! thank you very much :-)

saipheblue commented 11 months ago

worked for me as well ! Thank you