EECE 7398 Homework 3: Neural Machine Translation (NMT) solution


Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment


5/5 - (6 votes)

In this homework you will practice how to implement neural machine translation (NMT) using
Recurrent Neural Network (RNN). You can choose either Long Short-Term Memory (LSTM) or
Gated Recurrent Units (GRU) to implement NMT. The goals of this homework are:
• To understand the steps to train/test the model for NMT.
• To understand and implement the RNN architecture.
The English-Czech, English-German, and English-Vietnamese datasets can be found at: under Preprocessed Data.
1. The neural machine translation file should contain three functions, train, test, and
translate. You can choose any one of the three datasets (English-Czech, English-German, and
English-Vietnamese), based on your interests and the data size.
*GPUs may be needed for speeding up the neural network training process in this
homework. If you don’t have a valid GPU, you are suggested to use English-Vietnamese
dataset, which is smaller and can save some training time.
2. The train function would train the network with the command “python train”.
Display the training loss in each iteration of training function. Save the model in a folder named
“model” after finishing the training process.
Fig. 1 The screenshot of the train function (English-to-Vietnamese).
EECE 7398 HW 3
Spring 2021 ST: Advances in Deep Learning Due 04/20/2021

Fig. 2 The screenshot of the test function (English-to-Vietnamese).
3. The test function would test the model with the command “python test”, which will
(1) load the testing data and translate the sentences; and (2) calculate the BLEU score (referring
to with the smoothing method1.
Report the average BLEU score, which should be no less than 7% (0.07).
4. The translation function would accept the command “python translate”. Given a
sentence, the model should be able to translate it into the corresponding language.
Fig. 3 The screenshot of the translation function (English-to-Vietnamese).
• You need to submit a zip file including:
1. a python file named “”;
2. a generated model folder named “model”;
3. two screenshots of the train and test functions.
• The “” file should be able to run with the following commands:
python train
python test
python translate
• The zip file should be named using the following convention:
Don’t put any print function other than showing the results.
EECE 7398 HW 3
Spring 2021 ST: Advances in Deep Learning Due 04/20/2021
Comment your code.
Grading criteria:
• The two screenshots of the train and test functions will be checked, and the translate
function will be tested by typing a sentence.
• The testing accuracy (BLEU score) should be greater than or equal to 7% (0.07) in the end.
There will be 1-point deduction for every 0.1% of accuracy degradation based on 7%.
• Upload the zip file to Canvas before 11:59PM (EST Time) 04/20/2021.
* Sample code can be found at: