ComfyUI-3D-Pack icon indicating copy to clipboard operation
ComfyUI-3D-Pack copied to clipboard

Need diffusers==0.35.0(for qwen image edit nunchaku), but Comfyui-3D-PAck not working(import failed), only until diffusers==0.34.0 ?? Will there be an update?

Open mkat2 opened this issue 3 months ago • 5 comments

Need diffusers==0.35.0(for qwen image edit nunchaku), but Comfyui-3D-PAck not working(import failed), only until diffusers==0.34.0 ?? Will there be an update?

Warn!: Traceback (most recent call last): File "d:\comfyui.git\app\nodes.py", line 2129, in load_custom_node module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in call_with_frames_removed File "D:\comfyui.git\app\custom_nodes\ComfyUI-3D-Pack_init.py", line 53, in module = importlib.import_module(f".{nodes_filename}", package=name) File "D:\miniconda\lib\importlib_init_.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "D:\comfyui.git\app\custom_nodes\ComfyUI-3D-Pack\nodes.py", line 85, in from CharacterGen.character_inference import Inference2D_API, Inference3D_API File "D:\comfyui.git\app\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\CharacterGen\character_inference.py", line 14, in from CharacterGen.Stage_2D.tuneavideo.models.unet_mv2d_condition import UNetMV2DConditionModel File "D:\comfyui.git\app\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\CharacterGen\Stage_2D\tuneavideo\models\unet_mv2d_condition.py", line 40, in from diffusers.models.modeling_utils import ModelMixin, load_state_dict, _load_state_dict_into_model ImportError: cannot import name '_load_state_dict_into_model' from 'diffusers.models.modeling_utils' (D:\comfyui.git\app\env\lib\site-packages\diffusers\models\modeling_utils.py)

Warn!: Cannot import D:\comfyui.git\app\custom_nodes\ComfyUI-3D-Pack module for custom nodes: cannot import name '_load_state_dict_into_model' from 'diffusers.models.modeling_utils' (D:\comfyui.git\app\env\lib\site-packages\diffusers\models\modeling_utils.py)

mkat2 avatar Sep 22 '25 15:09 mkat2

@mkat2 will take a look into this, thanks

DenisKochetov avatar Sep 22 '25 15:09 DenisKochetov

Hi i add the same problem and i have a workaround if you are interested. _load_state_dict_into_model is no longer used

If you are in a hurry the workaroud that i am currently using is that:

replace from diffusers.models.modeling_utils import ModelMixin, load_state_dict, _load_state_dict_into_model with from diffusers.models.modeling_utils import ModelMixin, load_state_dict (Basically remove the last entry) and then replace

         if state_dict is not None:
            # Whole checkpoint
            mismatched_keys = _find_mismatched_keys(
                state_dict,
                model_state_dict,
                original_loaded_keys,
                ignore_mismatched_sizes,
           )
            error_msgs = _load_state_dict_into_model(model_to_load, state_dict)

with

         if state_dict is not None:
            # Whole checkpoint
            load_info = model_to_load.load_state_dict(state_dict, strict=False)

(it is easy to find if you search in the file for "_load_state_dict_into_model") It works with diffusers 0.35.1 but you are suppressing the error_msgs (i have no idea what to do with load_info) so if you want something better you have to wait an official fix. Also if i remember well there are 4 files that use the _load_state_dict_into_model so you have to make this modification 4 times.

No1Idle avatar Sep 23 '25 08:09 No1Idle

@No1Idle thanks a lot man, you’re right. We’ll fix this later, really appreciate you providing solutions for users — super helpful! You can also create a pull request and be a contributor, it’s very much appreciated!

DenisKochetov avatar Sep 23 '25 09:09 DenisKochetov

Thanks @No1Idle ! I adjusted the code in 4 files and the node loads successful now.

mkat2 avatar Sep 23 '25 12:09 mkat2

Guys it would be super helpful if instead of "the file" and "4 files" you could be specific about what files (eg. path/from/root/filename.py) for intellectually challenged individuals like myself.

renwerx avatar Oct 25 '25 00:10 renwerx