Skip to content

Conversation

@TheephopWS
Copy link

Summary

Fixes TypeError: can't convert cuda:0 device type tensor to numpy when using SaveVideo with LTX-2 audio generation on AMD hardware.

This change resolves issue #11785 for AMD GPU users experiencing crashes during video generation.

Problem

In comfy_api/latest/_input_impl/video_types.py, the audio tensor generated by LTXVAudioVAEDecode remains on the GPU device. The code attempts to call .numpy() directly on this CUDA tensor. While NVIDIA drivers often handle this implicitly or differently in some contexts, PyTorch explicitly throws an error on AMD ROCm (and strict CUDA environments) requiring tensors to be on the host memory first.

This crashes the workflow with:
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

Fix

Added .cpu() before .numpy() in the tensor conversion chain.
Changed .float().numpy() to .float().cpu().numpy().

@rattus128 rattus128 added the AMD Issue related to AMD driver support. label Jan 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AMD Issue related to AMD driver support.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants