Skip to content

Commit

Permalink
set new defaults by recommendation from @AranKomat
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Jun 7, 2020
1 parent e112b89 commit dc93c25
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ from product_key_memory import PKM

pkm = PKM(
dim = 512,
heads = 8,
num_keys = 512, # number of subkeys, # values will be num_keys ^ 2
topk = 10, # the top number of subkeys to select
heads = 4,
num_keys = 256, # number of subkeys, # values will be num_keys ^ 2
topk = 32, # the top number of subkeys to select
use_evonorm = True # usually PKM requires decent batch sizes with batchnorm to work well. this is an experimental feature using the new evonorm-s0 for batch-independent normalization
)

Expand Down
2 changes: 1 addition & 1 deletion product_key_memory/product_key_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def forward(self, x):
return x.reshape(*shape)

class PKM(nn.Module):
def __init__(self, dim, heads = 8, num_keys = 128, topk = 10, input_dropout = 0., query_dropout = 0., value_dropout = 0., use_evonorm = False):
def __init__(self, dim, heads = 4, num_keys = 256, topk = 32, input_dropout = 0., query_dropout = 0., value_dropout = 0., use_evonorm = False):
super().__init__()
assert (dim % heads == 0), 'dimension must be divisible by number of heads'
self.topk = topk
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name = 'product_key_memory',
packages = find_packages(),
version = '0.0.5',
version = '0.0.6',
license='MIT',
description = 'Product Key Memory',
author = 'Phil Wang',
Expand Down

0 comments on commit dc93c25

Please sign in to comment.