flowtyone / ComfyUI-Flowty-LDSR

LDSR custom node for ComfyUI
GNU General Public License v3.0
190 stars 14 forks source link

some non descriptive error with the node #1

Closed jags111 closed 8 months ago

jags111 commented 8 months ago

While running the LDSR upscale node it is giving some error not clear from the directory path or settings in the init.py Please check the error details here;

File "D:\AI\comfyUI\execution.py", line 154, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\AI\comfyUI\execution.py", line 84, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\AI\comfyUI\execution.py", line 77, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\AI\ComfyUI\custom_nodes\ComfyUI-Flowty-LDSR\__init__.py", line 46, in upscale
    outputs.append(ldsr.superResolution(image, int(steps), pre_downscale, post_downscale, downsample_method))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\AI\comfyUI\venv\Lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "D:\AI\ComfyUI\custom_nodes\ComfyUI-Flowty-LDSR\ldsrlib\LDSR.py", line 203, in superResolution
    model = self.load_model_from_config()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\AI\ComfyUI\custom_nodes\ComfyUI-Flowty-LDSR\ldsrlib\LDSR.py", line 26, in load_model_from_config
    pl_sd = torch.load(self.modelPath, map_location="cpu")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\AI\comfyUI\venv\Lib\site-packages\torch\serialization.py", line 1014, in load
    return _load(opened_zipfile,
           ^^^^^^^^^^^^^^^^^^^^^
  File "D:\AI\comfyUI\venv\Lib\site-packages\torch\serialization.py", line 1422, in _load
    result = unpickler.load()
             ^^^^^^^^^^^^^^^^
  File "D:\AI\comfyUI\venv\Lib\site-packages\torch\serialization.py", line 1415, in find_class
    return super().find_class(mod_name, name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\AI\comfyUI\venv\Lib\site-packages\pytorch_lightning\__init__.py", line 34, in <module>
    from pytorch_lightning.callbacks import Callback  # noqa: E402
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\AI\comfyUI\venv\Lib\site-packages\pytorch_lightning\callbacks\__init__.py", line 14, in <module>
    from pytorch_lightning.callbacks.callback import Callback
  File "D:\AI\comfyUI\venv\Lib\site-packages\pytorch_lightning\callbacks\callback.py", line 25, in <module>
    from pytorch_lightning.utilities.types import STEP_OUTPUT
  File "D:\AI\comfyUI\venv\Lib\site-packages\pytorch_lightning\utilities\__init__.py", line 18, in <module>
    from pytorch_lightning.utilities.apply_func import move_data_to_device  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\AI\comfyUI\venv\Lib\site-packages\pytorch_lightning\utilities\apply_func.py", line 29, in <module>
    from pytorch_lightning.utilities.imports import _compare_version, _TORCHTEXT_LEGACY
  File "D:\AI\comfyUI\venv\Lib\site-packages\pytorch_lightning\utilities\imports.py", line 145, in <module>
    _HYDRA_EXPERIMENTAL_AVAILABLE = _module_available("hydra.experimental")
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\AI\comfyUI\venv\Lib\site-packages\pytorch_lightning\utilities\imports.py", line 56, in _module_available
    importlib.import_module(module_path)
  File "C:\Python311\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\AI\comfyUI\venv\Lib\site-packages\hydra\__init__.py", line 5, in <module>
    from hydra import utils
  File "D:\AI\comfyUI\venv\Lib\site-packages\hydra\utils.py", line 8, in <module>
    import hydra._internal.instantiate._instantiate2
  File "D:\AI\comfyUI\venv\Lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 11, in <module>
    from hydra._internal.utils import _locate
  File "D:\AI\comfyUI\venv\Lib\site-packages\hydra\_internal\utils.py", line 17, in <module>
    from hydra.core.utils import get_valid_filename, validate_config_path
  File "D:\AI\comfyUI\venv\Lib\site-packages\hydra\core\utils.py", line 19, in <module>
    from hydra.core.hydra_config import HydraConfig
  File "D:\AI\comfyUI\venv\Lib\site-packages\hydra\core\hydra_config.py", line 6, in <module>
    from hydra.conf import HydraConf
  File "D:\AI\comfyUI\venv\Lib\site-packages\hydra\conf\__init__.py", line 45, in <module>
    class JobConf:
  File "D:\AI\comfyUI\venv\Lib\site-packages\hydra\conf\__init__.py", line 70, in JobConf
    @dataclass
     ^^^^^^^^^
  File "C:\Python311\Lib\dataclasses.py", line 1230, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "C:\Python311\Lib\dataclasses.py", line 1220, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\dataclasses.py", line 958, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\dataclasses.py", line 815, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'hydra.conf.JobConf.JobConfig.OverrideDirname'> for field override_dirname is not allowed: use default_factory

thanks for the node and model and would love to test same

flowtyone commented 8 months ago

Please make sure that you have the proper version of pytorch-lightning installed as listed in requirements.txt

jags111 commented 8 months ago

already installed and checked again now for same checked the pytorch-lightning install from PYPI also. https://pypi.org/project/pytorch-lightning/ does it need to be a special install or whatever pip install will do. will the version have any issue in the results.

flowtyone commented 8 months ago

@jags111 Versions have to exactly match the ones in requirements.txt

jags111 commented 8 months ago

to be frank when the issue was checked i just simply ran the pip install requirements.txt and now that it is throwing some error from lightning will check out the same and then update if the module is the one giving same. Thanks

Botoni commented 8 months ago

It throws an error for me too, don't know if it's related.

python 3.12 , cuda 1.2.1 and torch 2.3.0.dev20231220+cu121

Error occurred when executing LDSRUpscaler:

'global_step'

  File "/run/media/toni/DATA/Software/Stable_Diffusion/ComfyUI/execution.py", line 154, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/run/media/toni/DATA/Software/Stable_Diffusion/ComfyUI/execution.py", line 84, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/run/media/toni/DATA/Software/Stable_Diffusion/ComfyUI/execution.py", line 77, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/run/media/toni/DATA/Software/Stable_Diffusion/ComfyUI/custom_nodes/ComfyUI-Flowty-LDSR/__init__.py", line 46, in upscale
    outputs.append(ldsr.superResolution(image, int(steps), pre_downscale, post_downscale, downsample_method))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/run/media/toni/DATA/Software/Stable_Diffusion/ComfyUI/venv/lib64/python3.12/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/run/media/toni/DATA/Software/Stable_Diffusion/ComfyUI/custom_nodes/ComfyUI-Flowty-LDSR/ldsrlib/LDSR.py", line 203, in superResolution
    model = self.load_model_from_config()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/run/media/toni/DATA/Software/Stable_Diffusion/ComfyUI/custom_nodes/ComfyUI-Flowty-LDSR/ldsrlib/LDSR.py", line 27, in load_model_from_config
    global_step = pl_sd["global_step"]
                  ~~~~~^^^^^^^^^^^^^^^
charliebrown777 commented 8 months ago

image image

Same here. Already installed pytorch-lightning 1.7.7 as instructed. Still got this error.

flowtyone commented 8 months ago

@Botoni people on reddit confirmed that redownloading the checkpoint file helped them with this issue

flowtyone commented 8 months ago

@charliebrown777 I believe you that you installed pytorch lightning but this error says you dont have it, maybe you didn't install it in the right folder or you have a portable version of comfyui (I dont know how to make it work on the portable one)

charliebrown777 commented 8 months ago

@charliebrown777 I believe you that you installed pytorch lightning but this error says you dont have it, maybe you didn't install it in the right folder or you have a portable version of comfyui (I dont know how to make it work on the portable one)

Portable or not it is compatible with hundreds of custom nodes I use. So what folder should the lighting be put into? I just pip the module in cmd. Thanks!

Botoni commented 8 months ago

@charliebrown777 I don't use the portable version, but i think that you installed the pytorch-lighting package to the system python and you should install it with the embedded python.

@flowtyone what checkpoint are you referring to? The SD model?

charliebrown777 commented 8 months ago

image I just set up the workflow as the one in the repository.

flowtyone commented 8 months ago

@Botoni check out the installation instructions, they include a download link

Botoni commented 8 months ago

@Botoni check out the installation instructions, they include a download link

Thanks! Solved my error and everything works, well, except I ran out of memory with 8 vram upscaling a 1080p ^_^u