Solved by ptrblck in post #2 
              
              
                Your approach is fine, if you want to set the teacher_training argument independently. 
Alternatively, you could also use the internal self.training flag, which will be changed by calling model.train() or model.eval().