mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user