demo code of training