From 0ee1d19e2ce25977170c5292f936087d66d7cb7f Mon Sep 17 00:00:00 2001 From: Andrew White Date: Mon, 27 Jul 2026 07:34:17 -0500 Subject: [PATCH] fix: invalid dtype torch.torch.int32 causes AttributeError --- core/transformer/attention.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/transformer/attention.py b/core/transformer/attention.py index a68450e..f8e4474 100644 --- a/core/transformer/attention.py +++ b/core/transformer/attention.py @@ -29,7 +29,7 @@ def unpad_input(hidden_states, attention_mask): seqlens_in_batch = attention_mask.sum(dim=-1, dtype=torch.int32) indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten() max_seqlen_in_batch = seqlens_in_batch.max().item() - cu_seqlens = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.torch.int32), (1, 0)) + cu_seqlens = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.int32), (1, 0)) # TD [2022-03-04] We don't want to index with a bool mask, because Pytorch will expand the # bool mask, then call nonzero to get the indices, then index with those. The indices is @dim # times larger than it needs to be, wasting memory. It's faster and more memory-efficient to