Updated model_gen.py to be used in training.