From 7d6a98bc626c56b3eb4c07eff5d7aeaf8f781c1d Mon Sep 17 00:00:00 2001 From: li-lizhe <147392333@qq.com> Date: Sat, 12 Sep 2026 09:08:48 +0800 Subject: [PATCH] fix(framepack): use text_mask.device instead of hardcoded cuda get_cu_seqlens creates a cu_seqlens tensor with device="cuda", which crashes on non-CUDA devices (e.g. Ascend NPU raises "Torch not compiled with CUDA enabled"). Create it on the same device as the input text_mask instead, which is device-agnostic. --- modules/framepack/pipeline/hunyuan_video_packed.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/framepack/pipeline/hunyuan_video_packed.py b/modules/framepack/pipeline/hunyuan_video_packed.py index a5f171b5c..58ae8918a 100644 --- a/modules/framepack/pipeline/hunyuan_video_packed.py +++ b/modules/framepack/pipeline/hunyuan_video_packed.py @@ -74,7 +74,7 @@ def get_cu_seqlens(text_mask, img_len): text_len = text_mask.sum(dim=1) max_len = text_mask.shape[1] + img_len - cu_seqlens = torch.zeros([2 * batch_size + 1], dtype=torch.int32, device="cuda") + cu_seqlens = torch.zeros([2 * batch_size + 1], dtype=torch.int32, device=text_mask.device) for i in range(batch_size): s = text_len[i] + img_len