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
131 stars 12 forks source link

Nightly Pytorch not supported. Fail to import. #10

Closed alessandroperilli closed 1 year ago

alessandroperilli commented 1 year ago

I had the following issue for a few days, but I didn't have the time to report it earlier. It used to work fine before.

scikit-learn version 1.3.0 is not supported. Minimum required version: 0.17. Maximum required version: 1.1.2. Disabling scikit-learn conversion API. Torch version 2.2.0.dev20231004 has not been tested with coremltools. You may run into unexpected errors. Torch 2.0.0 is the most recent version that has been tested. Traceback (most recent call last): File "xyz/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 "xyz/ComfyUI/custom_nodes/ComfyUI-CoreMLSuite/init.py", line 6, in from coreml_suite.nodes import CoreMLLoaderUNet, CoreMLSampler, CoreMLModelAdapter File "xyz/ComfyUI/custom_nodes/ComfyUI-CoreMLSuite/coreml_suite/nodes.py", line 11, in from coreml_suite.lcm.utils import add_lcm_model_options, lcm_patch, is_lcm File "xyz/ComfyUI/custom_nodes/ComfyUI-CoreMLSuite/coreml_suite/lcm/init.py", line 1, in from .nodes import COREML_CONVERT_LCMT File "xyz/ComfyUI/custom_nodes/ComfyUI-CoreMLSuite/coreml_suite/lcm/nodes.py", line 6, in from coreml_suite.lcm import converter as lcm_converter File "xyz/ComfyUI/custom_nodes/ComfyUI-CoreMLSuite/coreml_suite/lcm/converter.py", line 9, in from diffusers import UNet2DConditionModel, LCMScheduler ImportError: cannot import name 'LCMScheduler' from 'diffusers' (xyz/ComfyUI/venv/lib/python3.11/site-packages/diffusers/init.py)

Cannot import xyz/ComfyUI/custom_nodes/ComfyUI-CoreMLSuite module for custom nodes: cannot import name 'LCMScheduler' from 'diffusers' (xyz/ComfyUI/venv/lib/python3.11/site-packages/diffusers/init.py)

The result is that the ComfyUI fails the import.

Any chance you can restore support for nightly PyTorch builds? Thank you.

aszc-dev commented 1 year ago

Thanks for your comment. It seems to me, that the problem is with the diffusers library version. In my code, I imported LCMScheduler that is only available since v0.22. I fixed the version of diffusers and coremltools in my recent commit, so if you run pip install -r requirements.txt inside CoreMLSuite's root dir, it should install the correct versions.

As for the pytorch nightly - the warning about version 2.0.0 being the last tested version (it's 2.1.0 now, btw) comes from Apple's coremltools library, over which I have no control. It seems to work fine with nighlty build, though, at least for now.

Please try upgrading diffusers and see if it helps. The warnings about scikit-learn and torch versions can be ingored as long as the errors don't come directly from coremltools.

alessandroperilli commented 1 year ago

I did as you recommended and all requirements were already satisfied. Pip upgraded or installed nothing.

I only received the following warning at the end of the process:

DEPRECATION: torchsde 0.2.5 has a non-standard dependency specifier numpy>=1.19.*; python_version >= "3.7". pip 24.0 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of torchsde or contact the author to suggest that they release a version with a conforming dependency specifiers. Discussion can be found at https://github.com/pypa/pip/issues/12063

And, obviously, the custom node suite still fails to import.

alessandroperilli commented 1 year ago

I deleted the suite, restarted ComfyUI, reinstalled the suite, restarted ComfyUI. That fixed it.

I still have the warnings reported at the very top of this thread, but ComfyUI can now import the suite correctly. Thanks!