I am trying to add negative prompt and other parameters to my StableDiffusionPipeline.from_pretrained() pipeline. Here is my code:
from diffusers import StableDiffusionPipeline
import torch
def imagineArt(prompt,negative_prompt,guidance_scale,num_images_per_prompt,height,width):
model_id = "dreamlike-art/dreamlike-photoreal-2.0"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe = pipe.to("cuda")
prompt = str(prompt)
negative_prompt = str(negative_prompt)
guidance_scale = float(guidance_scale)
num_images_per_prompt = int(num_images_per_prompt)
image = pipe(prompt,negative_prompt,guidance_scale,num_images_per_prompt,height,width).images[0]
return image
imagineArt(prompt = "Young woman wearing a leather jacket, looking at the camera, background lighting at night, close up camera shot, photoreal, hyperrealistic, 8k",
negative_prompt="ugly,digital,blender,cartoonish,painting,disproportionate",
guidance_scale=7.5,
num_images_per_prompt=2)`
When I run the code, I get the error message below:
TypeError Traceback (most recent call last)
<ipython-input-67-4073f1768ab7> in <cell line: 1>()
----> 1 imagineArt(prompt = "Young woman wearing a leather jacket, looking at the camera, background lighting at night, close up camera shot, photoreal, hyperrealistic, 8k",
2 negative_prompt="ugly,digital,blender,cartoonish,painting,disproportionate",
3 guidance_scale=7.5,
4 num_images_per_prompt=2)
3 frames
/usr/local/lib/python3.10/dist-packages/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py in check_inputs(self, prompt, height, width, callback_steps, negative_prompt, prompt_embeds, negative_prompt_embeds)
459 negative_prompt_embeds=None,
460 ):
--> 461 if height % 8 != 0 or width % 8 != 0:
462 raise ValueError(f"`height` and `width` have to be divisible by 8 but are {height} and {width}.")
463
TypeError: not all arguments converted during string formatting
What can I do differently please? Thanks for your anticipated help!