class_docstr: Base Class from Normalizing flows
  
  Args:
      model_config (BaseNFConfig): The configuration setting the main parameters of the
          model.
docstr: Method to save the model at a specific location. It saves, the model weights as a
  ``models.pt`` file along with the model config as a ``model_config.json`` file.
  
  Args:
      dir_path (str): The path where the model should be saved. If the path
          path does not exist a folder will be created at the provided location.
docstr_tok: ["Method","to","save","the","model","at","a","specific","location",".","It","saves",",","the","model","weights","as","a","``","models.pt","``","file","along","with","the","model","config","as","a","``","model_config.json","``","file",".","Args",":","dir_path","(","str",")",":","The","path","where","the","model","should","be","saved",".","If","the","path","path","does","not","exist","a","folder","will","be","created","at","the","provided","location","."]
code: def save(self, dir_path):
      """Method to save the model at a specific location. It saves, the model weights as a
      ``models.pt`` file along with the model config as a ``model_config.json`` file.
  
      Args:
          dir_path (str): The path where the model should be saved. If the path
              path does not exist a folder will be created at the provided location.
      """
  
      env_spec = EnvironmentConfig(
          python_version=f"{sys.version_info[0]}.{sys.version_info[1]}"
      )
      model_dict = {"model_state_dict": deepcopy(self.state_dict())}
  
      if not os.path.exists(dir_path):
          try:
              os.makedirs(dir_path)
  
          except (FileNotFoundError, TypeError) as e:
              raise e
  
      env_spec.save_json(dir_path, "environment")
      self.model_config.save_json(dir_path, "model_config")
  
      torch.save(model_dict, os.path.join(dir_path, "model.pt"))
  
imports: import os
  import sys
  from copy import deepcopy
  import numpy
  import torch
  import torch.nn
  from ....data.datasets import BaseDataset
  from ...auto_model import AutoConfig
  from ...base.base_config import EnvironmentConfig
  from ...base.base_utils import ModelOutput
  from .base_nf_config import BaseNFConfig
label_desc: Use image node_id 5 for calling the BaseNF obj's underlying member method code with example usage: obj.save(dir_path) without return types