I cant use with StableDiffusionImg2ImgPipeline

#8
by ardacik - opened

When i try to use StableDiffusionImg2ImgPipeline it's throws this error:

Traceback (most recent call last):
  File "D:\Projeler\animeMaker\ai\generate.py", line 74, in <module>
    pipeline = StableDiffusionImg2ImgPipeline.from_pretrained(modelId,
  File "C:\Users\arda_\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\diffusers\pipeline_utils.py", line 724, in from_pretrained
    raise ValueError(
ValueError: Pipeline <class 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_img2img.StableDiffusionImg2ImgPipeline'> expected {'feature_extractor', 'scheduler', 'tokenizer', 'safety_checker', 'text_encoder', 'unet', 'vae'}, but only {'scheduler', 'tokenizer', 'text_encoder', 'unet', 'vae'} were passed.
dreamlike-art org

Set requires_safety_checker to false I guess. The model works, there's something wrong with your code

not-someone changed discussion status to closed

Hi @not-someone , it didn't work, I tried a different model with the same code, and its work, I'm using 4 different model and all of them are fine except this

My code :

pipeline = StableDiffusionImg2ImgPipeline.from_pretrained(modelId,
        torch_dtype= torch.float16,
        requires_safety_checker= False
        ).to('cuda')
    pipeline.enable_xformers_memory_efficient_attention()
    pipeline.enable_attention_slicing("max")
    pipeline.scheduler = EulerDiscreteScheduler.from_config(pipeline.scheduler.config)
    pipeline.unet.to(memory_format=torch.channels_last)
    with autocast("cuda"):
        images = pipeline(prompt,
        image=[im] * perImg,
        negative_prompt = negative_prompt,
        num_images_per_prompt=perImg,
        num_inference_steps=185,
        guidance_scale=scale).images

Sign up or log in to comment