The research project was associated with "[INF-DSAM1B] Advanced Machine Learning B: Deep Learning for NLP", Summer Semester 2021, for my Masters of Science: Data Science, University of Potsdam, Germany.
You can find the Technical Report on ResearchGate.
Pytroch version : 1.7.1+cu101
torchtext version: 0.8.0
spacy version: 3.1.1
-
Create an environment
conda create -n pytorch python=3.7
-
Activate the environment
conda activate pytorch
-
Install jupyter
conda install -c anaconda jupyter
-
Install the ipykernel
pip install ipykernel
-
Register your environment
python -m ipykernel install --user --name pytorch --display-name "pytorch"
-
Install pytorch
GPU Version:conda install pytorch cudatoolkit -c pytorch
CPU Version:conda install pytorch cpuonly -c pytorch
Model was trained for 20 Epochs and achieved a BLEU score of 25.37 (with model size of roughly 510 mb).
Different version of pytorch, torchtext and spacy might cause the program to break.
The structure of the files should looks like this:
.
├── Data
│ ├── # initialy this would be empty.
│ └── # initialy this would be empty.
├── config.yml
├── data_utils.py
├── download_data.py
├── mymodel.py
├── README.txt
└── run.py
Make sure to have an empty folder, "Data"
The files can be run from cmd prompt, using the the following cmd lines:
- cd to "/Machine_translation_with_attention_DL4NLP". Then run the below code line in cmd.
- To train and validate the model, type:
python run.py --RUN_MODE train_val
- To evaluate the loss on test data, type:
python run.py --RUN_MODE test --MODEL _number_
(_number_
is the model number until which you trained your model) - To calculate the BLEU score, type:
python run.py --RUN_MODE bleu --MODEL _number_
(_number_
is the model number until which you trained your model)