Skip to content

[Bug]: RuntimeError: Inplace update to inference tensor outside InferenceMode is not allowed.You can make a clone to get a normal tensor before doing inplace update.See https://github.com/pytorch/rfcs/pull/17 for more details. #16274

@somera

Description

@somera

Checklist

  • The issue exists after disabling all extensions
  • The issue exists on a clean installation of webui
  • The issue is caused by an extension, but I believe it is caused by a bug in the webui
  • The issue exists in the current version of the webui
  • The issue has not been reported before recently
  • The issue has been reported before but has not been fixed yet

What happened?

I try to upscale images. And I get en error

To create a public link, set `share=True` in `launch()`.
Startup time: 454.9s (prepare environment: 443.8s, import torch: 2.9s, import gradio: 0.8s, setup paths: 0.8s, initialize shared: 0.5s, other imports: 0.6s, load scripts: 3.8s, create ui: 0.9s, gradio launch: 0.7s).
Applying attention optimization: InvokeAI... done.
Model loaded in 7.7s (load weights from disk: 1.0s, create model: 0.7s, apply weights to model: 3.4s, apply float(): 1.5s, calculate empty prompt: 0.9s).
tiled upscale:   0%|                                                                                                        | 0/40 [00:04<?, ?it/s]
*** Error completing request
*** Arguments: ('task(u78910ye8o9fm1x)', 0.0, <PIL.Image.Image image mode=RGBA size=832x1344 at 0x1E10CA08130>, None, '', '', True, True, 0.0, 4, 0.0, 512, 512, True, 'R-ESRGAN 4x+', 'None', 0, False, 1, False, 1, 0, False, 0.5, 0.2, False, 0.9, 0.15, 0.5, False, False, 384, 768, 4096, 409600, 'Maximize area', 0.1, False, ['Horizontal'], False, ['Deepbooru']) {}
    Traceback (most recent call last):
      File "D:\projects\github\AUTOMATIC1111\stable-diffusion-webui\modules\call_queue.py", line 74, in f
        res = list(func(*args, **kwargs))
      File "D:\projects\github\AUTOMATIC1111\stable-diffusion-webui\modules\call_queue.py", line 53, in f
        res = func(*args, **kwargs)
      File "D:\projects\github\AUTOMATIC1111\stable-diffusion-webui\modules\call_queue.py", line 37, in f
        res = func(*args, **kwargs)
      File "D:\projects\github\AUTOMATIC1111\stable-diffusion-webui\modules\postprocessing.py", line 133, in run_postprocessing_webui
        return run_postprocessing(*args, **kwargs)
      File "D:\projects\github\AUTOMATIC1111\stable-diffusion-webui\modules\postprocessing.py", line 73, in run_postprocessing
        scripts.scripts_postproc.run(initial_pp, args)
      File "D:\projects\github\AUTOMATIC1111\stable-diffusion-webui\modules\scripts_postprocessing.py", line 198, in run
        script.process(single_image, **process_args)
      File "D:\projects\github\AUTOMATIC1111\stable-diffusion-webui\scripts\postprocessing_upscale.py", line 152, in process
        upscaled_image = self.upscale(pp.image, pp.info, upscaler1, upscale_mode, upscale_by, max_side_length, upscale_to_width, upscale_to_height, upscale_crop)
      File "D:\projects\github\AUTOMATIC1111\stable-diffusion-webui\scripts\postprocessing_upscale.py", line 107, in upscale
        image = upscaler.scaler.upscale(image, upscale_by, upscaler.data_path)
      File "D:\projects\github\AUTOMATIC1111\stable-diffusion-webui\modules\upscaler.py", line 68, in upscale
        img = self.do_upscale(img, selected_model)
      File "D:\projects\github\AUTOMATIC1111\stable-diffusion-webui\modules\realesrgan_model.py", line 45, in do_upscale
        return upscale_with_model(
      File "D:\projects\github\AUTOMATIC1111\stable-diffusion-webui\modules\upscaler_utils.py", line 74, in upscale_with_model
        output = upscale_pil_patch(model, tile)
      File "D:\projects\github\AUTOMATIC1111\stable-diffusion-webui\modules\upscaler_utils.py", line 48, in upscale_pil_patch
        return torch_bgr_to_pil_image(model(tensor))
      File "D:\projects\github\AUTOMATIC1111\stable-diffusion-webui\modules\upscaler_utils.py", line 31, in torch_bgr_to_pil_image
        arr = tensor.float().cpu().clamp_(0, 1).numpy()  # clamp
    RuntimeError: Inplace update to inference tensor outside InferenceMode is not allowed.You can make a clone to get a normal tensor before doing inplace update.See https://github.com/pytorch/rfcs/pull/17 for more details.

I deleted venv folder and started my webui again. Same problem.

Steps to reproduce the problem

Just try upscale images with the current version. At the moment only Nearest upscaler works.

What should have happened?

WebUI should upscale image.

What browsers do you use to access the UI ?

Google Chrome

Sysinfo

sysinfo-2024-07-27-11-16.json

Console logs

See above

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugReport of a confirmed bug

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions