Refactor train.py to improve code readability and organization. Adjust logging setup for clarity, streamline dependency installation commands, and enhance dataset splitting and formatting processes. Ensure consistent formatting in log messages and code structure.