Open cthulhu-tww opened 2 months ago
Could you elaborate more on this error, maybe share a screenshot or the code along with the error
import torch from diffusers import StableDiffusionXLPipeline from diffusers.image_processor import IPAdapterMaskProcessor from diffusers.utils import load_image from transformers import CLIPVisionModelWithProjection
image_encoder = CLIPVisionModelWithProjection.from_pretrained( "./repository/h94-IP-Adapter", subfolder="models/image_encoder", torch_dtype=torch.float16 ) pipeline = StableDiffusionXLPipeline.from_pretrained("./repository/stable-diffusion-xl-base-1.0", image_encoder=image_encoder, torch_dtype=torch.float16, use_safetensors=True, ).to("cuda") pipeline.enable_model_cpu_offload() pipeline.load_ip_adapter("./repository/h94-IP-Adapter", subfolder="sdxl_models", weight_name=["ip-adapter-plus_sdxl_vit-h.safetensors"] 2) pipeline.set_ip_adapter_scale([0.6] 2) generator = torch.Generator(device="cpu").manual_seed(4) mask1 = load_image( "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/ip_mask_mask1.png") mask2 = load_image( "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/ip_mask_mask2.png") output_height = 1024 output_width = 1024 processor = IPAdapterMaskProcessor() masks = processor.preprocess([mask1, mask2, ]) face_image1 = load_image( "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/ip_mask_girl1.png") face_image2 = load_image( "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/ip_mask_girl2.png") ip_images = [[face_image1], [face_image2]] image = pipeline( prompt="2 girls", ip_adapter_image=ip_images, negative_prompt="monochrome, lowres, bad anatomy, worst quality, low quality", num_inference_steps=20, num_images_per_prompt=1, generator=generator, cross_attention_kwargs={"ip_adapter_masks": masks} ).images[0] image.save("test.png")
Both my local machine and the linux server have this error message
I checked the source code and I don't understand why the initialized unet's attribute attn_processors down up mid blocks will have two types similar to 'down_blocks.1.attentions.0.transformer_blocks.0.attn1.processor', 'down_blocks.1.attentions. 0.transformer_blocks.0.attn2.processor' And attn2 will be converted into IPAdapterAttnProcessor in the following code. Maybe my initialization parameters are wrong? I'm a beginner and many thanks for helping me with my dilemma
https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py#L738-L739 the new version of diffusers input more parameters, you can ignore that.
Sorry, I still don't quite understand, what do I need to do now, regardless of this error message?
I updated the code, you can try
Sorry, I still don't quite understand, what do I need to do now, regardless of this error message?
You can re run your code @xiaohu2015 has updated diffuser It should be able to receive kwargs now
ohhhhhh!!! thank you
I tried replacing the two files you updated and tried again, but the problem still exists。
your diffuser version? can you test with diffusers==0.22.1?
If I set diffusers==0.22.1 I can't use the IPAdapterMaskProcessor, as far as I understand the IPAdapterMaskProcessor was introduced with diffusers >= 0.27
if you use higher version, you can use the IP-Adapter implemented in diffusers repo (not this repo)
ok thank you
What error message is this, but it won't cause the task to fail, it will only keep printing,thank you。