Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some little changes #74

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ enc_dec = PerformerEncDec(
dec_num_tokens = 20000,
dec_depth = 6,
dec_heads = 8,
dec_max_seq_len = TGT_SEQ_LEN,
dec_max_seq_len = TGT_SEQ_LEN
)

src = torch.randint(0, 20000, (1, SRC_SEQ_LEN))
Expand Down Expand Up @@ -124,7 +124,7 @@ from performer_pytorch import SelfAttention
attn = SelfAttention(
dim = 512,
heads = 8,
causal = False,
causal = False
).cuda()

x = torch.randn(1, 1024, 512).cuda()
Expand Down
3 changes: 1 addition & 2 deletions performer_pytorch/autoregressive_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ def top_k(logits, thres = 0.9):
return probs

class AutoregressiveWrapper(nn.Module):
def __init__(self, net, ignore_index = 0, pad_value = 0):
def __init__(self, net, ignore_index = 0):
super().__init__()
self.pad_value = pad_value
self.ignore_index = ignore_index

self.net = net
Expand Down
3 changes: 1 addition & 2 deletions performer_pytorch/performer_enc_dec.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def __init__(
self,
dim,
ignore_index = 0,
pad_value = 0,
tie_token_embeds = False,
no_projection = False,
**kwargs
Expand All @@ -65,7 +64,7 @@ def __init__(
enc.token_emb = dec.token_emb

self.enc = enc
self.dec = AutoregressiveWrapper(dec, ignore_index = ignore_index, pad_value = pad_value)
self.dec = AutoregressiveWrapper(dec, ignore_index = ignore_index)

@torch.no_grad()
def generate(self, seq_in, seq_out_start, seq_len, **kwargs):
Expand Down