finish the whole training process