def set_model_mode(self, name, mode):
        """Sets the `train/val` mode for a particular model."""
        if isinstance(mode, str):
            mode = mode.lower()
        if mode == 'train' or mode is True:
            self.models[name].train()
        elif mode in ['val', 'test', 'eval'] or mode is False:
            self.models[name].eval()
        else:
            raise ValueError(f'Invalid model mode `{mode}`!')
Sets the `train/val` mode for a particular model.
runners/base_runner.py