def set_classy_state(self, state):
    'Set task state\n\n        Args:\n            state: Dict containing state of a task\n        '
    self.train = (False if self.test_only else state['train'])
    if (not self.test_only):
        self.phase_idx = state['phase_idx']
        self.num_updates = state['num_updates']
        self.train_phase_idx = state['train_phase_idx']
        self.losses = state['losses']
        for (meter, meter_state) in zip(self.meters, state['meters']):
            meter.set_classy_state(meter_state)
    self.base_model.set_classy_state(state['base_model'])
    if (self.optimizer is not None):
        self.optimizer.set_classy_state(state['optimizer'])
    if (state.get('loss') and isinstance(self.base_loss, ClassyLoss)):
        self.base_loss.set_classy_state(state['loss'])
    if ('amp' in state):
        if (self.amp_type == AmpType.APEX):
            apex.amp.load_state_dict(state['amp'])
        else:
            self.amp_grad_scaler.load_state_dict(state['amp'])
    for hook in self.hooks:
        if (hook.name() in state['hooks']):
            hook.set_classy_state(state['hooks'][hook.name()])
        else:
            logging.warning(f'No state found for hook: {hook.name()}')
    if (('train' in self.datasets) and self._is_checkpointable_dataset(self.datasets['train'])):
        self.datasets['train'].set_classy_state(state.get('train_dataset_iterator'))
Set task state

Args:
    state: Dict containing state of a task
def set_classy_state(self, state):
    'Set task state\n\n        Args:\n            state: Dict containing state of a task\n        '
    self.train = (False if self.test_only else state['train'])
    if (not self.test_only):
        self.phase_idx = state['phase_idx']
        self.num_updates = state['num_updates']
        self.train_phase_idx = state['train_phase_idx']
        self.losses = state['losses']
        for (meter, meter_state) in zip(self.meters, state['meters']):
            meter.set_classy_state(meter_state)
    self.base_model.set_classy_state(state['base_model'])
    if (self.optimizer is not None):
        self.optimizer.set_classy_state(state['optimizer'])
    if (state.get('loss') and isinstance(self.base_loss, ClassyLoss)):
        self.base_loss.set_classy_state(state['loss'])
    if ('amp' in state):
        if (self.amp_type == AmpType.APEX):
            apex.amp.load_state_dict(state['amp'])
        else:
            self.amp_grad_scaler.load_state_dict(state['amp'])
    for hook in self.hooks:
        if (hook.name() in state['hooks']):
            hook.set_classy_state(state['hooks'][hook.name()])
        else:
            logging.warning(f'No state found for hook: {hook.name()}')
    if (('train' in self.datasets) and self._is_checkpointable_dataset(self.datasets['train'])):
        self.datasets['train'].set_classy_state(state.get('train_dataset_iterator'))