Organize the training process of the open-source code into a single Python file for better comprehension.