docstr: Saves model instance (weights and configuration) into .nemo file.
  You can use "restore_from" method to fully restore instance from .nemo file.
  
  .nemo file is an archive (tar.gz) with the following:
      model_config.yaml - model configuration in .yaml format. You can deserialize this into cfg argument for model's constructor
      model_wights.ckpt - model checkpoint
  
  Args:
      model: ModelPT object to be saved.
      save_path: Path to .nemo file where model instance should be saved
code: def save_to(self, model: "nemo_classes.ModelPT", save_path: str):
      """
      Saves model instance (weights and configuration) into .nemo file.
      You can use "restore_from" method to fully restore instance from .nemo file.
  
      .nemo file is an archive (tar.gz) with the following:
          model_config.yaml - model configuration in .yaml format. You can deserialize this into cfg argument for model's constructor
          model_wights.ckpt - model checkpoint
  
      Args:
          model: ModelPT object to be saved.
          save_path: Path to .nemo file where model instance should be saved
      """
  
      if is_global_rank_zero():
          with tempfile.TemporaryDirectory() as tmpdir:
              config_yaml = os.path.join(tmpdir, self.model_config_yaml)
              model_weights = os.path.join(
                  tmpdir, self.model_weights_ckpt
              )
              model.to_config_file(path2yaml_file=config_yaml)
              # update subconfigs, if there are child model, since child model can change its config
              self._update_subconfigs(model, path2yaml_file=config_yaml)
              if model.has_native_or_submodules_artifacts():
                  self._handle_artifacts(model, nemo_file_folder=tmpdir)
                  # We should not update self._cfg here - the model can still be in use
                  self._update_artifact_paths(
                      model, path2yaml_file=config_yaml
                  )
              self._save_state_dict_to_disk(
                  model.state_dict(), model_weights
              )
              self._make_nemo_file_from_folder(
                  filename=save_path, source_dir=tmpdir
              )
      else:
          return
  
imports: from __future__ import annotations
  import os
  import shutil
  import tarfile
  import tempfile
  import uuid
  from typing import Optional, Set, Union
  import torch
  from omegaconf import DictConfig, OmegaConf
  from omegaconf.omegaconf import open_dict
  from pytorch_lightning.trainer.trainer import Trainer
  from nemo.core import classes
  from nemo.utils import logging, model_utils
  from nemo.utils.app_state import AppState
  from nemo.utils.get_rank import is_global_rank_zero
  from nemo.utils.model_utils import inject_model_parallel_rank
label_desc: Use image node_id 2 for calling the SaveRestoreConnector obj's underlying member method code with example usage: obj.save_to(model, save_path) without return types