Skip to content

Composable Diffusion Pipeline Broken #2703

@nagolinc

Description

@nagolinc

Describe the bug

Composable Diffusion Pipeline appears to be broken when attempting to follow the instructions here:

https://github.com/huggingface/diffusers/blob/268ebcb015d8816257f24e3cd930fb48964314b4/examples/community/README.md#composable-stable-diffusion

Reproduction

import torch as th
import numpy as np
import torchvision.utils as tvu

from diffusers import DiffusionPipeline

model_path="runwayml/stable-diffusion-v1-5"

device = 'cuda'

prompt = "hello world"
scale = 7.5
steps = 15

pipe = DiffusionPipeline.from_pretrained(
model_path,
custom_pipeline="composable_stable_diffusion",
).to(device)

pipe.safety_checker = None

Logs

─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ C:\Users\Nagol\AppData\Local\Temp\ipykernel_9964\2813658613.py:15 in <module>                    │
│                                                                                                  │
│ [Errno 2] No such file or directory:                                                             │
│ 'C:\\Users\\Nagol\\AppData\\Local\\Temp\\ipykernel_9964\\2813658613.py'                          │
│                                                                                                  │
│ C:\Users\Nagol\AppData\Local\Programs\Python\Python310\lib\site-packages\diffusers\pipelines\pip │
│ eline_utils.py:800 in from_pretrained                                                            │
│                                                                                                  │
│    797 │   │   │   else:                                                                         │
│    798 │   │   │   │   file_name = CUSTOM_PIPELINE_FILE_NAME                                     │
│    799 │   │   │                                                                                 │
│ ❱  800 │   │   │   pipeline_class = get_class_from_dynamic_module(                               │
│    801 │   │   │   │   custom_pipeline, module_file=file_name, cache_dir=cache_dir, revision=cu  │
│    802 │   │   │   )                                                                             │
│    803 │   │   elif cls != DiffusionPipeline:                                                    │
│                                                                                                  │
│ C:\Users\Nagol\AppData\Local\Programs\Python\Python310\lib\site-packages\diffusers\utils\dynamic │
│ _modules_utils.py:445 in get_class_from_dynamic_module                                           │
│                                                                                                  │
│   442 │   cls = get_class_from_dynamic_module("sgugger/my-bert-model", "modeling.py", "MyBertM   │
│   443 │   """                                                                                 │
│   444 │   # And lastly we get the class inside our newly created module                          │
│ ❱ 445 │   final_module = get_cached_module_file(                                                 │
│   446 │   │   pretrained_model_name_or_path,                                                     │
│   447 │   │   module_file,                                                                       │
│   448 │   │   cache_dir=cache_dir,                                                               │
│                                                                                                  │
│ C:\Users\Nagol\AppData\Local\Programs\Python\Python310\lib\site-packages\diffusers\utils\dynamic │
│ _modules_utils.py:331 in get_cached_module_file                                                  │
│                                                                                                  │
│   328 │   │   shutil.copy(resolved_module_file, submodule_path / module_file)                    │
│   329 │   │   for module_needed in modules_needed:                                               │
│   330 │   │   │   module_needed = f"{module_needed}.py"                                          │
│ ❱ 331 │   │   │   shutil.copy(os.path.join(pretrained_model_name_or_path, module_needed), subm   │
│   332 │   else:                                                                                  │
│   333 │   │   # Get the commit hash                                                              │
│   334 │   │   # TODO: we will get this info in the etag soon, so retrieve it from there and no   │
│                                                                                                  │
│ C:\Users\Nagol\AppData\Local\Programs\Python\Python310\lib\shutil.py:417 in copy                 │
│                                                                                                  │
│    414 │   """
│    415 │   if os.path.isdir(dst):                                                                │
│    416 │   │   dst = os.path.join(dst, os.path.basename(src))                                    │
│ ❱  417 │   copyfile(src, dst, follow_symlinks=follow_symlinks)                                   │
│    418 │   copymode(src, dst, follow_symlinks=follow_symlinks)                                   │
│    419 │   return dst                                                                            │
│    420                                                                                           │
│                                                                                                  │
│ C:\Users\Nagol\AppData\Local\Programs\Python\Python310\lib\shutil.py:254 in copyfile             │
│                                                                                                  │
│    251 │   if not follow_symlinks and _islink(src):                                              │
│    252 │   │   os.symlink(os.readlink(src), dst)                                                 │
│    253 │   else:                                                                                 │
│ ❱  254 │   │   with open(src, 'rb') as fsrc:                                                     │
│    255 │   │   │   try:                                                                          │
│    256 │   │   │   │   with open(dst, 'wb') as fdst:                                             │
│    257 │   │   │   │   │   # macOS                                                               │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
FileNotFoundError: [Errno 2] No such file or directory: 'composable_stable_diffusion\\safety_checker.py'

System Info

ipython notebook

PS E:\img> python --version
Python 3.10.6

diffusers 0.15.0.dev0 (installed latest from github)

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