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.61k stars 411 forks source link

[Issue]: TypeError: '>' not supported between instances of 'NoneType' and 'int' #2105

Closed Methwold closed 1 year ago

Methwold commented 1 year ago

Issue Description

  1. Run SD.Next using --safemode --debug --medvram (see attached for full debug log).
  2. Generate image using default parameters including user defined parameters.
  3. The error "TypeError: '>' not supported between instances of 'NoneType' and 'int'" is given.
  4. Without restarting SD.Next any prompt will produce this same error.
  5. When SD.Next is rerun and the default prompt is changed but all other parameters are not then an image is generated.
  6. This issue occurs in both Firefox and Edge.
  7. Note there were multiple FS walk errors which appear to correct themselves.
  8. Note the warning Modified files: ['modules/lora', 'modules/lycoris']. I'm not aware of how these were modified.

Version Platform Description

Microsoft Windows [Version 10.0.19045.3208] (c) Microsoft Corporation. All rights reserved.

Z:\AI\SD\SDNext\automatic>webui --debug --safe --medvram Using VENV: Z:\AI\SD\SDNext\automatic\venv 21:39:27-580012 INFO Starting SD.Next 21:39:27-585995 INFO Python 3.10.6 on Windows 21:39:27-640890 INFO Version: 579be529 Tue Aug 29 17:57:02 2023 -0400 21:39:28-282160 DEBUG Setting environment tuning 21:39:28-284191 DEBUG Torch overrides: cuda=False rocm=False ipex=False diml=False openvino=False 21:39:28-287185 DEBUG Torch allowed: cuda=True rocm=True ipex=True diml=True openvino=True 21:39:28-290201 INFO nVidia CUDA toolkit detected 21:39:28-424855 WARNING Modified files: ['modules/lora', 'modules/lycoris'] 21:39:28-484720 DEBUG Repository update time: Tue Aug 29 14:57:02 2023 21:39:28-487712 DEBUG Previous setup time: Tue Aug 29 21:17:15 2023 21:39:28-488709 INFO Disabled extensions: ['sd-webui-controlnet', 'sd-dynamic-thresholding', 'multidiffusion-upscaler-for-automatic1111', 'a1111-sd-webui-lycoris'] 21:39:28-490704 INFO Enabled extensions-builtin: ['clip-interrogator-ext', 'LDSR', 'Lora', 'ScuNET', 'sd-extension-system-info', 'sd-webui-agent-scheduler', 'stable-diffusion-webui-images-browser', 'stable-diffusion-webui-rembg', 'SwinIR'] 21:39:28-497718 DEBUG Latest extensions time: Tue Aug 29 21:17:00 2023 21:39:28-498715 DEBUG Timestamps: version:1693346222 setup:1693369035 extension:1693369020

Relevant log output

Microsoft Windows [Version 10.0.19045.3208]
(c) Microsoft Corporation. All rights reserved.

Z:\AI\SD\SDNext\automatic>webui --debug --safe --medvram
Using VENV: Z:\AI\SD\SDNext\automatic\venv
21:39:27-580012 INFO     Starting SD.Next
21:39:27-585995 INFO     Python 3.10.6 on Windows
21:39:27-640890 INFO     Version: 579be529 Tue Aug 29 17:57:02 2023 -0400
21:39:28-282160 DEBUG    Setting environment tuning
21:39:28-284191 DEBUG    Torch overrides: cuda=False rocm=False ipex=False diml=False openvino=False
21:39:28-287185 DEBUG    Torch allowed: cuda=True rocm=True ipex=True diml=True openvino=True
21:39:28-290201 INFO     nVidia CUDA toolkit detected
21:39:28-424855 WARNING  Modified files: ['modules/lora', 'modules/lycoris']
21:39:28-484720 DEBUG    Repository update time: Tue Aug 29 14:57:02 2023
21:39:28-487712 DEBUG    Previous setup time: Tue Aug 29 21:17:15 2023
21:39:28-488709 INFO     Disabled extensions: ['sd-webui-controlnet', 'sd-dynamic-thresholding',
                         'multidiffusion-upscaler-for-automatic1111', 'a1111-sd-webui-lycoris']
21:39:28-490704 INFO     Enabled extensions-builtin: ['clip-interrogator-ext', 'LDSR', 'Lora', 'ScuNET',
                         'sd-extension-system-info', 'sd-webui-agent-scheduler',
                         'stable-diffusion-webui-images-browser', 'stable-diffusion-webui-rembg', 'SwinIR']
21:39:28-497718 DEBUG    Latest extensions time: Tue Aug 29 21:17:00 2023
21:39:28-498715 DEBUG    Timestamps: version:1693346222 setup:1693369035 extension:1693369020
21:39:28-501708 INFO     No changes detected: Quick launch active
21:39:28-502704 INFO     Verifying requirements
21:39:28-518661 INFO     Verifying packages
21:39:28-520656 INFO     Disabled extensions: ['sd-webui-controlnet', 'sd-dynamic-thresholding',
                         'multidiffusion-upscaler-for-automatic1111', 'a1111-sd-webui-lycoris']
21:39:28-522651 INFO     Enabled extensions-builtin: ['clip-interrogator-ext', 'LDSR', 'Lora', 'ScuNET',
                         'sd-extension-system-info', 'sd-webui-agent-scheduler',
                         'stable-diffusion-webui-images-browser', 'stable-diffusion-webui-rembg', 'SwinIR']
21:39:28-527638 INFO     Running in safe mode without user extensions
21:39:28-536645 INFO     Extension preload: 0.0s Z:\AI\SD\SDNext\automatic\extensions-builtin
21:39:28-561632 DEBUG    Memory used: 0.04 total: 15.75 Collected 0
21:39:28-563598 DEBUG    Starting module: <module 'webui' from 'Z:\\AI\\SD\\SDNext\\automatic\\webui.py'>
21:39:28-565593 INFO     Server arguments: ['--debug', '--safe', '--medvram']
21:39:32-710547 DEBUG    Loaded Torch==2.0.1+cu118
21:39:40-671745 DEBUG    Loaded Gradio==3.41.2
21:39:41-930303 DEBUG    Loaded Diffusers==0.20.1
21:39:41-932297 DEBUG    Loading Modules
No module 'xformers'. Proceeding without it.
21:39:42-549130 DEBUG    Reading: config.json len=29
21:39:42-550128 DEBUG    Unknown settings: ['image_browser_use_thumbnail', 'disable_gc']
21:39:42-552150 INFO     Engine: backend=Backend.DIFFUSERS
21:39:42-555115 DEBUG    Loaded styles: styles.csv items=0
21:39:43-476000 INFO     Libraries loaded
21:39:43-477994 DEBUG    Entering start sequence
21:39:43-583723 DEBUG    Version: {'app': 'sd.next', 'updated': '2023-08-29', 'hash': '579be529', 'url':
                         'https://github.com/vladmandic/automatic/tree/master'}
21:39:43-585716 INFO     Using models path:
21:39:43-587711 DEBUG    Event loop: <_WindowsSelectorEventLoop running=False closed=False debug=False>
21:39:43-589706 DEBUG    Entering initialize
21:39:43-591701 DEBUG    Available samplers: ['Default', 'UniPC', 'DEIS', 'PNDM', 'DDPM', 'DDIM', 'LMSD', 'KDPM2',
                         'KDPM2 a', 'DPM 1S', 'DPM 2M', 'Euler', 'Euler a', 'Heun']
21:39:43-595690 INFO     Available VAEs: models\VAE items=2
21:39:43-598682 DEBUG    Scanning diffusers cache: models\Diffusers models\Diffusers items=0
21:39:43-601674 DEBUG    Reading: cache.json len=2
21:39:43-604666 DEBUG    Reading: metadata.json len=14
21:39:43-606661 INFO     Available models: models\Stable-diffusion items=6
21:39:43-726672 DEBUG    Loading scripts
21:39:47-765988 DEBUG    Scripts load: ['clip-interrogator-ext:1.447s', 'Lora:0.253s',
                         'sd-extension-system-info:0.084s', 'sd-webui-agent-scheduler:0.495s',
                         'stable-diffusion-webui-images-browser:0.119s', 'stable-diffusion-webui-rembg:1.488s']
21:39:48-143552 INFO     Loading UI theme: name=amethyst-nightfall style=Auto
21:39:48-151523 DEBUG    Creating UI
21:39:48-157507 DEBUG    Reading: ui-config.json len=9
21:39:48-185460 DEBUG    Extra network page: Checkpoints tab=txt2img
21:39:48-188424 DEBUG    FS walk error: [WinError 3] The system cannot find the path specified:
                         'Z:\\AI\\SD\\SDNext\\automatic\\models\\Diffusers' Z:\AI\SD\SDNext\automatic\models\Diffusers
21:39:48-192413 DEBUG    Extra networks: checkpoints items=6 subdirs=1 time=0.0
21:39:48-195407 DEBUG    Extra network page: Lora tab=txt2img
21:39:48-199395 DEBUG    Extra networks: lora items=6 subdirs=1 time=0.0
21:39:48-202387 DEBUG    Extra network page: Textual Inversion tab=txt2img
21:39:48-203385 DEBUG    FS walk error: [WinError 3] The system cannot find the path specified:
                         'Z:\\AI\\SD\\SDNext\\automatic\\models\\embeddings'
                         Z:\AI\SD\SDNext\automatic\models\embeddings
21:39:48-206376 DEBUG    Extra network page: Hypernetworks tab=txt2img
21:39:48-207374 DEBUG    FS walk error: [WinError 3] The system cannot find the path specified:
                         'Z:\\AI\\SD\\SDNext\\automatic\\models\\hypernetworks'
                         Z:\AI\SD\SDNext\automatic\models\hypernetworks
21:39:48-222365 DEBUG    UI interface: tab=txt2img batch=False seed=True advanced=False second_pass=False
21:39:48-266244 DEBUG    Extra network page: Checkpoints tab=img2img
21:39:48-269209 DEBUG    FS walk error: [WinError 3] The system cannot find the path specified:
                         'Z:\\AI\\SD\\SDNext\\automatic\\models\\Diffusers' Z:\AI\SD\SDNext\automatic\models\Diffusers
21:39:48-271203 DEBUG    Extra network page: Lora tab=img2img
21:39:48-273198 DEBUG    Extra network page: Textual Inversion tab=img2img
21:39:48-275192 DEBUG    FS walk error: [WinError 3] The system cannot find the path specified:
                         'Z:\\AI\\SD\\SDNext\\automatic\\models\\embeddings'
                         Z:\AI\SD\SDNext\automatic\models\embeddings
21:39:48-278185 DEBUG    Extra network page: Hypernetworks tab=img2img
21:39:48-279181 DEBUG    FS walk error: [WinError 3] The system cannot find the path specified:
                         'Z:\\AI\\SD\\SDNext\\automatic\\models\\hypernetworks'
                         Z:\AI\SD\SDNext\automatic\models\hypernetworks
21:39:48-304115 DEBUG    UI interface: tab=img2img seed=False resize=False batch=False denoise=True advanced=False
21:39:48-396088 DEBUG    Reading: ui-config.json len=9
21:39:50-050001 DEBUG    Script: 1.5s ui_tabs
                         Z:\AI\SD\SDNext\automatic\extensions-builtin\stable-diffusion-webui-images-browser\scripts\ima
                         ge_browser.py
21:39:50-073969 DEBUG    Extensions list loaded: Z:\AI\SD\SDNext\automatic\html\extensions.json
21:39:50-945802 DEBUG    Extension list refresh: processed=215 installed=13 enabled=9 disabled=4 visible=215 hidden=0
Running on local URL:  http://127.0.0.1:7860
21:39:51-274979 INFO     Local URL: http://127.0.0.1:7860/
21:39:51-277932 DEBUG    Gradio registered functions: 1434
21:39:51-279926 INFO     Initializing middleware
21:39:51-284913 DEBUG    Creating API
21:39:51-424743 INFO     [AgentScheduler] Task queue is empty
21:39:51-427707 INFO     [AgentScheduler] Registering APIs
21:39:51-540434 DEBUG    Scripts setup: ['X/Y/Z grid:0.006s']
21:39:51-543399 DEBUG    Scripts components: []
21:39:51-544396 DEBUG    Model metadata: metadata.json no changes
21:39:51-547388 DEBUG    Verifying Torch settings
21:39:51-682927 DEBUG    Torch FP16 test passed
21:39:51-686996 DEBUG    Desired Torch parameters: dtype=FP16 no-half=False no-half-vae=False upscast=False
21:39:51-688993 INFO     Setting Torch parameters: dtype=torch.float16 vae=torch.float16 unet=torch.float16
21:39:51-690986 DEBUG    Torch default device: cuda
21:39:51-692982 DEBUG    Select checkpoint: model sd_xl_base_1.0_0.9vae.safetensors [e6bb9ea85b]
21:39:51-693979 INFO     Loading diffusers VAE: models\VAE\sdxl-vae-fp16-fix source=settings
21:39:51-695974 DEBUG    Diffusers VAE load config: {'low_cpu_mem_usage': False, 'torch_dtype': torch.float16,
                         'use_safetensors': True, 'variant': 'fp16', 'force_upcast': False}
21:39:53-093755 INFO     Loading diffuser model:
                         Z:\AI\SD\SDNext\automatic\models\Stable-diffusion\sd_xl_base_1.0_0.9vae.safetensors
21:40:19-396215 DEBUG    Model model: pipeline=StableDiffusionXLPipeline
21:40:19-434113 DEBUG    Model model: enable model CPU offload
21:40:19-468022 DEBUG    Model model: enable VAE slicing
21:40:19-471014 DEBUG    Model model: enable VAE tiling
21:40:19-486971 DEBUG    Model model VAE: name=sdxl-vae-fp16-fix upcast=False
21:40:19-495947 INFO     Embeddings: loaded=0 skipped=0
21:40:19-498939 INFO     Model loaded in 28.0s (load=28.0s) native=512
21:40:20-624943 DEBUG    gc: collected=704 device=cuda {'ram': {'used': 6.77, 'total': 15.75}, 'gpu': {'used': 1.02,
                         'total': 12.0}, 'retries': 0, 'oom': 0}
21:40:20-629932 INFO     Model load finished: {'ram': {'used': 6.77, 'total': 15.75}, 'gpu': {'used': 1.02, 'total':
                         12.0}, 'retries': 0, 'oom': 0}
21:40:20-634919 DEBUG    Saving: config.json len=1720
21:40:20-638907 DEBUG    Unused settings: ['disable_gc']
21:40:20-640905 INFO     Startup time: 52.0s (torch=11.2s gradio=0.9s diffusers=1.3s libraries=1.5s samplers=0.1s
                         codeformer=0.1s scripts=4.0s onchange=0.4s ui-txt2img=0.1s ui-img2img=0.1s ui-settings=0.1s
                         ui-extensions=2.5s ui-defaults=0.1s launch=0.2s api=0.1s app-started=0.2s checkpoint=29.1s)
21:40:48-736524 DEBUG    txt2img: id_task=task(12we063i7u1m48v)|prompt=a bunny rabbit|negative_prompt=ugly, bad,
                         blurry, out of
                         frame|prompt_styles=[]|steps=20|sampler_index=7|latent_index=0|full_quality=True|restore_faces
                         =False|tiling=False|n_iter=1|batch_size=1|cfg_scale=6|clip_skip=1|seed=1418780905.0|subseed=-1
                         .0|subseed_strength=0|seed_resize_from_h=0|seed_resize_from_w=0||height=1024|width=1024|enable
                         _hr=False|denoising_strength=0.3|hr_scale=2|hr_upscaler=None|hr_second_pass_steps=20|hr_resize
                         _x=0|hr_resize_y=0|image_cfg_scale=6|diffusers_guidance_rescale=0.7|refiner_start=0.8||refiner
                         _prompt=|refiner_negative=|override_settings_texts=[]|args=(0, False, False, 'positive',
                         'comma', 0, False, False, '', 0, '', [], 0, '', [], 0, '', [], True, False, False, False, 0,
                         False)
21:40:48-754476 ERROR    Exception: '>' not supported between instances of 'NoneType' and 'int'
21:40:48-756470 ERROR    Arguments: args=('task(12we063i7u1m48v)', 'a bunny rabbit', 'ugly, bad, blurry, out of frame',
                         [], 20, 7, 0, True, False, False, 1, 1, 6, 6, 0.7, 1, 1418780905.0, -1.0, 0, 0, 0, 1024, 1024,
                         False, 0.3, 2, 'None', 20, 0, 0, 0.8, '', '', [], 0, False, False, 'positive', 'comma', 0,
                         False, False, '', 0, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, False)
                         kwargs={}
21:40:48-765446 ERROR    gradio call: TypeError
┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐
│ Z:\AI\SD\SDNext\automatic\modules\call_queue.py:34 in f                                                             │
│                                                                                                                     │
│    33 │   │   │   try:                                                                                              │
│ >  34 │   │   │   │   res = func(*args, **kwargs)                                                                   │
│    35 │   │   │   │   progress.record_results(id_task, res)                                                         │
│                                                                                                                     │
│ Z:\AI\SD\SDNext\automatic\modules\txt2img.py:65 in txt2img                                                          │
│                                                                                                                     │
│   64 │   if processed is None:                                                                                      │
│ > 65 │   │   processed = processing.process_images(p)                                                               │
│   66 │   p.close()                                                                                                  │
│                                                                                                                     │
│ Z:\AI\SD\SDNext\automatic\modules\processing.py:556 in process_images                                               │
│                                                                                                                     │
│    555 │   │   if not shared.opts.cuda_compile:                                                                     │
│ >  556 │   │   │   sd_models.apply_token_merging(p.sd_model, p.get_token_merging_ratio())                           │
│    557                                                                                                              │
│                                                                                                                     │
│ Z:\AI\SD\SDNext\automatic\modules\sd_models.py:1116 in apply_token_merging                                          │
│                                                                                                                     │
│   1115 │                                                                                                            │
│ > 1116 │   if token_merging_ratio > 0:                                                                              │
│   1117 │   │   tomesd.apply_patch(                                                                                  │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
TypeError: '>' not supported between instances of 'NoneType' and 'int'

Backend

Diffusers

Model

SD-XL

Acknowledgements

mkossigit commented 1 year ago

Getting the same error

vladmandic commented 1 year ago

fixed.