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

Support SD3.5 large #107

Open
gebaltso opened this issue Oct 31, 2024 · 0 comments
Open

Support SD3.5 large #107

gebaltso opened this issue Oct 31, 2024 · 0 comments

Comments

@gebaltso
Copy link

gebaltso commented Oct 31, 2024

Hello I tried to use compel with SD3.5-large but got this error:

prompt_embeds = torch.cat([negative_prompt_embeds, prompt_embeds], dim=0)
RuntimeError: Sizes of tensors must match except in dimension 0. Expected size 333 but got size 77 for tensor number 1 in the list.

Code:

import torch
from diffusers import StableDiffusion3Pipeline
from compel import Compel

torch.cuda.empty_cache()

pipe = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3.5-large", torch_dtype=torch.bfloat16)
pipe.enable_model_cpu_offload()

compel_proc = Compel(tokenizer=pipe.tokenizer, text_encoder=pipe.text_encoder)

prompt = "A portrait of a Latino woman, green eyes--"

prompt_embeds = compel_proc(prompt)
pooled_prompt_embeds = compel_proc(prompt)

image = pipe(
        prompt_embeds=prompt_embeds,
        pooled_prompt_embeds=pooled_prompt_embeds,
        num_images_per_prompt=1,
        num_inference_steps=28,
        guidance_scale=3.5,
    ).images[0]
    
image.save(i.jpg')
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

1 participant