Skip to content

After call IP - Adapter unload method StableDiffusionImg2ImgPipeline(**pipe.components) error #6818

Description

@Honey-666

hi!
When I used 1.5 to load the model, I enabled the security check mechanism, uninstalled after using the IP-Adapter, and generated the pipe from the previous pipe, which would throw an error with the security check parameters

ifhasattr(self, "feature_extractor") andgetattr(self, "feature_extractor", None) isnotNone:

ifsafety_checkerisnotNoneandfeature_extractorisNone:

os:
diffusers==0.26.0

this is my code:

import torch
from PIL import Image
from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline
model_path = 'C:\\work\\pythonProject\\aidazuo\\models\\Stable-diffusion\\stable-diffusion-v1-5'
ip_adapter_path = 'C:\\work\\pythonProject\\aidazuo\\models\\IP-Adapter'
ip_img_path = 'C:\\work\\pythonProject\\aidazuo\\jupyter-script\\test-img\\vermeer.png'
pipe = StableDiffusionPipeline.from_pretrained(
model_path,
variant="fp16",
torch_dtype=torch.float16).to("cuda")
pipe.load_ip_adapter(ip_adapter_path, subfolder="models", weight_name="ip-adapter-plus_sd15.bin")
pipe.set_ip_adapter_scale(0.6)
ip_adapter_img = Image.open(ip_img_path)
images = pipe(
prompt='a beautiful girl',
ip_adapter_image=ip_adapter_img,
negative_prompt="",
num_inference_steps=30,
num_images_per_prompt=1,
width=512,
height=512).images
pipe.unload_ip_adapter()
imagePipe = StableDiffusionImg2ImgPipeline(**pipe.components).to("cuda")
images2 = imagePipe(num_inference_steps=30,
image=images[0],
strength=0.5,
prompt='a beautiful girl').images
for img in images2:
print(img)
img.show()

error_img

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions