Skip to content

cannot access local variable 'self_attn_func' where it is not associated with a value #17

@mtrtet1

Description

@mtrtet1

ComfyUI Error Report

Error Details

  • Node ID: 1878
  • Node Type: LTXQ8Patch
  • Exception Type: UnboundLocalError
  • Exception Message: cannot access local variable 'self_attn_func' where it is not associated with a value

Stack Trace

  File "E:\workspace\ComfyUI\execution.py", line 361, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "E:\workspace\ComfyUI\execution.py", line 236, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "E:\workspace\ComfyUI\execution.py", line 208, in _map_node_over_list
    process_inputs(input_dict, i)

  File "E:\workspace\ComfyUI\execution.py", line 197, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "E:\workspace\ComfyUI\custom_nodes\ComfyUI-LTXVideo\q8_nodes.py", line 62, in patch
    patcher(transformer, use_fp8_attention, True)

  File "E:\workspace\ComfyUI\venv312\Lib\site-packages\q8_kernels\integration\patch_transformer.py", line 26, in patch_comfyui_native_transformer
    attn_forward = cross_attn_forward(use_fp8_attention)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "E:\workspace\ComfyUI\venv312\Lib\site-packages\q8_kernels\integration\comfyui_native.py", line 66, in cross_attn_forward
    self_attn, cross_attn, is_out_tuple = get_attention_func(use_fp8_attention)
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "E:\workspace\ComfyUI\venv312\Lib\site-packages\q8_kernels\integration\utils.py", line 104, in get_attention_func
    (self_attn_func, self_attn_memory_layout),
     ^^^^^^^^^^^^^^

System Information

  • ComfyUI Version: 0.3.41
  • Arguments: main.py
  • OS: nt
  • Python Version: 3.12.0 (tags/v3.12.0:0fb18b0, Oct 2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)]
  • Embedded Python: false
  • PyTorch Version: 2.7.1+cu128

Devices

  • Name: cuda:0 NVIDIA GeForce RTX 3060 Laptop GPU : cudaMallocAsync
    • Type: cuda
    • VRAM Total: 6441926656
    • VRAM Free: 5370806272
    • Torch VRAM Total: 0
    • Torch VRAM Free: 0

Logs

2025-06-28T17:50:01.912219 - [START] Security scan2025-06-28T17:50:01.912219 - 
2025-06-28T17:50:02.883446 - [DONE] Security scan2025-06-28T17:50:02.883446 - 
2025-06-28T17:50:03.012652 - ## ComfyUI-Manager: installing dependencies done.2025-06-28T17:50:03.012652 - 
2025-06-28T17:50:03.012652 - ** ComfyUI startup time:2025-06-28T17:50:03.012652 -  2025-06-28T17:50:03.012652 - 2025-06-28 17:50:03.0122025-06-28T17:50:03.012652 - 
2025-06-28T17:50:03.012652 - ** Platform:2025-06-28T17:50:03.012652 -  2025-06-28T17:50:03.012652 - Windows2025-06-28T17:50:03.012652 - 
2025-06-28T17:50:03.012652 - ** Python version:2025-06-28T17:50:03.012652 -  2025-06-28T17:50:03.012652 - 3.12.0 (tags/v3.12.0:0fb18b0, Oct  2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)]2025-06-28T17:50:03.012652 - 
2025-06-28T17:50:03.012652 - ** Python executable:2025-06-28T17:50:03.012652 -  2025-06-28T17:50:03.012652 - E:\workspace\ComfyUI\venv312\Scripts\python.exe2025-06-28T17:50:03.012652 - 
2025-06-28T17:50:03.012652 - ** ComfyUI Path:2025-06-28T17:50:03.012652 -  2025-06-28T17:50:03.012652 - E:\workspace\ComfyUI2025-06-28T17:50:03.012652 - 
2025-06-28T17:50:03.012652 - ** ComfyUI Base Folder Path:2025-06-28T17:50:03.012652 -  2025-06-28T17:50:03.012652 - E:\workspace\ComfyUI2025-06-28T17:50:03.012652 - 
2025-06-28T17:50:03.012652 - ** User directory:2025-06-28T17:50:03.012652 -  2025-06-28T17:50:03.012652 - E:\workspace\ComfyUI\user2025-06-28T17:50:03.012652 - 
2025-06-28T17:50:03.012652 - ** ComfyUI-Manager config path:2025-06-28T17:50:03.012652 -  2025-06-28T17:50:03.012652 - E:\workspace\ComfyUI\user\default\ComfyUI-Manager\config.ini2025-06-28T17:50:03.012652 - 
2025-06-28T17:50:03.012652 - ** Log path:2025-06-28T17:50:03.012652 -  2025-06-28T17:50:03.012652 - E:\workspace\ComfyUI\user\comfyui.log2025-06-28T17:50:03.012652 - 
2025-06-28T17:50:03.870064 - 
Prestartup times for custom nodes:
2025-06-28T17:50:03.870991 -    2.6 seconds: E:\workspace\ComfyUI\custom_nodes\comfyui-manager
2025-06-28T17:50:03.870991 - 
2025-06-28T17:50:07.255486 - Checkpoint files will always be loaded safely.
2025-06-28T17:50:07.444962 - Total VRAM 6144 MB, total RAM 40661 MB
2025-06-28T17:50:07.445956 - pytorch version: 2.7.1+cu128
2025-06-28T17:50:07.446972 - Set vram state to: NORMAL_VRAM
2025-06-28T17:50:07.446972 - Device: cuda:0 NVIDIA GeForce RTX 3060 Laptop GPU : cudaMallocAsync
2025-06-28T17:50:09.677661 - Using pytorch attention
2025-06-28T17:50:12.437108 - Python version: 3.12.0 (tags/v3.12.0:0fb18b0, Oct  2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)]
2025-06-28T17:50:12.437108 - ComfyUI version: 0.3.41
2025-06-28T17:50:12.467140 - ComfyUI frontend version: 1.22.2
2025-06-28T17:50:12.469021 - [Prompt Server] web root: E:\workspace\ComfyUI\venv312\Lib\site-packages\comfyui_frontend_package\static
2025-06-28T17:50:14.832646 - ### Loading: ComfyUI-Manager (V3.33.1)
2025-06-28T17:50:14.836151 - [ComfyUI-Manager] network_mode: public
2025-06-28T17:50:15.045695 - ### ComfyUI Version: v0.3.41-11-g78f79266 | Released on '2025-06-22'
2025-06-28T17:50:15.388135 - [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json
2025-06-28T17:50:15.392901 - [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json
2025-06-28T17:50:15.420693 - [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/github-stats.json
2025-06-28T17:50:15.480539 - [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json
2025-06-28T17:50:15.523083 - [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json
2025-06-28T17:50:15.547556 - 
Import times for custom nodes:
2025-06-28T17:50:15.547556 -    0.0 seconds: E:\workspace\ComfyUI\custom_nodes\websocket_image_save.py
2025-06-28T17:50:15.547556 -    0.1 seconds: E:\workspace\ComfyUI\custom_nodes\comfyui-kjnodes
2025-06-28T17:50:15.548555 -    0.2 seconds: E:\workspace\ComfyUI\custom_nodes\comfyui-videohelpersuite
2025-06-28T17:50:15.548555 -    0.5 seconds: E:\workspace\ComfyUI\custom_nodes\comfyui-manager
2025-06-28T17:50:15.548555 -    1.1 seconds: E:\workspace\ComfyUI\custom_nodes\ComfyUI-LTXVideo
2025-06-28T17:50:15.548555 - 
2025-06-28T17:50:16.213298 - Context impl SQLiteImpl.
2025-06-28T17:50:16.213298 - Will assume non-transactional DDL.
2025-06-28T17:50:16.217957 - No target revision found.
2025-06-28T17:50:16.231345 - Starting server

2025-06-28T17:50:16.232066 - To see the GUI go to: http://127.0.0.1:8188
2025-06-28T17:50:19.351277 - FETCH ComfyRegistry Data: 5/902025-06-28T17:50:19.351277 - 
2025-06-28T17:50:22.550537 - got prompt
2025-06-28T17:50:22.554595 - Failed to validate prompt for output 1599:
2025-06-28T17:50:22.554595 - * LTXVLatentUpsamplerModelLoader 1828:
2025-06-28T17:50:22.554595 -   - Value not in list: upscale_model: 'ltxv-spatial-upscaler-0.9.7.safetensors' not in []
2025-06-28T17:50:22.554595 - Output will be ignored
2025-06-28T17:50:22.966698 - model weight dtype torch.float8_e4m3fn, manual cast: torch.bfloat16
2025-06-28T17:50:22.972270 - model_type FLUX
2025-06-28T17:50:23.353566 - FETCH ComfyRegistry Data: 10/902025-06-28T17:50:23.353566 - 
2025-06-28T17:50:41.242488 - FETCH ComfyRegistry Data: 15/902025-06-28T17:50:41.243488 - 
2025-06-28T17:50:45.221827 - FETCH ComfyRegistry Data: 20/902025-06-28T17:50:45.222823 - 
2025-06-28T17:50:47.571666 - VAE load device: cuda:0, offload device: cpu, dtype: torch.bfloat16
2025-06-28T17:50:47.571666 - no CLIP/text encoder weights in checkpoint, the text encoder model will not be loaded.
2025-06-28T17:50:49.441109 - FETCH ComfyRegistry Data: 25/902025-06-28T17:50:49.441109 - 
2025-06-28T17:50:50.482613 - !!! Exception during processing !!! cannot access local variable 'self_attn_func' where it is not associated with a value
2025-06-28T17:50:50.483500 - Traceback (most recent call last):
  File "E:\workspace\ComfyUI\execution.py", line 361, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\workspace\ComfyUI\execution.py", line 236, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\workspace\ComfyUI\execution.py", line 208, in _map_node_over_list
    process_inputs(input_dict, i)
  File "E:\workspace\ComfyUI\execution.py", line 197, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\workspace\ComfyUI\custom_nodes\ComfyUI-LTXVideo\q8_nodes.py", line 62, in patch
    patcher(transformer, use_fp8_attention, True)
  File "E:\workspace\ComfyUI\venv312\Lib\site-packages\q8_kernels\integration\patch_transformer.py", line 26, in patch_comfyui_native_transformer
    attn_forward = cross_attn_forward(use_fp8_attention)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\workspace\ComfyUI\venv312\Lib\site-packages\q8_kernels\integration\comfyui_native.py", line 66, in cross_attn_forward
    self_attn, cross_attn, is_out_tuple = get_attention_func(use_fp8_attention)
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\workspace\ComfyUI\venv312\Lib\site-packages\q8_kernels\integration\utils.py", line 104, in get_attention_func
    (self_attn_func, self_attn_memory_layout),
     ^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'self_attn_func' where it is not associated with a value

2025-06-28T17:50:50.490424 - Prompt executed in 27.93 seconds
2025-06-28T17:50:53.981873 - FETCH ComfyRegistry Data: 30/902025-06-28T17:50:53.981873 - 
2025-06-28T17:51:01.741481 - FETCH ComfyRegistry Data: 35/902025-06-28T17:51:01.741481 - 
2025-06-28T17:51:05.538151 - FETCH ComfyRegistry Data: 40/902025-06-28T17:51:05.538151 - 
2025-06-28T17:51:09.085383 - got prompt
2025-06-28T17:51:09.090509 - Failed to validate prompt for output 1599:
2025-06-28T17:51:09.090509 - * LTXVLatentUpsamplerModelLoader 1828:
2025-06-28T17:51:09.090509 -   - Value not in list: upscale_model: 'ltxv-spatial-upscaler-0.9.7.safetensors' not in []
2025-06-28T17:51:09.090509 - Output will be ignored
2025-06-28T17:51:09.105726 - !!! Exception during processing !!! LTXV Q8 Patcher is not applied to the model. Please use LTXQ8Patch node before loading lora or install q8_kernels.
2025-06-28T17:51:09.106709 - Traceback (most recent call last):
  File "E:\workspace\ComfyUI\execution.py", line 361, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\workspace\ComfyUI\execution.py", line 236, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\workspace\ComfyUI\execution.py", line 208, in _map_node_over_list
    process_inputs(input_dict, i)
  File "E:\workspace\ComfyUI\execution.py", line 197, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\workspace\ComfyUI\custom_nodes\ComfyUI-LTXVideo\q8_nodes.py", line 135, in load_lora_model_only
    return (self.load_lora(model, lora_name, strength_model),)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\workspace\ComfyUI\custom_nodes\ComfyUI-LTXVideo\q8_nodes.py", line 99, in load_lora
    raise ValueError(
ValueError: LTXV Q8 Patcher is not applied to the model. Please use LTXQ8Patch node before loading lora or install q8_kernels.

2025-06-28T17:51:09.107717 - Prompt executed in 0.01 seconds
2025-06-28T17:51:10.931418 - FETCH ComfyRegistry Data: 45/902025-06-28T17:51:10.931418 - 
2025-06-28T17:51:14.971682 - FETCH ComfyRegistry Data: 50/902025-06-28T17:51:14.972749 - 
2025-06-28T17:51:46.809446 - FETCH ComfyRegistry Data: 55/902025-06-28T17:51:46.809446 - 
2025-06-28T17:52:07.621921 - got prompt
2025-06-28T17:52:07.621921 - Failed to validate prompt for output 1599:
2025-06-28T17:52:07.621921 - * LTXVLatentUpsamplerModelLoader 1828:
2025-06-28T17:52:07.621921 -   - Value not in list: upscale_model: 'ltxv-spatial-upscaler-0.9.7.safetensors' not in []
2025-06-28T17:52:07.621921 - Output will be ignored
2025-06-28T17:52:07.635691 - !!! Exception during processing !!! cannot access local variable 'self_attn_func' where it is not associated with a value
2025-06-28T17:52:07.643128 - Traceback (most recent call last):
  File "E:\workspace\ComfyUI\execution.py", line 361, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\workspace\ComfyUI\execution.py", line 236, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\workspace\ComfyUI\execution.py", line 208, in _map_node_over_list
    process_inputs(input_dict, i)
  File "E:\workspace\ComfyUI\execution.py", line 197, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\workspace\ComfyUI\custom_nodes\ComfyUI-LTXVideo\q8_nodes.py", line 62, in patch
    patcher(transformer, use_fp8_attention, True)
  File "E:\workspace\ComfyUI\venv312\Lib\site-packages\q8_kernels\integration\patch_transformer.py", line 26, in patch_comfyui_native_transformer
    attn_forward = cross_attn_forward(use_fp8_attention)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\workspace\ComfyUI\venv312\Lib\site-packages\q8_kernels\integration\comfyui_native.py", line 66, in cross_attn_forward
    self_attn, cross_attn, is_out_tuple = get_attention_func(use_fp8_attention)
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\workspace\ComfyUI\venv312\Lib\site-packages\q8_kernels\integration\utils.py", line 104, in get_attention_func
    (self_attn_func, self_attn_memory_layout),
     ^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'self_attn_func' where it is not associated with a value

2025-06-28T17:52:07.644191 - Prompt executed in 0.01 seconds

Attached Workflow

Please make sure that workflow does not contain any sensitive information such as API keys or passwords.

Workflow too large. Please manually upload the workflow from local file system.

Additional Context

(Please add any additional context or steps to reproduce the error here)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions