aszc-dev / ComfyUI-CoreMLSuite

A set of custom nodes for ComfyUI that allow you to use Core ML models in your ComfyUI workflows.
GNU General Public License v3.0
120 stars 12 forks source link

No module named 'diffusers.utils.torch_utils' #8

Closed uralsocket closed 10 months ago

uralsocket commented 11 months ago

load failed, here is Traceback:

Traceback : File "/Users/user/ComfyUI/nodes.py", line 1735, in load_custom_node module_spec.loader.exec_module(module) File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed File "/Users/user/ComfyUI/custom_nodes/ComfyUI-CoreMLSuite/init.py", line 7, in from coreml_suite.lcm import ( File "/Users/user/ComfyUI/custom_nodes/ComfyUI-CoreMLSuite/coreml_suite/lcm/init.py", line 1, in from .lcm_sampler import CoreMLSamplerLCM File "/Users/user/ComfyUI/custom_nodes/ComfyUI-CoreMLSuite/coreml_suite/lcm/lcm_sampler.py", line 5, in from diffusers.utils.torch_utils import randn_tensor ModuleNotFoundError: No module named 'diffusers.utils.torch_utils'

Cannot import /Users/user/ComfyUI/custom_nodes/ComfyUI-CoreMLSuite module for custom nodes: No module named 'diffusers.utils.torch_utils'

aszc-dev commented 11 months ago

That's unexpected, diffusers should be installed with ml-stable-diffusion as it is one of its' dependency. I've just tested this on a fresh python virtualenv and CoreMLSuite loaded just fine. Nevertheless, I added diffusers to requirements to be sure. Thank you for your feedback and please let me know if you have any other issues with missing dependencies.

uralsocket commented 11 months ago

I think I figured it out, now I would understand how to connect two points:

In the file on which everything is cended, the following is written:

"import os

import numpy as np import torch from diffusers.utils.torch_utils import randn_tensor from tqdm import tqdm и т.д."

We are interested in the fifth line "from diffusers.utils.torch_utils import randn_tensor" - There is an interruption on it and an error that nothing was found At the same time, I found where the file we need is - it is on the way "/opt/homebrew/lib/python3.11/site-packages/diffusers/utils/torch_utils.py"

Here's the question - how to force this path into a file?

aszc-dev commented 10 months ago

Make sure that you use the same python interpreter that has diffusers installed as a site-package. Before running ComfyUI, please type in which python/which python3 (or even python3.11, depending on the python command you use to run ComfyUI). It should point to /opt/homebrew/bin/python(3[.11]). If it's not, then you have to work out why is that or simply install the dependencies again, for the interpreter you're currently using. To do that. go to ComfyUI root directory and run pip3 install -r requirements.txt, cd to CoreMLSuite root directory and run the same command.

aszc-dev commented 10 months ago

Since lcm_sampler is no longer a part of the codebase, I'm closing this issue. If you have any other problems importing proper packages, please open another one. Thanks!