save training data and train model in one step