vladmandic / automatic

SD.Next: Advanced Implementation of Stable Diffusion and other Diffusion-based generative image models
https://github.com/vladmandic/automatic
GNU Affero General Public License v3.0
5.36k stars 382 forks source link

[Issue]: Memory leak when using non-latent upscalers #2254

Closed zethfoxster closed 10 months ago

zethfoxster commented 10 months ago

Issue Description

as per discussion section, first image gens fine and subsequent gens show a massive spike in vram usage that gradually increases. this was recorded from a fresh clone of the project, no modifications to settings, using base model that was downloaded (sd 1.5), I simply just hit generate after each image completed making no changes to any of the settings. if there is anything else you need from me let me know.

https://github.com/vladmandic/automatic/discussions/2250 for reference linked discussion.

Version Platform Description

current system specs windows 11, rtx 4090, i13 chrome browser

Using VENV: C:\WebUi\StableDiffusion_sep_redo\automatic\venv
18:41:50-139732 INFO     Starting SD.Next
18:41:50-144734 INFO     Python 3.10.9 on Windows
18:41:50-209443 INFO     Version: app=sd.next updated=2023-09-20 hash=89ba8e3c
                         url=https://github.com/vladmandic/automatic.git/tree/master
18:41:50-547202 INFO     Platform: arch=AMD64 cpu=Intel64 Family 6 Model 183 Stepping 1, GenuineIntel system=Windows
                         release=Windows-10-10.0.22621-SP0 python=3.10.9
18:41:50-548202 DEBUG    Setting environment tuning
18:41:50-549202 DEBUG    Torch overrides: cuda=False rocm=False ipex=False diml=False openvino=False
18:41:50-550290 DEBUG    Torch allowed: cuda=True rocm=True ipex=True diml=True openvino=True
18:41:50-551292 INFO     nVidia CUDA toolkit detected
18:41:50-624392 DEBUG    Repository update time: Wed Sep 20 08:39:56 2023
18:41:50-625392 DEBUG    Previous setup time: Tue Sep 26 18:27:53 2023
18:41:50-625392 INFO     Extensions: disabled=[]
18:41:50-626392 INFO     Extensions: enabled=['a1111-sd-webui-lycoris', 'clip-interrogator-ext', 'LDSR', 'Lora',
                         'multidiffusion-upscaler-for-automatic1111', 'ScuNET', 'sd-extension-system-info',
                         'sd-webui-agent-scheduler', 'sd-webui-controlnet', 'stable-diffusion-webui-images-browser',
                         'stable-diffusion-webui-rembg', 'SwinIR'] extensions-builtin
18:41:50-628393 INFO     Extensions: enabled=[] extensions
18:41:50-629392 DEBUG    Latest extensions time: Tue Sep 26 18:27:48 2023
18:41:50-630392 DEBUG    Timestamps: version:1695213596 setup:1695767273 extension:1695767268
18:41:50-630392 INFO     No changes detected: Quick launch active
18:41:50-631392 INFO     Verifying requirements
18:41:50-638392 INFO     Verifying packages
18:41:50-640392 INFO     Extensions: disabled=[]
18:41:50-640392 INFO     Extensions: enabled=['a1111-sd-webui-lycoris', 'clip-interrogator-ext', 'LDSR', 'Lora',
                         'multidiffusion-upscaler-for-automatic1111', 'ScuNET', 'sd-extension-system-info',
                         'sd-webui-agent-scheduler', 'sd-webui-controlnet', 'stable-diffusion-webui-images-browser',
                         'stable-diffusion-webui-rembg', 'SwinIR'] extensions-builtin
18:41:50-643392 INFO     Extensions: enabled=[] extensions
18:41:50-647393 INFO     Extension preload: {'extensions-builtin': 0.0, 'extensions': 0.0}
18:41:50-648393 DEBUG    Starting module: <module 'webui' from
                         'C:\\WebUi\\StableDiffusion_sep_redo\\automatic\\webui.py'>
18:41:50-649392 INFO     Command line args: ['--autolaunch', '--debug'] autolaunch=True debug=True
18:41:54-333396 DEBUG    Loaded packages: torch=2.0.1+cu118 diffusers=0.20.2 gradio=3.43.2
18:41:54-593451 DEBUG    Reading: config.json len=21
18:41:54-594452 INFO     Engine: backend=Backend.ORIGINAL compute=cuda mode=no_grad device=cuda
18:41:54-631520 INFO     Device: device=NVIDIA GeForce RTX 4090 n=1 arch=compute_37 cap=(8, 9) cuda=11.8 cudnn=8700
                         driver=537.34
18:41:55-001754 DEBUG    Entering start sequence ```

### Relevant log output

```shell
2023-09-26T22:42:00.014Z | DEBUG | sd | devices | gc: collected=10627 device=cuda {'ram': {'used': 5.09, 'total': 127.75}, 'gpu': {'used': 3.61, 'total': 23.99}, 'retries': 0, 'oom': 0}
-- | -- | -- | -- | --
2023-09-26T22:42:00.016Z | INFO | sd | sd_models | Model load finished: {'ram': {'used': 5.09, 'total': 127.75}, 'gpu': {'used': 3.61, 'total': 23.99}, 'retries': 0, 'oom': 0} cached=0
2023-09-26T22:42:00.242Z | DEBUG | sd | shared | Saving: config.json len=1105
2023-09-26T22:42:00.243Z | INFO | sd | webui | Startup time: 9.58s { torch=2.92s gradio=0.30s diffusers=0.45s libraries=0.67s extensions=1.72s onchange=0.16s ui-txt2img=0.08s ui-img2img=0.07s ui-settings=0.06s ui-extensions=0.72s launch=0.13s app-started=0.14s checkpoint=2.00s }
2023-09-26T22:42:00.247Z | INFO | sd | webui | Launching browser
2023-09-26T22:42:00.294Z | DEBUG | sd | launch | Server alive=True jobs=1 requests=2 uptime=6s memory used=1.13 total=127.76 idle
2023-09-26T22:42:02.919Z | INFO | sd | shared | Themes: builtin=6 default=5 external=55
2023-09-26T22:42:36.181Z | DEBUG | sd | txt2img | txt2img: id_task=task(bp87ovquj1epbj3)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=560433544.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=True\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T22:42:36.372Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:42:38.343Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T22:42:40.652Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:42:48.128Z | INFO | sd | processing | Processed: images=1 time=11.94s its=1.67 memory={'ram': {'used': 3.38, 'total': 127.75}, 'gpu': {'used': 4.6, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T22:43:05.473Z | DEBUG | sd | txt2img | txt2img: id_task=task(yxei943hcaiygp9)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=560433544.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=True\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T22:43:05.491Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:43:06.344Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T22:43:07.393Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:43:12.412Z | INFO | sd | processing | Processed: images=1 time=6.94s its=2.88 memory={'ram': {'used': 3.39, 'total': 127.75}, 'gpu': {'used': 16.52, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T22:43:18.491Z | DEBUG | sd | txt2img | txt2img: id_task=task(b744e5ghrl63yus)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=560433544.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=True\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T22:43:18.514Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:43:19.637Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T22:43:20.641Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:43:25.668Z | INFO | sd | processing | Processed: images=1 time=7.17s its=2.79 memory={'ram': {'used': 3.4, 'total': 127.75}, 'gpu': {'used': 17.02, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T22:43:30.480Z | DEBUG | sd | txt2img | txt2img: id_task=task(o20xft0db8l33kl)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=560433544.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=True\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T22:43:30.497Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:43:31.463Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T22:43:32.488Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:43:37.514Z | INFO | sd | processing | Processed: images=1 time=7.03s its=2.84 memory={'ram': {'used': 3.4, 'total': 127.75}, 'gpu': {'used': 17.52, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T22:43:39.258Z | DEBUG | sd | txt2img | txt2img: id_task=task(mz3sskzjm4rasmk)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=560433544.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=True\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T22:43:39.275Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:43:40.250Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T22:43:41.265Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:43:46.325Z | INFO | sd | processing | Processed: images=1 time=7.06s its=2.83 memory={'ram': {'used': 3.4, 'total': 127.75}, 'gpu': {'used': 18.02, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T22:43:50.955Z | DEBUG | sd | txt2img | txt2img: id_task=task(srl0vfapvae8dpi)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=560433544.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=True\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T22:43:50.972Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:43:52.019Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T22:43:53.036Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:43:58.072Z | INFO | sd | processing | Processed: images=1 time=7.11s its=2.81 memory={'ram': {'used': 3.4, 'total': 127.75}, 'gpu': {'used': 18.61, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T22:43:59.857Z | DEBUG | sd | launch | Server alive=True jobs=7 requests=273 uptime=125s memory used=3.37 total=127.75 idle
2023-09-26T22:44:00.057Z | DEBUG | sd | txt2img | txt2img: id_task=task(415rs5g71ut2bc7)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=560433544.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=True\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T22:44:00.080Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:44:01.052Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T22:44:02.073Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:44:07.132Z | INFO | sd | processing | Processed: images=1 time=7.07s its=2.83 memory={'ram': {'used': 3.42, 'total': 127.75}, 'gpu': {'used': 19.11, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T22:44:09.583Z | DEBUG | sd | txt2img | txt2img: id_task=task(x7f26mn0k8twawd)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=560433544.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=True\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T22:44:09.601Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:44:10.623Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T22:44:11.652Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:44:16.705Z | INFO | sd | processing | Processed: images=1 time=7.12s its=2.81 memory={'ram': {'used': 3.42, 'total': 127.75}, 'gpu': {'used': 19.63, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T22:44:23.406Z | DEBUG | sd | txt2img | txt2img: id_task=task(872w63vbruht5g9)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=560433544.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=True\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T22:44:23.431Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:44:24.462Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T22:44:25.478Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:44:30.520Z | INFO | sd | processing | Processed: images=1 time=7.11s its=2.81 memory={'ram': {'used': 3.42, 'total': 127.75}, 'gpu': {'used': 20.13, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T22:44:39.049Z | DEBUG | sd | txt2img | txt2img: id_task=task(2pp63gwz860cdt6)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=560433544.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=True\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T22:44:39.087Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:44:40.091Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T22:44:41.112Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:44:46.161Z | INFO | sd | processing | Processed: images=1 time=7.11s its=2.81 memory={'ram': {'used': 3.42, 'total': 127.75}, 'gpu': {'used': 20.6, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T22:44:48.093Z | DEBUG | sd | txt2img | txt2img: id_task=task(t6tt61di2bdgrc3)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=560433544.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=True\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T22:44:48.110Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:44:49.142Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T22:44:50.157Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:44:55.204Z | INFO | sd | processing | Processed: images=1 time=7.11s its=2.81 memory={'ram': {'used': 3.42, 'total': 127.75}, 'gpu': {'used': 21.1, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T22:44:57.086Z | DEBUG | sd | txt2img | txt2img: id_task=task(94qm5coeflbc78q)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=560433544.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=True\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T22:44:57.107Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:44:58.136Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T22:44:59.137Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:45:04.190Z | INFO | sd | processing | Processed: images=1 time=7.10s its=2.82 memory={'ram': {'used': 3.42, 'total': 127.75}, 'gpu': {'used': 21.6, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T22:45:12.328Z | DEBUG | sd | txt2img | txt2img: id_task=task(8sfxlng4qgcomp7)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=560433544.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=True\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T22:45:12.369Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:45:13.464Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T22:45:14.471Z | INFO | sd | devices | GPU high memory utilization: 92% {'ram': {'used': 3.4, 'total': 127.75}, 'gpu': {'used': 22.05, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T22:45:14.737Z | DEBUG | sd | devices | gc: collected=2568 device=cuda {'ram': {'used': 3.4, 'total': 127.75}, 'gpu': {'used': 3.98, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T22:45:14.739Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:45:19.839Z | INFO | sd | processing | Processed: images=1 time=7.51s its=2.66 memory={'ram': {'used': 3.42, 'total': 127.75}, 'gpu': {'used': 15.2, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T22:45:23.974Z | DEBUG | sd | txt2img | txt2img: id_task=task(urvgf9mjf39yw6z)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=560433544.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=True\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T22:45:23.993Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:45:25.007Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T22:45:26.029Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:45:31.081Z | INFO | sd | processing | Processed: images=1 time=7.10s its=2.82 memory={'ram': {'used': 3.42, 'total': 127.75}, 'gpu': {'used': 16.13, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T22:45:36.488Z | DEBUG | sd | txt2img | txt2img: id_task=task(5hzr8jy6i628feo)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=560433544.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=True\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T22:45:36.505Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:45:37.605Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T22:45:38.629Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:45:43.685Z | INFO | sd | processing | Processed: images=1 time=7.19s its=2.78 memory={'ram': {'used': 3.42, 'total': 127.75}, 'gpu': {'used': 16.63, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T22:45:45.554Z | DEBUG | sd | txt2img | txt2img: id_task=task(2kl6nmax4j46rf9)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=560433544.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=True\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T22:45:45.570Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:45:46.597Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T22:45:47.622Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:45:52.685Z | INFO | sd | processing | Processed: images=1 time=7.13s its=2.81 memory={'ram': {'used': 3.42, 'total': 127.75}, 'gpu': {'used': 17.13, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T22:45:55.219Z | DEBUG | sd | txt2img | txt2img: id_task=task(cdcow8k300g6r8u)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=560433544.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=True\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T22:45:55.237Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:45:56.222Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T22:45:57.245Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:46:02.329Z | INFO | sd | processing | Processed: images=1 time=7.11s its=2.81 memory={'ram': {'used': 3.42, 'total': 127.75}, 'gpu': {'used': 17.63, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T22:46:09.091Z | DEBUG | sd | txt2img | txt2img: id_task=task(1pchxkqno7gvn3s)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=560433544.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=True\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T22:46:09.116Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:46:10.236Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T22:46:11.260Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T22:46:16.360Z | INFO | sd | processing | Processed: images=1 time=7.26s its=2.75 memory={'ram': {'used': 3.42, 'total': 127.75}, 'gpu': {'used': 18.13, 'total': 23.99}, 'retries': 0, 'oom': 0}

Backend

Original

Model

SD 1.5

Acknowledgements

vladmandic commented 10 months ago

just to rule things out, does the vram leak occur with:

zethfoxster commented 10 months ago

no second pass:

2023-09-26T23:20:36.624Z | INFO | sd | processing | Processed: images=1 time=1.12s its=17.86 memory={'ram': {'used': 3.35, 'total': 127.75}, 'gpu': {'used': 4.91, 'total': 23.99}, 'retries': 0, 'oom': 0}
-- | -- | -- | -- | --
2023-09-26T23:20:52.953Z | DEBUG | sd | txt2img | txt2img: id_task=task(adqpzepyw7wk3wu)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=560433544.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=False\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=False\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T23:20:52.989Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T23:20:54.081Z | INFO | sd | processing | Processed: images=1 time=1.12s its=17.78 memory={'ram': {'used': 3.35, 'total': 127.75}, 'gpu': {'used': 4.91, 'total': 23.99}, 'retries': 0, 'oom': 0}

observed steady 4.91 vram usage....

second pass latent upscale only:

2023-09-26T23:23:39.990Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T23:23:41.037Z | DEBUG | sd | processing | Init hires: upscaler=Latent sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T23:23:41.039Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T23:23:46.040Z | INFO | sd | processing | Processed: images=1 time=6.08s its=3.29 memory={'ram': {'used': 3.43, 'total': 127.75}, 'gpu': {'used': 15.21, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T23:23:46.773Z | DEBUG | sd | txt2img | txt2img: id_task=task(kxvu0j7e4jvwnz8)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=-1.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=Latent\|hr_force=False\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T23:23:46.811Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T23:23:47.653Z | DEBUG | sd | processing | Init hires: upscaler=Latent sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T23:23:47.654Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T23:23:52.666Z | INFO | sd | processing | Processed: images=1 time=5.89s its=3.40 memory={'ram': {'used': 3.43, 'total': 127.75}, 'gpu': {'used': 15.21, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T23:23:57.225Z | DEBUG | sd | txt2img | txt2img: id_task=task(1rvknjcvzqg8i2r)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=-1.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=Latent\|hr_force=False\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T23:23:57.261Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T23:23:58.289Z | DEBUG | sd | processing | Init hires: upscaler=Latent sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T23:23:58.290Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T23:24:03.302Z | INFO | sd | processing | Processed: images=1 time=6.07s its=3.29 memory={'ram': {'used': 3.43, 'total': 127.75}, 'gpu': {'used': 15.21, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T23:26:00.334Z | DEBUG | sd | launch | Server alive=True jobs=15 requests=276 uptime=369s memory used=3.39 total=127.75 idle

observed massive jump to 15.21g vram usage, but steady....this is the first sign of something screwy happening, as the massive jump in vram persisted even after doing a subsequent no second pass run, meaning the vram is sitting there at 15gigs from this point on, but its safe to assume second pass loads 15gigs of something into vram.

second pass with esrgan x4 upscale:

2023-09-26T23:30:51.478Z | DEBUG | sd | txt2img | txt2img: id_task=task(jqo6pnrmb507yh2)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=-1.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=False\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T23:30:51.515Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T23:30:52.620Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T23:30:53.920Z | INFO | sd | processing | Processed: images=1 time=2.44s its=8.21 memory={'ram': {'used': 3.44, 'total': 127.75}, 'gpu': {'used': 16.2, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T23:30:58.424Z | DEBUG | sd | txt2img | txt2img: id_task=task(ese3yscc0zmk6xr)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=-1.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=False\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T23:30:58.444Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T23:30:59.471Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T23:31:00.812Z | INFO | sd | processing | Processed: images=1 time=2.38s its=8.39 memory={'ram': {'used': 3.44, 'total': 127.75}, 'gpu': {'used': 16.7, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T23:31:02.911Z | DEBUG | sd | txt2img | txt2img: id_task=task(zvhni3pppb9jdw2)\|prompt=patato baked on a tray\|negative_prompt=\|prompt_styles=[]\|steps=20\|sampler_index=1\|latent_index=1\|full_quality=True\|restore_faces=False\|tiling=False\|n_iter=1\|batch_size=1\|cfg_scale=6\|clip_skip=1\|seed=-1.0\|subseed=-1.0\|subseed_strength=0\|seed_resize_from_h=0\|seed_resize_from_w=0\|\|height=816\|width=512\|enable_hr=True\|denoising_strength=0.5\|hr_scale=2\|hr_upscaler=ESRGAN_4x\|hr_force=False\|hr_second_pass_steps=20\|hr_resize_x=0\|hr_resize_y=0\|image_cfg_scale=6\|diffusers_guidance_rescale=0.7\|refiner_steps=5\|refiner_start=0.8\|refiner_prompt=\|refiner_negative=\|override_settings_texts=[]
2023-09-26T23:31:02.929Z | DEBUG | sd | sd_samplers | Sampler: sampler=DDIM config={'default_eta_is_0': True, 'uses_ensd': True}
2023-09-26T23:31:03.950Z | DEBUG | sd | processing | Init hires: upscaler=ESRGAN_4x sampler=DDIM resize=0x0 upscale=1024x1632
2023-09-26T23:31:05.268Z | INFO | sd | processing | Processed: images=1 time=2.36s its=8.49 memory={'ram': {'used': 3.44, 'total': 127.75}, 'gpu': {'used': 17.2, 'total': 23.99}, 'retries': 0, 'oom': 0}
2023-09-26T23:31:59.634Z | DEBUG | sd | launch | Server alive=True jobs=18 requests=347 uptime=728s memory used=3.4 total=127.75 idle

observed a climb in vram usage that increased per gen. possibly the upscaler being reloaded and left there in vram every run.

HiRes Fix: observed no difference in the increases seen without this option checked...it is a steady increase of about 500mbs a gen. sidenote: Hires fixed enabled on latent upscalers(not sure this does anything) showed no increase at all. leading me to assume the leak is in the nonlatent upscalers(esrgan, superyandere, swinir, ect)

conclusions I draw from this if it matters : theres a massive jump in vram usage from simply turning on second pass.

second pass with a nonlatent upscaler exhabits signs of a (500mb x batch size) memory leak. it appears to be multiplied by whatever the batch size is.

HiRes pass had no effect on vram usage.

The First image you generate does not exhabit the massive leaps in vram usage, it is only subsequent gens.

Continuing to gen until you hit the max vram(24gig for me) that image will take a slightly longer time then it appears to have dumped whatever was in the vram and started back over, slowly climbing again.

I hope this is helpful in tracking this down.

vladmandic commented 10 months ago

Yes, this is exactly the info needed. I'll update when I have a fix.

vladmandic commented 10 months ago

Hunch was spot on, non-latent upscalers were simply force-loading model file over and over. Sometimes torch manages to reuse vram, but quite often it does not.

Anyhow...

I've implemented model cache and unload for swinir/scunet/esrgan/realesrgan

Its in dev branch, will be merged to master next week.

zethfoxster commented 9 months ago

while the above we discussed addresses the memleak, I do think i should refocus your attention on the other issue seen here. even with latent upscaler, simply turning on 2nd pass spikes vram usage to insane amounts. theres no reason a single image 512x832 x2upscale should load 20gigs of something to complete this image...(who knows maybe the model a bunch of times? maybe every model in a given folder?)

I am very aware of the driver issue with nvidia, but im sure whatever is happening here isnt helping the issue. does your above fix address this spike as well?

if not, how else can i assist you in tracking this down, I much prefer to use sdnext instead of auto1111...currently im hovering between the 2 webuis because in auto1111 this issue doesnt exist...but base auto1111 feels prehistoric... help me to help you vlad... in current sdnext I cant gen more than 4 images without triggering the dreaded nvidia issue...this is a sharp contrast to the 12 parallel images I can get in auto1111 without even coming close to triggering it.

NVIDIA GeForce RTX 4090
Driver version: 31.0.15.3734
Driver date:    9/1/2023
DirectX version:    12 (FL 12.1)
Physical location:  PCI bus 1, device 0, function 0

Utilization 98%
Dedicated GPU memory    20.5/24.0 GB
Shared GPU memory   0.1/63.9 GB

GPU Memory  20.6/87.9 GB

memspike

vladmandic commented 9 months ago

just tried 512x832 upscale 2x with hires. system info tab shows: gpu-allocated: current:2.05 peak:7.16 (this is best source of information) and windows confirms it: image

zethfoxster commented 9 months ago

crossing my fingers that whatever it is for me is currently fixed in Dev branch than...this is subsequent correct? the first gen is uneffected by whatever this is.