def save(self, model_file: Union[(str, Path)], checkpoint: bool=False):
    '\n        Saves the current model to the provided file.\n        :param model_file: the model file\n        '
    model_state = self._get_state_dict()
    optimizer = scheduler = None
    if hasattr(self, 'model_card'):
        if ('training_parameters' in self.model_card):
            training_parameters = self.model_card['training_parameters']
            if ('optimizer' in training_parameters):
                optimizer = training_parameters['optimizer']
                if checkpoint:
                    training_parameters['optimizer_state_dict'] = optimizer.state_dict()
                training_parameters['optimizer'] = optimizer.__class__
            if ('scheduler' in training_parameters):
                scheduler = training_parameters['scheduler']
                if checkpoint:
                    with warnings.catch_warnings():
                        warnings.simplefilter('ignore')
                        training_parameters['scheduler_state_dict'] = scheduler.state_dict()
                training_parameters['scheduler'] = scheduler.__class__
        model_state['model_card'] = self.model_card
    torch.save(model_state, str(model_file), pickle_protocol=4)
    if optimizer:
        self.model_card['training_parameters']['optimizer'] = optimizer
    if scheduler:
        self.model_card['training_parameters']['scheduler'] = scheduler
Saves the current model to the provided file.
:param model_file: the model file
def save(self, model_file: Union[(str, Path)], checkpoint: bool=False):
    '\n        Saves the current model to the provided file.\n        :param model_file: the model file\n        '
    model_state = self._get_state_dict()
    optimizer = scheduler = None
    if hasattr(self, 'model_card'):
        if ('training_parameters' in self.model_card):
            training_parameters = self.model_card['training_parameters']
            if ('optimizer' in training_parameters):
                optimizer = training_parameters['optimizer']
                if checkpoint:
                    training_parameters['optimizer_state_dict'] = optimizer.state_dict()
                training_parameters['optimizer'] = optimizer.__class__
            if ('scheduler' in training_parameters):
                scheduler = training_parameters['scheduler']
                if checkpoint:
                    with warnings.catch_warnings():
                        warnings.simplefilter('ignore')
                        training_parameters['scheduler_state_dict'] = scheduler.state_dict()
                training_parameters['scheduler'] = scheduler.__class__
        model_state['model_card'] = self.model_card
    torch.save(model_state, str(model_file), pickle_protocol=4)
    if optimizer:
        self.model_card['training_parameters']['optimizer'] = optimizer
    if scheduler:
        self.model_card['training_parameters']['scheduler'] = scheduler