Skip to content

Custom pipelines are broken #3199

Closed
Closed
@nickkolok

Description

@nickkolok

Describe the bug

It worked a couple of days ago, but today it stopped to. I wish I have never restarted none my space. Downgrading to diffusers 0.11.0, 0.12.0, 0.14.0 etc didn't help.

Please help me!

Reproduction

from diffusers import DiffusionPipeline, EulerAncestralDiscreteScheduler
import gradio as gr
import numpy as np
import imageio

from PIL import Image, ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
import glob


import torch
from time import gmtime, strftime


device = "cuda" if torch.cuda.is_available() else "cpu"
pipe = DiffusionPipeline.from_pretrained("NickKolok/meryl-stryfe-20230123-2300-6k-2400-steps_1", custom_pipeline="lpw_stable_diffusion", torch_dtype=torch.float32)
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
pipe.to(device)

def resize(height,img):
  baseheight = height
  img = Image.open(img)
  hpercent = (baseheight/float(img.size[1]))
  wsize = int((float(img.size[0])*float(hpercent)))
  img = img.resize((wsize,baseheight), Image.Resampling.LANCZOS)
  return img

def predict(prompt, negative_prompt):
    image = pipe(prompt=prompt, negative_prompt=negative_prompt, num_inference_steps=30, width=512, height=576).images[0]
    timestamp = strftime("%Y-%m-%d---%H-%M-%S", gmtime())
    #img = Image.open(image)
    image.save("./diffused__"+timestamp+"_.png")
    return glob.glob('./diffused_*.png')[-4:]

title="test"
description="test"

gr.Interface(
    fn=predict,
    inputs=[
        #gr.Image(source="upload", type="numpy", tool="sketch", elem_id="source_container"),
        gr.Textbox(label='What you want the AI to Generate, 77 Token limit'),
        gr.Textbox(label='What you Do Not want the AI to generate')
    ],
    outputs=[
        gr.Gallery(
            label="Generated images", show_label=False, elem_id="output_container_0"
        ).style(grid=[2], height="auto"),
        #gr.Image(elem_id="output_container_0"),
        #gr.Image(elem_id="output_container_1"),
    ],
    title=title,
    description=description,
    article = ""
).launch(max_threads=True, debug=True)

Logs

Downloading (…)_stable_diffusion.py:   0%|          | 0.00/13.9k [00:00<?, ?B/s]
Downloading (…)_stable_diffusion.py: 76.5kB [00:00, 17.6MB/s]                   
Traceback (most recent call last):
  File "app.py", line 16, in <module>
    pipe = DiffusionPipeline.from_pretrained("NickKolok/meryl-stryfe-20230123-2300-6k-2400-steps_1", custom_pipeline="lpw_stable_diffusion", torch_dtype=torch.float32)
  File "/home/user/.local/lib/python3.8/site-packages/diffusers/pipelines/pipeline_utils.py", line 655, in from_pretrained
    pipeline_class = get_class_from_dynamic_module(
  File "/home/user/.local/lib/python3.8/site-packages/diffusers/utils/dynamic_modules_utils.py", line 456, in get_class_from_dynamic_module
    return get_class_in_module(class_name, final_module.replace(".py", ""))
  File "/home/user/.local/lib/python3.8/site-packages/diffusers/utils/dynamic_modules_utils.py", line 163, in get_class_in_module
    module = importlib.import_module(module_path)
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/user/.cache/huggingface/modules/diffusers_modules/git/lpw_stable_diffusion.py", line 13, in <module>
    from diffusers.image_processor import VaeImageProcessor
ModuleNotFoundError: No module named 'diffusers.image_processor'

System Info

huggingface spaces (It runs on cpu, on a free HF instance - if that helps.)
different diffusers versions (from 0.11.0 to 0.14.0 and even newest)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions