Skip to content

TypeError: StableDiffusionControlNetPipeline.prepare_image() missing 1 required positional argument: 'do_classifier_free_guidance' #8

@Amazingldl

Description

@Amazingldl
pipe.to('cuda')

# generate image
generator = torch.manual_seed(0)
new_image = pipe(
    text_prompt,
    num_inference_steps=20,
    generator=generator,
    image=image,
    control_image=canny_image,
    controlnet_conditioning_scale = 0.5,
    mask_image=mask_image
).images[0]

new_image.save('output/canny_result.png')

Thanks for your great work, by running the above code in notebook, I get some issues:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <module>:5                                                                                    │
│                                                                                                  │
│    2                                                                                             │
│    3 # generate image                                                                            │
│    4 generator = torch.manual_seed(0)                                                            │
│ ❱  5 new_image = pipe(                                                                           │
│    6 │   text_prompt,                                                                            │
│    7 │   num_inference_steps=20,                                                                 │
│    8 │   generator=generator,                                                                    │
│                                                                                                  │
│ d:\App\miniconda\envs\aigc\lib\site-packages\torch\autograd\grad_mode.py:27 in decorate_context  │
│                                                                                                  │
│    24 │   │   @functools.wraps(func)                                                             │
│    25 │   │   def decorate_context(*args, **kwargs):                                             │
│    26 │   │   │   with self.clone():                                                             │
│ ❱  27 │   │   │   │   return func(*args, **kwargs)                                               │
│    28 │   │   return cast(F, decorate_context)                                                   │
│    29 │                                                                                          │
│    30 │   def _wrap_generator(self, func):                                                       │
│                                                                                                  │
│ c:\Users\Arthur\Downloads\ControlNetInpaint-main\ControlNetInpaint-main\src\pipeline_stable_diff │
│ usion_controlnet_inpaint.py:394 in __call__                                                      │
│                                                                                                  │
│   391 │   │   )                                                                                  │
│   392 │   │                                                                                      │
│   393 │   │   # 4. Prepare image                                                                 │
│ ❱ 394 │   │   control_image = self.prepare_image(                                                │
│   395 │   │   │   control_image,                                                                 │
│   396 │   │   │   width,                                                                         │
│   397 │   │   │   height,                                                                        │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: StableDiffusionControlNetPipeline.prepare_image() missing 1 required positional argument: 
'do_classifier_free_guidance'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions