validate model during training.