prajdabre / yanmtt

Yet Another Neural Machine Translation Toolkit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

  1. Identify the common code and move it under functions with appropriate arguments. These functions can go under common_utils.py
  2. Restructure the code so that the code becomes more modular.
  3. 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.