kijai / ComfyUI-PyramidFlowWrapper

MIT License
97 stars 4 forks source link

Error "expected np.ndarray (got Tensor)" #10

Closed Kvento closed 13 hours ago

Kvento commented 16 hours ago

When I try to run any model I get the error:

DownloadAndLoadPyramidFlowModel

expected np.ndarray (got Tensor)

Below is the report:

ComfyUI Error Report

Error Details

  • Node Type: DownloadAndLoadPyramidFlowModel
  • Exception Type: TypeError
  • Exception Message: expected np.ndarray (got Tensor)

    Stack Trace

    
    File "F:\All_AIs\Image_Video\ComfyUI_windows_portable\ComfyUI\execution.py", line 323, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    File "F:\All_AIs\Image_Video\ComfyUI_windows_portable\ComfyUI\execution.py", line 198, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    File "F:\All_AIs\Image_Video\ComfyUI_windows_portable\ComfyUI\execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)
    
    File "F:\All_AIs\Image_Video\ComfyUI_windows_portable\ComfyUI\execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    File "F:\All_AIs\Image_Video\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-PyramidFlowWrapper\nodes.py", line 84, in loadmodel
    model = PyramidDiTForVideoGeneration(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    File "F:\All_AIs\Image_Video\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-PyramidFlowWrapper\pyramid_dit\pyramid_dit_for_video_gen_pipeline.py", line 116, in __init__
    self.scheduler = PyramidFlowMatchEulerDiscreteScheduler(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    File "F:\All_AIs\Image_Video\ComfyUI_windows_portable\python_embeded\Lib\site-packages\diffusers\configuration_utils.py", line 653, in inner_init
    init(self, *args, **init_kwargs)
    
    File "F:\All_AIs\Image_Video\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-PyramidFlowWrapper\diffusion_schedulers\scheduling_flow_matching.py", line 65, in __init__
    self.init_sigmas_for_each_stage()
    
    File "F:\All_AIs\Image_Video\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-PyramidFlowWrapper\diffusion_schedulers\scheduling_flow_matching.py", line 145, in init_sigmas_for_each_stage
    self.timesteps_per_stage[i_s] = torch.from_numpy(timesteps[:-1])
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

## System Information
- **ComfyUI Version:** v0.2.2-93-g8dfa0cc
- **Arguments:** ComfyUI\main.py --windows-standalone-build --output-directory F:\All_AIs\Image_Video\SD_Forge\webui\outputs
- **OS:** nt
- **Python Version:** 3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]
- **Embedded Python:** true
- **PyTorch Version:** 2.4.1+cu124
## Devices

- **Name:** cuda:0 NVIDIA GeForce RTX 2080 Ti : cudaMallocAsync
  - **Type:** cuda
  - **VRAM Total:** 11810832384
  - **VRAM Free:** 10585374720
  - **Torch VRAM Total:** 0
  - **Torch VRAM Free:** 0
kijai commented 16 hours ago

No idea how that's possible, possibly something to do with numpy or diffusers versions...

Kvento commented 16 hours ago

Hmm.. pip list says that I have these versions installed:

diffusers 0.28.0 numpy 1.22.0

And what should they be?

kijai commented 16 hours ago

Check the requirements.txt, diffusers should be 0.30.1 at very least, latest one works fine, and I recommend numpy 1.26.4 (just added that to requirements too just in case)

Kvento commented 16 hours ago

Unfortunately, it didn't help. Updated everything (pip install -r requirements.txt) using the requirements.txt you added, but I still get a crash in the DownloadAndLoadPyramidFlowModel block.

kijai commented 15 hours ago

You're using portable? If so then did you do the pip install with the portable's python.exe ?

Kvento commented 14 hours ago

Yes, I use ComfyUI portable. As for pip install, I just ran CMD, cd to the folder ...\ComfyUI-PyramidFlowWrapper-main and ran pip install -r requirements.txt

Kvento commented 13 hours ago

Ok, looks like I was able to solve this problem. I ran _update_comfyui_and_pythondependencies.bat (which is in the update folder in the root directory of ComfyUI) and apparently something was additionally installed or reinstalled, because after that everything worked. Thanks!

reallybigname commented 13 hours ago

So, I was having the same error as the other fellow. Unlike them, I DID run pip updates from my embedded python.exe. I checked my diffusers and they were the same as you listed. But, I noticed that numpy was like 2.0.1 or something, the next version. I went ahead and just ran your new requirements.txt and it downgraded numpy, and it seems to be starting up now. Just wanted to let you know. Pretty sure it's having newer numpy that caused that error.

Cheers! Gonna try it now.

kijai commented 13 hours ago

So, I was having the same error as the other fellow. Unlike them, I DID run pip updates from my embedded python.exe. I checked my diffusers and they were the same as you listed. But, I noticed that numpy was like 2.0.1 or something, the next version. I went ahead and just ran your new requirements.txt and it downgraded numpy, and it seems to be starting up now. Just wanted to let you know. Pretty sure it's having newer numpy that caused that error.

Cheers! Gonna try it now.

That's good to know, thanks, and yeah the numpy 2.0 update has been causing issues with lots of stuff.