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

TypeError: LTXVImgToVideo.generate() got an unexpected keyword argument 'strength'

Open CGMikeG opened this issue 6 months ago • 5 comments

TypeError: LTXVImgToVideo.generate() got an unexpected keyword argument 'strength'

VAE load device: cuda:0, offload device: cpu, dtype: torch.bfloat16 gguf qtypes: F32 (728), BF16 (7), Q4_K (336), Q6_K (144) model weight dtype torch.bfloat16, manual cast: None model_type FLUX CLIP/text encoder model load device: cuda:0, offload device: cpu, current: cpu, dtype: torch.float16 Requested to load MochiTEModel_ loaded completely 9822.8 9083.38671875 True Using preset: 13b Dynamic Skip steps sigma threshold: 0.997 Cfg star rescale: True Sigma list: [1.0, 0.9933, 0.985, 0.9767, 0.9008, 0.618] Cfg list: [1, 6, 8, 6, 1, 1] Stg scale list: [0, 4, 4, 4, 2, 1] Stg rescale list: [1, 0.5, 0.5, 1, 1, 1] Stg layers indices list: [[11, 25, 35, 39], [22, 35, 39], [28], [28], [28], [28]] optional_cond_images shape torch.Size([1, 512, 768, 3]) !!! Exception during processing !!! LTXVImgToVideo.generate() got an unexpected keyword argument 'strength' Traceback (most recent call last): File "F:\COMFY\ComfyUI_windows_portable\ComfyUI\execution.py", line 347, 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 "F:\COMFY\ComfyUI_windows_portable\ComfyUI\execution.py", line 222, 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 "F:\COMFY\ComfyUI_windows_portable\ComfyUI\execution.py", line 194, in _map_node_over_list process_inputs(input_dict, i) File "F:\COMFY\ComfyUI_windows_portable\ComfyUI\execution.py", line 183, in process_inputs results.append(getattr(obj, func)(**inputs)) File "F:\COMFY\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-LTXVideo\easy_samplers.py", line 127, in sample ) = LTXVImgToVideo().generate( TypeError: LTXVImgToVideo.generate() got an unexpected keyword argument 'strength'

Here is what VSCode copilot thinks Great question! You do have strength in your generate method for LTXVImgToVideoAdvanced, but the error is about the method you are calling inside it:

return nodes_lt.LTXVImgToVideo().generate( positive=positive, negative=negative, vae=vae, image=image, width=width, height=height, length=length, batch_size=batch_size, strength=strength, # <-- This is the problem )

Here, you are calling the generate method of LTXVImgToVideo from nodes_lt (not your own class), and that method does not accept a strength argument.

Why does this happen? Your own generate method accepts strength—that's fine. But you are passing strength to another class's generate method (LTXVImgToVideo in nodes_lt), and that method does not have strength in its parameters. How to fix? You need to add strength to the generate method of LTXVImgToVideo in the comfy_extras/nodes_lt.py file (or wherever it is defined), like this:

class LTXVImgToVideo: def generate( self, positive, negative, vae, image, width, height, length, batch_size, strength=None, # <-- Add this ): # ...existing code...

Or, if you don't want to use strength, you can just add it with a default value and ignore it.


Unfortunately, above solution didn't fix the issue. :(

CGMikeG avatar May 09 '25 15:05 CGMikeG

i had the same problem, i updated ComfyUI and this solved it

BenjaminKeating1986 avatar May 10 '25 08:05 BenjaminKeating1986

I think I can help. I'm no expert at coding (newbie), but I had the same problem and fixed it. the VSCode copilot was on the right track it just gave you too much to add. If you go to the comfy_extras/nodes_lt.py file and open it go to the function that it told you to go to. It is in the "class LTXVImgToVideo:" section. Look for this area...

CATEGORY = "conditioning/video_models" FUNCTION = "generate"

def generate(self, positive, negative, image, vae, width, height, length, batch_size, strength): #added "strength" to this array pixels = comfy.utils.common_upscale(image.movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) encode_pixels = pixels[:, :, :, :3] t = vae.encode(encode_pixels)

As you can see by my note on the first line of "def generate" I added "strength" to the end of the array. It probably should have been written like this but as I said, no expert. Adding that number to the array shouldn't effect anything in a negative way. It just allows it to except a number, it doesn't mean it has to use it.

I hope that makes some sort of sense and I hope it helps you out.

BarryHayden avatar May 10 '25 08:05 BarryHayden

I think I can help. I'm no expert at coding (newbie), but I had the same problem and fixed it. the VSCode copilot was on the right track it just gave you too much to add. If you go to the comfy_extras/nodes_lt.py file and open it go to the function that it told you to go to. It is in the "class LTXVImgToVideo:" section. Look for this area...

CATEGORY = "conditioning/video_models" FUNCTION = "generate"

def generate(self, positive, negative, image, vae, width, height, length, batch_size, strength): #added "strength" to this array pixels = comfy.utils.common_upscale(image.movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) encode_pixels = pixels[:, :, :, :3] t = vae.encode(encode_pixels)

As you can see by my note on the first line of "def generate" I added "strength" to the end of the array. It probably should have been written like this but as I said, no expert. Adding that number to the array shouldn't effect anything in a negative way. It just allows it to except a number, it doesn't mean it has to use it.

I hope that makes some sort of sense and I hope it helps you out.

This will fix the error but your model output will likely be broken. It's better to update comfyui, that's where the outdated ltx node definition lies.

CorentinJ avatar May 12 '25 22:05 CorentinJ

i had the same problem, i updated ComfyUI and this solved it

I am getting this error when updating to v0.3.34

F:\COMFY\ComfyUI_windows_portable\ComfyUI>git checkout v0.3.34 error: Your local changes to the following files would be overwritten by checkout: comfy/model_detection.py comfy_extras/nodes_lt.py Please commit your changes or stash them before you switch branches. Aborting

I ended up updating the code manually and deleting and reinstalling comfyui ltxv. That seem to have fix the issue.

I will create a new ticket just to make sure admin commit to the changes

CGMikeG avatar May 13 '25 07:05 CGMikeG

This happens on the LTXVImgToVideoAdvanced node for me. I've updated everything and the issue is still there. I'm using the example workflow: ltxv-13b-i2v-mixed-multiscale

# ComfyUI Error Report
## Error Details
- **Node ID:** 1920
- **Node Type:** LTXVImgToVideoAdvanced
- **Exception Type:** TypeError
- **Exception Message:** LTXVImgToVideo.generate() got an unexpected keyword argument 'strength'
## Stack Trace

> ```
>   File "D:\AITools\StabilityMatrixData\Packages\ComfyUI\execution.py", line 349, 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 "D:\AITools\StabilityMatrixData\Packages\ComfyUI\execution.py", line 224, 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 "D:\AITools\StabilityMatrixData\Packages\ComfyUI\custom_nodes\comfyui-0246\utils.py", line 353, in new_func
>     res_value = old_func(*final_args, **kwargs)
> 
>   File "D:\AITools\StabilityMatrixData\Packages\ComfyUI\execution.py", line 196, in _map_node_over_list
>     process_inputs(input_dict, i)
> 
>   File "D:\AITools\StabilityMatrixData\Packages\ComfyUI\execution.py", line 185, in process_inputs
>     results.append(getattr(obj, func)(**inputs))
> 
>   File "D:\AITools\StabilityMatrixData\Packages\ComfyUI\custom_nodes\ComfyUI-LTXVideo\guide.py", line 244, in generate
>     return nodes_lt.LTXVImgToVideo().generate(
> 
> ```

## System Information
- **ComfyUI Version:** 0.3.34
- **Arguments:** D:\AITools\StabilityMatrixData\Packages\ComfyUI\main.py --reserve-vram 0.9 --preview-method auto --use-quad-cross-attention
- **OS:** nt
- **Python Version:** 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
- **Embedded Python:** false
- **PyTorch Version:** 2.7.0+cu128
## Devices

- **Name:** cuda:0 NVIDIA GeForce RTX 3090 : cudaMallocAsync
  - **Type:** cuda

phazei avatar May 17 '25 21:05 phazei