Skip to content

Commit 5b60e2d

Browse files
committed
remove normal head scale from cosine sim attention
1 parent 37eb3ea commit 5b60e2d

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

memory_efficient_attention_pytorch/memory_efficient_cosine_sim_attention.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ def attention(
2727
attn_bias = None,
2828
**kwargs
2929
):
30-
scale = q.shape[-1] ** -0.5
31-
q = q * scale
32-
3330
sim = einsum('b h i d, b h j d -> b h i j', q, k)
3431

3532
if exists(attn_bias):
@@ -84,9 +81,6 @@ def numerically_unstable_memory_efficient_attention(
8481
k_bucket_size = 1024,
8582
eps = 1e-8
8683
):
87-
scale = q.shape[-1] ** -0.5
88-
q = q * scale
89-
9084
# chunk all the inputs
9185

9286
q_chunks = q.split(q_bucket_size, dim = -2)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
setup(
44
name = 'memory-efficient-attention-pytorch',
55
packages = find_packages(exclude=[]),
6-
version = '0.0.8',
6+
version = '0.0.9',
77
license='MIT',
88
description = 'Memory Efficient Attention - Pytorch',
99
author = 'Phil Wang',

0 commit comments

Comments
 (0)