I'm getting the following error:
# ERROR:
# Traceback (most recent call last):
# File "/home/edcordata/workspace/ai/run.py", line 23, in <module>
# image = pipe(prompt, guidance_scale=6)["sample"][0]
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
# File "/home/edcordata/.local/lib/python3.11/site-packages/diffusers/utils/outputs.py", line 103, in __getitem__
# return inner_dict[k]
# ~~~~~~~~~~^^^
# KeyError: 'sample'
Code from repo's example:
# pip install -r requirements.txt --break-system-packages
# python3 ./run.py
# run.py
# ------------------------------
import torch
from torch import autocast
from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained(
'hakurei/waifu-diffusion',
torch_dtype=torch.float32
).to('cuda')
prompt = "1girl, aqua eyes, baseball cap, blonde hair, closed mouth, earrings, green background, hat, hoop earrings, jewelry, looking at viewer, shirt, short hair, simple background, solo, upper body, yellow shirt"
with autocast("cuda"):
image = pipe(prompt, guidance_scale=6)["sample"][0]
image.save("test.png")
# ------------------------------
