Repository: stable-diffusion-webui
Issue: [Bug]: SD upscale error on second tile
Labels: bug-report

### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What happened?

SD upscale stops after finishing the first tile and throws an error.

### Steps to reproduce the problem

1. Go to img2img
2. Select SD Upscale
3. Select SwinIR_4x


### What should have happened?

Generate all necessary tiles.

### Commit where the problem happens

d35bf649456da2558cbb6f2ea16fa1606022b7e7

### What platforms do you use to access UI ?

Windows

### What browsers do you use to access the UI ?

Mozilla Firefox

### Command Line Arguments

```Shell
"--ckpt-dir=D:\StableDiffusion/SD_Models" --xformers --deepdanbooru "--vae-path=D:\StableDiffusion/SD_Models/ft-MSE/vae-ft-mse-840000-ema-pruned.vae.pt" --api --autolaunch
```


### Additional information, context and logs

SD upscale throws a error after completing the first tile. 

SwinIR tiles: 100%|████████████████████████████████████████████████████████████████████| 15/15 [00:12<00:00,  1.19it/s]
SD upscaling will process a total of 9 images tiled as 3x3 per upscale in a total of 9 batches.
100%|██████████████████████████████████████████████████████████████████████████████████| 23/23 [00:03<00:00,  7.07it/s]
Error completing request████▏                                                         | 23/207 [00:03<00:25,  7.26it/s]
Arguments: (0, 'A (cyberpunk :1.2)castle with a river in front and fireworks in the sky, 8 k, unreal engine, octane, trending on artstation', '', 'None', 'None', <PIL.Image.Image image mode=RGB size=832x512 at 0x1A560473DF0>, None, None, None, 0, 150, 0, 4, 0, False, False, 1, 1, 7, 0.15, 4277678666.0, -1.0, 0, 0, 0, False, 512, 832, 0, False, 32, 0, '', '', 13, 0.9, 5, '0.0001', False, 'None', '', 0.1, False, 'Not set', 'Not set', 'Not set', 'Not set', 'No focus', '', True, False, '<ul>\n<li><code>CFG Scale</code> should be 2 or lower.</li>\n</ul>\n', True, True, '', '', True, 50, True, 1, 0, False, None, '', 0.2, 0.1, 1, 1, False, True, True, False, False, False, False, 4, 1, 4, 0.09, True, 1, 0, 7, False, False, 0, 0, 'Show/Hide Canvas', 0, '<p style="margin-bottom:0.75em">Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8</p>', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, None, '', '<p style="margin-bottom:0.75em">Will upscale the image to twice the dimensions; use width and height sliders to set tile size</p>', 64, 8, 10.0, True, 30.0, True, 'Illustration', 'svg', True, True, False, 0.5, 1, '', 0, '', True, True, False, 1.0, 2.0, 'a painting in', 'style', 'picture frame, portrait photo', None) {}

Traceback (most recent call last):
  File "D:\StableDiffusion\stable-diffusion-webui\modules\ui.py", line 185, in f
    res = list(func(*args, **kwargs))
  File "D:\StableDiffusion\stable-diffusion-webui\webui.py", line 54, in f
    res = func(*args, **kwargs)
  File "D:\StableDiffusion\stable-diffusion-webui\modules\img2img.py", line 135, in img2img
    processed = modules.scripts.scripts_img2img.run(p, *args)
  File "D:\StableDiffusion\stable-diffusion-webui\modules\scripts.py", line 282, in run
    processed = script.run(p, *script_args)
  File "D:\StableDiffusion\stable-diffusion-webui\scripts\sd_upscale.py", line 75, in run
    processed = processing.process_images(p)
  File "D:\StableDiffusion\stable-diffusion-webui\modules\processing.py", line 427, in process_images
    res = process_images_inner(p)
  File "D:\StableDiffusion\stable-diffusion-webui\modules\processing.py", line 487, in process_images_inner
    with torch.no_grad(), p.sd_model.ema_scope():
AttributeError: 'NoneType' object has no attribute 'ema_scope'