Skip to content

Commit

Permalink
[onmt] Update README with models; move data to AWS
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlerer authored and soumith committed Feb 23, 2017
1 parent 6be19f9 commit c84f7df
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 62,949 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dcgan/data
data
*.pyc
OpenNMT/data
11 changes: 11 additions & 0 deletions OpenNMT/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ an open-source (MIT) neural machine translation system.

OpenNMT consists of three commands:

0) Download the data.

```wget https://s3.amazonaws.com/pytorch/examples/opennmt/data/onmt-data.tar && tar -xf onmt-data.tar```

1) Preprocess the data.

```python preprocess.py -train_src data/src-train.txt -train_tgt data/tgt-train.txt -valid_src data/src-val.txt -valid_tgt data/tgt-val.txt -save_data data/demo```
Expand All @@ -22,6 +26,13 @@ OpenNMT consists of three commands:

```python translate.py -cuda -model model_e13_*.pt -src data/src-test.txt -tgt data/tgt-test.txt -replace_unk -verbose```

## Pretrained Models

The following pretrained models can be downloaded and used with translate.py.

- [onmt_model_en_de_200k](https://s3.amazonaws.com/pytorch/examples/opennmt/models/onmt_model_en_de_200k-4783d9c3.pt): An English-German translation model based on the 200k sentence dataset at [OpenNMT/IntegrationTesting](https://github.com/OpenNMT/IntegrationTesting/tree/master/data). Perplexity: 21.
- [onmt_model_en_fr_b1M](https://s3.amazonaws.com/pytorch/examples/opennmt/models/onmt_model_en_fr_b1M-261c69a7.pt): An English-French model trained on benchmark-1M. Perplexity: 4.85.

## Release Notes

The following OpenNMT features are implemented:
Expand Down
2,737 changes: 0 additions & 2,737 deletions OpenNMT/data/src-test-case.txt

This file was deleted.

2,737 changes: 0 additions & 2,737 deletions OpenNMT/data/src-test.txt

This file was deleted.

10,000 changes: 0 additions & 10,000 deletions OpenNMT/data/src-train-case.txt

This file was deleted.

10,000 changes: 0 additions & 10,000 deletions OpenNMT/data/src-train.txt

This file was deleted.

3,000 changes: 0 additions & 3,000 deletions OpenNMT/data/src-val-case.txt

This file was deleted.

3,000 changes: 0 additions & 3,000 deletions OpenNMT/data/src-val.txt

This file was deleted.

2,737 changes: 0 additions & 2,737 deletions OpenNMT/data/tgt-test-case.txt

This file was deleted.

2,737 changes: 0 additions & 2,737 deletions OpenNMT/data/tgt-test.txt

This file was deleted.

10,000 changes: 0 additions & 10,000 deletions OpenNMT/data/tgt-train-case.txt

This file was deleted.

10,000 changes: 0 additions & 10,000 deletions OpenNMT/data/tgt-train.txt

This file was deleted.

3,000 changes: 0 additions & 3,000 deletions OpenNMT/data/tgt-val-case.txt

This file was deleted.

3,000 changes: 0 additions & 3,000 deletions OpenNMT/data/tgt-val.txt

This file was deleted.

3 changes: 2 additions & 1 deletion OpenNMT/onmt/modules/GlobalAttention.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import torch.nn as nn
import math

_INF = float('inf')

class GlobalAttention(nn.Module):
def __init__(self, dim):
Expand All @@ -47,7 +48,7 @@ def forward(self, input, context):
# Get attention
attn = torch.bmm(context, targetT).squeeze(2) # batch x sourceL
if self.mask is not None:
attn.data.masked_fill_(self.mask, -math.inf)
attn.data.masked_fill_(self.mask, -_INF)
attn = self.sm(attn)
attn3 = attn.view(attn.size(0), 1, attn.size(1)) # batch x 1 x sourceL

Expand Down

0 comments on commit c84f7df

Please sign in to comment.