Cleaning the code for calling the model and computing loss
prajdabre opened this issue · comments
The 2 core files pretrain_nmt.py, train_nmt.py contain a lot of repeated monolithic code. For example, the loss computation part of the code is mostly repeated.
Desired cleanup:
- Identify the common code and move it under functions with appropriate arguments. These functions can go under common_utils.py
- Restructure the code so that the code becomes more modular.
- Document all the functions so that users have an easier time following it.
Bonus meme: Clean up the if-else structures to make them look better if possible.