help!run in comfyui error---ValueError: codebook must have shape (16,), got (64, 16)
解决报错:
[INFO] got prompt
[INFO] HunyuanImage3: hunyuan_image_3_instruct_distil_w4a8.safetensors is the instruct_distil checkpoint
[INFO] Found quantization metadata version 1
[INFO] Using mixed precision operations
[INFO] Native ops: w6a8_int8, asym_w4a8_int8, int8_tensorwise, convrot_w4a4 , emulated ops: nvfp4, float8_e5m2, mxfp8, float8_e4m3fn
[INFO] model weight dtype torch.bfloat16, manual cast: None
[INFO] model_type FLOW
[ERROR] !!! Exception during processing !!! codebook must have shape (16,), got (64, 16)
[ERROR] Traceback (most recent call last):
File "E:\ComfyUI_portable_TE_v260619\ComfyUI\execution.py", line 547, in execute
output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI_portable_TE_v260619\ComfyUI\execution.py", line 352, in get_output_data
return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI_portable_TE_v260619\ComfyUI\execution.py", line 326, in async_map_node_over_list
await process_inputs(input_dict, i)
File "E:\ComfyUI_portable_TE_v260619\ComfyUI\execution.py", line 314, in process_inputs
result = f(**inputs)
File "E:\ComfyUI_portable_TE_v260619\ComfyUI\comfy_api\internal_init.py", line 149, in wrapped_func
return method(locked_class, **inputs)
File "E:\ComfyUI_portable_TE_v260619\ComfyUI\comfy_api\latest_io.py", line 2208, in EXECUTE_NORMALIZED
to_return = cls.execute(*args, **kwargs)
File "E:\ComfyUI_portable_TE_v260619\ComfyUI\custom_nodes\ComfyUI-HunyuanImage3\nodes.py", line 109, in execute
patcher, _ = load_hunyuan_image_3(path)
~~~~~~~~~~~~~~~~~~~~^^^^^^
File "E:\ComfyUI_portable_TE_v260619\ComfyUI\custom_nodes\ComfyUI-HunyuanImage3\hunyuan_image_3\loader.py", line 173, in load_hunyuan_image_3
loaded = model.diffusion_model.load_state_dict(state_dict, strict=False, assign=patcher.is_dynamic())
File "E:\ComfyUI_portable_TE_v260619\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 2618, in load_state_dict
load(self, state_dict)
~~~~^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI_portable_TE_v260619\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 2605, in load
load(child, child_state_dict, child_prefix) # noqa: F821
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI_portable_TE_v260619\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 2605, in load
load(child, child_state_dict, child_prefix) # noqa: F821
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI_portable_TE_v260619\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 2605, in load
load(child, child_state_dict, child_prefix) # noqa: F821
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Previous line repeated 2 more times]
File "E:\ComfyUI_portable_TE_v260619\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 2588, in load
module._load_from_state_dict(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
local_state_dict,
^^^^^^^^^^^^^^^^^
...<5 lines>...
error_msgs,
^^^^^^^^^^^
)
^
File "E:\ComfyUI_portable_TE_v260619\ComfyUI\comfy\ops.py", line 1576, in _load_from_state_dict
_load_quantized_module(self, super()._load_from_state_dict, state_dict, prefix, *args, load_extra_params=False)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI_portable_TE_v260619\ComfyUI\custom_nodes\ComfyUI-HunyuanImage3\compat.py", line 177, in _load_quantized_module
params = params_cls(**scales, orig_dtype=compute_dtype, orig_shape=module._orig_shape)
File "", line 12, in init
File "E:\ComfyUI_portable_TE_v260619\python_embeded\Lib\site-packages\comfy_kitchen\tensor\base.py", line 52, in post_init
self._validate_tensor_fields()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "E:\ComfyUI_portable_TE_v260619\python_embeded\Lib\site-packages\comfy_kitchen\tensor\w4a8_int8.py", line 186, in _validate_tensor_fields
raise ValueError(
f"codebook must have shape (16,), got {tuple(self.codebook.shape)}"
)
ValueError: codebook must have shape (16,), got (64, 16)
[INFO] Prompt executed in 0.24 seconds
This was caused by ComfyUI's late-September change to how quantized MoE expert banks load; the pack's old compatibility layer passed comfy-kitchen one codebook per expert where it now takes one per bank. Fixed in the latest version of the pack: please update it (git pull in custom_nodes/ComfyUI-HunyuanImage3, or update it in ComfyUI Manager) and restart ComfyUI. Your ComfyUI is already recent enough. If it still fails, please post the new traceback.
This was caused by ComfyUI's late-September change to how quantized MoE expert banks load; the pack's old compatibility layer passed comfy-kitchen one codebook per expert where it now takes one per bank. Fixed in the latest version of the pack: please update it (git pull in custom_nodes/ComfyUI-HunyuanImage3, or update it in ComfyUI Manager) and restart ComfyUI. Your ComfyUI is already recent enough. If it still fails, please post the new traceback.
run success. thanks