From 5a58cd945aa801fb25629386387db11ad66a4db5 Mon Sep 17 00:00:00 2001 From: Alexia Jolicoeur-Martineau Date: Tue, 2 Dec 2025 10:11:11 -0500 Subject: [PATCH] some people get errors with view instead of reshape --- models/layers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/layers.py b/models/layers.py index 5d5264b..705bcaf 100644 --- a/models/layers.py +++ b/models/layers.py @@ -131,7 +131,7 @@ class Attention(nn.Module): query, key, value = map(lambda t: einops.rearrange(t, 'B S H D -> B H S D'), (query, key, value)) # needed for scaled_dot_product_attention but not flash_attn_func attn_output = scaled_dot_product_attention(query=query, key=key, value=value, is_causal=self.causal) attn_output = einops.rearrange(attn_output, 'B H S D -> B S H D') - attn_output = attn_output.view(batch_size, seq_len, self.output_size) # type: ignore + attn_output = attn_output.reshape(batch_size, seq_len, self.output_size) # type: ignore return self.o_proj(attn_output) class LinearSwish(nn.Module):