def save(self, fname, path, **kwargs):
        """
        Save model and optimizer state (if `with_opt`) to `self.path/file`
        """
        fname = join_path_file(fname, path, ext='.pth')        
        save_model(fname, self.model, getattr(self,'opt',None), **kwargs)
        return fname

        Save model and optimizer state (if `with_opt`) to `self.path/file`
        
PatchTST_self_supervised/src/learner.py