ComfyUI-WanVideoWrapper icon indicating copy to clipboard operation
ComfyUI-WanVideoWrapper copied to clipboard

Trying to set a tensor of shape torch.Size([1]) in "log scale" (which has shape torch.Size(l), this looks incorrect

Open shonlg opened this issue 1 year ago • 3 comments

碰到个很奇怪的问题,ComfyUI跑首尾帧,加载open-clip-xlm-roberta-large-vit-huge-14_visual_fp16.safetensors时,一直报上面的错误,ComfyUI更新到了最新版,ComfyUI-WanVideoWrapper也更新到了最新版本,T8的工作流,CNB上面部署的ComfyUI,其它工作流都正常,运行里的日志见下面,最后通过AI提示,将:/workspace/ComfyUI/models/loras/Wan/clip.py 文件中的:341行由: self.log_scale = nn.Parameter(math.log(1 / 0.07) * torch.ones([])) 改为下面的: self.log_scale = nn.Parameter(math.log(1 / 0.07) * torch.ones([1])) 保存后,重启ComfyUI就能正常运行, 作者可以看看,这是什么原因导致的,我这样修改会对其它的工作流有影响吗?有没有其它更好的解决方法?

正面的ComfyUI完整报错信息:

got prompt FETCH ComfyRegistry Data: 65/93 Converting T5 text encoder model to the expected format... FETCH ComfyRegistry Data: 70/93 FETCH ComfyRegistry Data: 75/93 FETCH ComfyRegistry Data: 80/93 FETCH ComfyRegistry Data: 85/93 FETCH ComfyRegistry Data: 90/93 FETCH ComfyRegistry Data [DONE] [ComfyUI-Manager] default cache updated: https://api.comfy.org/nodes FETCH DATA from: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json [DONE] [ComfyUI-Manager] All startup tasks have been completed. T5Encoder: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 24/24 [00:00<00:00, 83.98it/s] T5Encoder: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 24/24 [00:00<00:00, 816.30it/s]

😺dzNodes: LayerStyle -> ImageScaleByAspectRatio V2 Processed 1 image(s).

😺dzNodes: LayerStyle -> ImageMaskScaleAs Processed 1 image(s).

!!! Exception during processing !!! Trying to set a tensor of shape torch.Size([1]) in "log_scale" (which has shape torch.Size([])), this looks incorrect. Traceback (most recent call last): File "/workspace/ComfyUI/execution.py", line 496, 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, hidden_inputs=hidden_inputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/workspace/ComfyUI/execution.py", line 315, 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, hidden_inputs=hidden_inputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/workspace/ComfyUI/execution.py", line 289, in _async_map_node_over_list await process_inputs(input_dict, i) File "/workspace/ComfyUI/execution.py", line 277, in process_inputs result = f(**inputs) ^^^^^^^^^^^ File "/workspace/ComfyUI/custom_nodes/ComfyUI-WanVideoWrapper/nodes_model_loading.py", line 1506, in loadmodel clip_model = CLIPModel(dtype=dtype, device=device, state_dict=sd) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/workspace/ComfyUI/custom_nodes/ComfyUI-WanVideoWrapper/wanvideo/modules/clip.py", line 456, in init set_module_tensor_to_device(self.model, name, device=device, dtype=dtype, value=state_dict[name]) File "/workspace/venv312/lib/python3.12/site-packages/accelerate/utils/modeling.py", line 292, in set_module_tensor_to_device raise ValueError( ValueError: Trying to set a tensor of shape torch.Size([1]) in "log_scale" (which has shape torch.Size([])), this looks incorrect.

comfyui lumi batcher overwrite task done Prompt executed in 54.10 seconds

shonlg avatar Aug 07 '25 20:08 shonlg

Unsupported clip model selected.

kijai avatar Aug 07 '25 20:08 kijai

选择的是这个模型:open-clip-xlm-roberta-large-vit-huge-14_visual_fp16.safetensors,还有:umt5-xxl-enc-bf16.safetensors我确认过好几次,而且也对比过你H站这个文件的:sha256sum值都没有问题,我因为是在CNB上面跑的,我还直接下载过,能正常跑的仓库里面的这2个模型,在我的仓库都是报一样的错误,而且现在是修改了: 将:/workspace/ComfyUI/models/loras/Wan/clip.py 文件中的:341行由: self.log_scale = nn.Parameter(math.log(1 / 0.07) * torch.ones([])) self.log_scale = nn。参数(math.log(1 / 0.07) * torch.ones([])) 改为下面的: self.log_scale = nn.Parameter(math.log(1 / 0.07) * torch.ones([1])) self.log_scale = nn。参数(math.log(1 / 0.07) * torch.ones([1]))

这个就能跑了,应该不是模型选择的问题吧?

shonlg avatar Aug 08 '25 20:08 shonlg

same question Trying to set a tensor of shape torch.Size([1]) in "log scale" (which has shape torch.Size(l), this looks incorrect

Image

LLAI-lab avatar Dec 17 '25 03:12 LLAI-lab