def save(self, path): """ Save model to path Args: path (str): path to save model weights """ topology = {k: v for k, v in self.__dict__.items()} topology.pop('model') topology.pop('use_cudnn') save_model(self.model, topology, path)
def save(self, filepath): """ Save the model to disk Args: filepath (str): file name to save model """ topology = {k: v for k, v in self.__dict__.items()} topology.pop('model') topology.pop('optimizer') topology.pop('use_cudnn') save_model(self.model, topology, filepath)
def save(self, path, exclude=None): """ Save model to path Args: path (str): path to save model exclude (list, optional): a list of object fields to exclude when saving """ assert self.model, 'Model was not initialized' topology = {k: v for k, v in self.__dict__.items()} topology.pop('model') if exclude and isinstance(exclude, list): for x in exclude: topology.pop(x) save_model(self.model, topology=topology, filepath=path)