Add print statements
Browse files
visual.py
CHANGED
@@ -37,11 +37,9 @@ class Attention(nn.Module):
|
|
37 |
qkv = qkv.reshape(B, L, 3, self.num_heads, -1).permute(2, 0, 1, 3, 4) # 3, B, L, H, D
|
38 |
q, k, v = qkv[0], qkv[1], qkv[2]
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
out = self.attention(q, k, v)
|
45 |
|
46 |
output = self.dense(out.view(B, L, -1))
|
47 |
output = self.output_dropout(output)
|
|
|
37 |
qkv = qkv.reshape(B, L, 3, self.num_heads, -1).permute(2, 0, 1, 3, 4) # 3, B, L, H, D
|
38 |
q, k, v = qkv[0], qkv[1], qkv[2]
|
39 |
|
40 |
+
out = xops.memory_efficient_attention(
|
41 |
+
q, k, v, scale=self.scale,
|
42 |
+
)
|
|
|
|
|
43 |
|
44 |
output = self.dense(out.view(B, L, -1))
|
45 |
output = self.output_dropout(output)
|