OSError: Error no file named pytorch_model.fp16.bin, tf_model.h5, model.ckpt.index or flax_model.msgpack found in directory sd-turbo/text-encoder

#7
by Schwertlilien - opened

When I load the folder, and try to run a python file to generate some images. This error happened.
My code:
from diffusers import AutoPipelineForText2Image
import torch

init pipe

pipe = AutoPipelineForText2Image.from_pretrained("GenerateImgs/sd-turbo", torch_dtype=torch.float16, variant="fp16")
pipe.to("cuda")

define the class to generate imgs

classes_file = "classes.txt"
with open(classes_file, "r") as f:
prompts = f.read().splitlines()

generate imgs

for i, prompt in enumerate(prompts):
for j in range(100):# the number of imgs generated
# generate img
seed=torch.Generator("cuda").manual_seed(j)
image = pipe(prompt=prompt, num_inference_steps=1, guidance_scale=0.0, generator=seed).images[0]
#save img
image.save(f"generated_images/{prompts[i]}/image_{j+1}.jpg")
print(f" {i+1}:{prompts[i]} picture {j+1} finished")

Sign up or log in to comment