Comfy-Org / Comfy-Org/ComfyUI

Constant "index out of range self" error flux klein

Open
#12,052 1 comment 0 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

### Custom Node Testing

- [x] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)

### Expected Behavior

Using the template for klein 9b.
Restarting multiple times sometimes resolve it, until it happens again. But continues to happen persistently.

```got prompt
!!! Exception during processing !!! index out of range in self
Traceback (most recent call last):
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\ComfyUI\execution.py", line 518, 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 "C:\Users\crz\Downloads\ComfyUI_windows_portable\ComfyUI\execution.py", line 329, 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 "C:\Users\crz\Downloads\ComfyUI_windows_portable\ComfyUI\execution.py", line 303, in _async_map_node_over_list
await process_inputs(input_dict, i)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\ComfyUI\execution.py", line 291, in process_inputs
result = f(**inputs)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\ComfyUI\nodes.py", line 79, in encode
return (clip.encode_from_tokens_scheduled(tokens), )
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\ComfyUI\comfy\sd.py", line 208, in encode_from_tokens_scheduled
pooled_dict = self.encode_from_tokens(tokens, return_pooled=return_pooled, return_dict=True)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\ComfyUI\comfy\sd.py", line 272, in encode_from_tokens
o = self.cond_stage_model.encode_token_weights(tokens)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\ComfyUI\comfy\text_encoders\flux.py", line 155, in encode_token_weights
out, pooled, extra = super().encode_token_weights(token_weight_pairs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\ComfyUI\comfy\sd1_clip.py", line 704, in encode_token_weights
out = getattr(self, self.clip).encode_token_weights(token_weight_pairs)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\ComfyUI\comfy\sd1_clip.py", line 45, in encode_token_weights
o = self.encode(to_encode)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\ComfyUI\comfy\sd1_clip.py", line 297, in encode
return self(tokens)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1775, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1786, in _call_impl
return forward_call(*args, **kwargs)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\ComfyUI\comfy\sd1_clip.py", line 270, in forward
outputs = self.transformer(None, attention_mask_model, embeds=embeds, num_tokens=num_tokens, intermediate_output=intermediate_output, final_layer_norm_intermediate=self.layer_norm_hidden_state, dtype=torch.float32, embeds_info=embeds_info)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1775, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1786, in _call_impl
return forward_call(*args, **kwargs)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\ComfyUI\comfy\text_encoders\llama.py", line 636, in forward
return self.model(input_ids, *args, **kwargs)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1775, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1786, in _call_impl
return forward_call(*args, **kwargs)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\ComfyUI\comfy\text_encoders\llama.py", line 569, in forward
x = layer(
x=x,
...<2 lines>...
optimized_attention=optimized_attention,
)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1775, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1786, in _call_impl
return forward_call(*args, **kwargs)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\ComfyUI\comfy\text_encoders\llama.py", line 426, in forward
x = self.mlp(x)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1775, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1786, in _call_impl
return forward_call(*args, **kwargs)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\ComfyUI\comfy\text_encoders\llama.py", line 395, in forward
return self.down_proj(self.activation(self.gate_proj(x)) * self.up_proj(x))
~~~~~~~~~~~~^^^
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1775, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1786, in _call_impl
return forward_call(*args, **kwargs)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\ComfyUI\comfy\ops.py", line 685, in forward
output = self.forward_comfy_cast_weights(input)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\ComfyUI\comfy\ops.py", line 657, in forward_comfy_cast_weights
weight, bias, offload_stream = cast_bias_weight(self, input, offloadable=True)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\ComfyUI\comfy\ops.py", line 119, in cast_bias_weight
weight = weight.dequantize()
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\comfy_kitchen\tensor\base.py", line 286, in dequantize
full = self.layout_cls.dequantize(qdata, self._params)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\comfy_kitchen\tensor\nvfp4.py", line 86, in dequantize
return ck.dequantize_nvfp4(qdata, params.scale, params.block_scale, params.orig_dtype)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\comfy_kitchen\__init__.py", line 125, in dequantize_nvfp4
return torch.ops.comfy_kitchen.dequantize_nvfp4(qx, per_tensor_scale, block_scales, dtype_code)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\_ops.py", line 1255, in __call__
return self._op(*args, **kwargs)
~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\_library\custom_ops.py", line 343, in backend_impl
result = self._backend_fns[device_type](*args, **kwargs)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\_compile.py", line 53, in inner
return disable_fn(*args, **kwargs)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\_dynamo\eval_frame.py", line 1044, in _fn
return fn(*args, **kwargs)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\_library\custom_ops.py", line 376, in wrapped_fn
return fn(*args, **kwargs)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\comfy_kitchen\backends\eager\quantization.py", line 328, in _op_dequantize_nvfp4
return impl(**kwargs)
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\comfy_kitchen\backends\eager\quantization.py", line 129, in dequantize_nvfp4
out = torch.nn.functional.embedding(out.int(), lut).squeeze(-1)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
File "C:\Users\crz\Downloads\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\functional.py", line 2542, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: index out of range in self```

### Actual Behavior

yes

### Steps to Reproduce

Run klein template in comfyui

### Debug Logs

```powershell
yes
```

### Other

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.