https://github.com/deeppavlov/diff_beam_search
https://github.com/deeppavlov/diff_beam_search
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/deeppavlov/diff_beam_search
- Owner: deeppavlov
- Created: 2018-03-20T12:12:20.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-26T10:49:16.000Z (almost 8 years ago)
- Last Synced: 2025-10-13T02:43:06.210Z (10 months ago)
- Language: Python
- Size: 591 KB
- Stars: 5
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Support: support/res.png
Awesome Lists containing this project
README
Code for paper: XXX

## File Structure
* `nmt.py`: main file
* `vocab.py`: script used to generate `.bin` vocabulary file from parallel corpus
* `util.py`: script containing helper functions
## Usage
See ```EXAMPLE_SETUP.md```
* Pytorch **0.4** is used.
* Add expected_bleu module to PYTHONPATH
``` export PYTHONPATH="${PYTHONPATH}:////expected_bleu" ```
If you just want to include this loss into your MT - see expected_bleu directory. If you want to reproduce read on.
* (See NOTE below) Run the script (borrowed from [Harvard NLP repo](https://github.com/harvardnlp/BSO/tree/master/data_prep/MT)) to download and preprocess IWSLT'14 dataset:
```shell
$ cd preprocessing
$ source prepareData.sh
```
NOTE: this script requires Lua and luaTorch. As an alternative, you can download all necessary files(data directory) from [this repo](https://github.com/pcyin/pytorch_nmt/tree/master/data) or via this [link](https://minhaskamal.github.io/DownGit/#/home?url=https://github.com/pcyin/pytorch_nmt/tree/master/data)
* Generate Vocabulary Files
```
python vocab.py
```
Example:
```
python vocab.py --train_src data/train.de-en.de --train_tgt data/train.de-en.en --output data/vocab.bin
```
* Vanilla Maximum Likelihood Training
```
. scripts/run_mle.sh
```
* BLEU LB train
```
. scripts/run_custom_train
```
* REINFORCE train
```
. scripts/run_custom_train3
```
#### Training (one experiment)
```
bash scripts/run_mle.sh
bash scripts/run_custom_train.sh models/model_name
bash scripts/test_mle.sh
```
`````` equals to test or train (depends on what dataset you want to evaluate).
See result in logs directory.
For multi experiments testing see scripts:
```run_experiments.sh``` - script which will run run_all.sh script for all gpus you’ll write in (see file content).
```run_all.sh``` - script for training (uncomment/comment different phases of training)