Jannchie / ComfyUI-J

Jannchie's ComfyUI custom nodes.
73 stars 13 forks source link

Fails to install several packages #9

Closed AgeOfAlgorithms closed 6 months ago

AgeOfAlgorithms commented 6 months ago

Hello, I'm using Ubuntu 22.04.4 with rocm 5.6.1 and Python 3.9. I get several errors while trying to install the packages using ComfyUI Manager.

image

Traceback (most recent call last):
  File "/home/sean/ComfyUI/nodes.py", line 1888, in load_custom_node
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/sean/ComfyUI/custom_nodes/antrobots-comfyUI-nodepack/__init__.py", line 1, in <module>
    from .utils.globals import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
  File "/home/sean/ComfyUI/custom_nodes/antrobots-comfyUI-nodepack/utils/globals.py", line 19, in <module>
    from ..sampling_nodes import NODE_CLASS_MAPPINGS as sampling_nodes
  File "/home/sean/ComfyUI/custom_nodes/antrobots-comfyUI-nodepack/sampling_nodes.py", line 31, in <module>
    class KSamplerWithRefiner(KSampler):
  File "/home/sean/ComfyUI/custom_nodes/antrobots-comfyUI-nodepack/sampling_nodes.py", line 61, in KSamplerWithRefiner
    def sample(self, base_model, refiner_model, total_steps, refine_step, cfg, sampler_name, scheduler, base_positive, base_negative, refine_positive, refine_negative, base_vae, refine_vae, latent_image, seed,base_denoise, refine_denoise, mask: torch.Tensor|None = None) -> tuple[torch.Tensor, Any]:
TypeError: unsupported operand type(s) for |: 'torch._C._TensorMeta' and 'NoneType'

Cannot import /home/sean/ComfyUI/custom_nodes/antrobots-comfyUI-nodepack module for custom nodes: unsupported operand type(s) for |: 'torch._C._TensorMeta' and 'NoneType'
Traceback (most recent call last):
  File "/home/sean/anaconda3/envs/py39/lib/python3.9/site-packages/transformers/image_processing_utils.py", line 329, in get_image_processor_dict
    resolved_image_processor_file = cached_file(
  File "/home/sean/anaconda3/envs/py39/lib/python3.9/site-packages/transformers/utils/hub.py", line 429, in cached_file
    resolved_file = hf_hub_download(
  File "/home/sean/anaconda3/envs/py39/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 110, in _inner_fn
    validate_repo_id(arg_value)
  File "/home/sean/anaconda3/envs/py39/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 158, in validate_repo_id
    raise HFValidationError(
huggingface_hub.utils._validators.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '/home/sean/ComfyUI/custom_nodes/Comfyui_segformer_b2_clothes/checkpoints/segformer_b2_clothes'. Use `repo_type` argument if needed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sean/ComfyUI/nodes.py", line 1888, in load_custom_node
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/sean/ComfyUI/custom_nodes/Comfyui_segformer_b2_clothes/__init__.py", line 1, in <module>
    from .segformer_b2_clothes import *
  File "/home/sean/ComfyUI/custom_nodes/Comfyui_segformer_b2_clothes/segformer_b2_clothes.py", line 18, in <module>
    processor = SegformerImageProcessor.from_pretrained(model_folder_path)
  File "/home/sean/anaconda3/envs/py39/lib/python3.9/site-packages/transformers/image_processing_utils.py", line 202, in from_pretrained
    image_processor_dict, kwargs = cls.get_image_processor_dict(pretrained_model_name_or_path, **kwargs)
  File "/home/sean/anaconda3/envs/py39/lib/python3.9/site-packages/transformers/image_processing_utils.py", line 348, in get_image_processor_dict
    raise EnvironmentError(
OSError: Can't load image processor for '/home/sean/ComfyUI/custom_nodes/Comfyui_segformer_b2_clothes/checkpoints/segformer_b2_clothes'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure '/home/sean/ComfyUI/custom_nodes/Comfyui_segformer_b2_clothes/checkpoints/segformer_b2_clothes' is the correct path to a directory containing a preprocessor_config.json file

Cannot import /home/sean/ComfyUI/custom_nodes/Comfyui_segformer_b2_clothes module for custom nodes: Can't load image processor for '/home/sean/ComfyUI/custom_nodes/Comfyui_segformer_b2_clothes/checkpoints/segformer_b2_clothes'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure '/home/sean/ComfyUI/custom_nodes/Comfyui_segformer_b2_clothes/checkpoints/segformer_b2_clothes' is the correct path to a directory containing a preprocessor_config.json file
Traceback (most recent call last):
  File "/home/sean/ComfyUI/nodes.py", line 1888, in load_custom_node
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/sean/ComfyUI/custom_nodes/ComfyUI-J/__init__.py", line 17, in <module>
    from .pipelines import ControlNetUnit, ControlNetUnits, PipelineWrapper, schedulers
  File "/home/sean/ComfyUI/custom_nodes/ComfyUI-J/pipelines/__init__.py", line 18, in <module>
    from .jannchie import *
  File "/home/sean/ComfyUI/custom_nodes/ComfyUI-J/pipelines/jannchie.py", line 14, in <module>
    from diffusers.models.autoencoders import AutoencoderKL
ModuleNotFoundError: No module named 'diffusers.models.autoencoders'

Cannot import /home/sean/ComfyUI/custom_nodes/ComfyUI-J module for custom nodes: No module named 'diffusers.models.autoencoders'
Efficiency Nodes: Attempting to add Control Net options to the 'HiRes-Fix Script' Node (comfyui_controlnet_aux add-on)...Success!
Traceback (most recent call last):
  File "/home/sean/ComfyUI/nodes.py", line 1888, in load_custom_node
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/sean/ComfyUI/custom_nodes/ComfyUI-Inference-Core-Nodes/__init__.py", line 1, in <module>
    from inference_core_nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
ModuleNotFoundError: No module named 'inference_core_nodes'

Cannot import /home/sean/ComfyUI/custom_nodes/ComfyUI-Inference-Core-Nodes module for custom nodes: No module named 'inference_core_nodes'

AgeOfAlgorithms commented 6 months ago

I got the segformer working by git cloning the repo into custom_nodes folder and then pip installing the requirements. The other two packages still have the same problem:

Traceback (most recent call last):
  File "/home/sean/ComfyUI/nodes.py", line 1888, in load_custom_node
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/sean/ComfyUI/custom_nodes/antrobots-comfyUI-nodepack/__init__.py", line 1, in <module>
    from .utils.globals import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
  File "/home/sean/ComfyUI/custom_nodes/antrobots-comfyUI-nodepack/utils/globals.py", line 19, in <module>
    from ..sampling_nodes import NODE_CLASS_MAPPINGS as sampling_nodes
  File "/home/sean/ComfyUI/custom_nodes/antrobots-comfyUI-nodepack/sampling_nodes.py", line 31, in <module>
    class KSamplerWithRefiner(KSampler):
  File "/home/sean/ComfyUI/custom_nodes/antrobots-comfyUI-nodepack/sampling_nodes.py", line 61, in KSamplerWithRefiner
    def sample(self, base_model, refiner_model, total_steps, refine_step, cfg, sampler_name, scheduler, base_positive, base_negative, refine_positive, refine_negative, base_vae, refine_vae, latent_image, seed,base_denoise, refine_denoise, mask: torch.Tensor|None = None) -> tuple[torch.Tensor, Any]:
TypeError: unsupported operand type(s) for |: 'torch._C._TensorMeta' and 'NoneType'

Cannot import /home/sean/ComfyUI/custom_nodes/antrobots-comfyUI-nodepack module for custom nodes: unsupported operand type(s) for |: 'torch._C._TensorMeta' and 'NoneType'
/home/sean/anaconda3/envs/py39/lib/python3.9/site-packages/transformers/models/segformer/image_processing_segformer.py:101: FutureWarning: The `reduce_labels` parameter is deprecated and will be removed in a future version. Please use `do_reduce_labels` instead.
  warnings.warn(
Traceback (most recent call last):
  File "/home/sean/ComfyUI/nodes.py", line 1888, in load_custom_node
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/sean/ComfyUI/custom_nodes/ComfyUI-J/__init__.py", line 17, in <module>
    from .pipelines import ControlNetUnit, ControlNetUnits, PipelineWrapper, schedulers
  File "/home/sean/ComfyUI/custom_nodes/ComfyUI-J/pipelines/__init__.py", line 18, in <module>
    from .jannchie import *
  File "/home/sean/ComfyUI/custom_nodes/ComfyUI-J/pipelines/jannchie.py", line 1189, in <module>
    class BasicTransformerBlockReferenceOnly(BasicTransformerBlock):
  File "/home/sean/ComfyUI/custom_nodes/ComfyUI-J/pipelines/jannchie.py", line 1201, in BasicTransformerBlockReferenceOnly
    attention_mask: torch.FloatTensor | None = None,
TypeError: unsupported operand type(s) for |: 'torch.tensortype' and 'NoneType'

Cannot import /home/sean/ComfyUI/custom_nodes/ComfyUI-J module for custom nodes: unsupported operand type(s) for |: 'torch.tensortype' and 'NoneType'
AgeOfAlgorithms commented 6 months ago

I seem to have solved the problem using info from this thread: https://github.com/tiangolo/typer/issues/371. The | operand doesn't work out of the box in my system when defining parameter types, probably due to using Python 3.9 rather than >3.10.

e.g. this function will produce an error: def forward( self, hidden_states: torch.FloatTensor, attention_mask: torch.FloatTensor | None = None, encoder_hidden_states: torch.FloatTensor | None = None, ... ) ...

The solution was to add from __future__ import annotations on top of the following files:

I haven't run it yet but everything loads fine.

Jannchie commented 6 months ago

The solution was to add from future import annotations on top of the following files:

This usually means a python version mismatch.

The version of python I'm using is 3.11 and uses some newer syntax, so there's no way to run it in some older python environments.

Maybe I should update the readme to mention this.