Skip to content

Commit

Permalink
modify comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hyunwoongko committed Dec 18, 2019
1 parent ad2b684 commit b6c7b0f
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
data/
venv/
.data/
saved/
7 changes: 4 additions & 3 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified __pycache__/train.cpython-36.pyc
Binary file not shown.
1 change: 0 additions & 1 deletion models/layers/multi_head_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def forward(self, q, k, v, mask=None):
q, k, v = self.project(q), self.project(k), self.project(v)

# 3, do scale dot product to compute similarity

out, attention = self.attention(q, k, v, mask=mask)
out = self.concat(out)

Expand Down
Binary file modified models/model/__pycache__/decoder.cpython-36.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions models/model/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ def __init__(self, dec_voc_size, max_len, d_model, ffn_hidden, n_head, n_layers,
drop_prob=drop_prob)
for _ in range(n_layers)])

self.fc_out = nn.Linear(d_model, dec_voc_size)
self.linear = nn.Linear(d_model, dec_voc_size)

def forward(self, trg, enc_src, trg_mask, src_mask):
trg = self.emb(trg)

for layer in self.layers:
trg = layer(trg, enc_src, trg_mask, src_mask)

output = self.fc_out(trg)
output = self.linear(trg)

return output
5 changes: 5 additions & 0 deletions saved/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""
@author : Hyunwoong
@when : 2019-12-18
@homepage : https://github.com/gusdnd852
"""
2 changes: 1 addition & 1 deletion train.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def run(total_epoch, best_loss):

if valid_loss < best_loss:
best_loss = valid_loss
torch.save(model.state_dict(), 'model-{0}.pt'.format(valid_loss))
torch.save(model.state_dict(), 'saved/model-{0}.pt'.format(valid_loss))

print(f'Epoch: {step + 1} | Time: {epoch_mins}m {epoch_secs}s')
print(f'\tTrain Loss: {train_loss:.3f} | Train PPL: {math.exp(train_loss):7.3f}')
Expand Down

0 comments on commit b6c7b0f

Please sign in to comment.