docstr: Restores model instance (weights and configuration) into .nemo file
  
  Args:
      restore_path: path to .nemo file from which model should be instantiated
      override_config_path: path to a yaml config that will override the internal
          config file or an OmegaConf / DictConfig object representing the model config.
      map_location: Optional torch.device() to map the instantiated model to a device.
          By default (None), it will select a GPU if available, falling back to CPU otherwise.
      strict: Passed to load_state_dict. By default True
      return_config: If set to true, will return just the underlying config of the restored
          model as an OmegaConf DictConfig object without instantiating the model.
      trainer: An optional Trainer object, passed to the model constructor.
  
  Example:
      ```
      model = nemo.collections.asr.models.EncDecCTCModel.restore_from('asr.nemo')
      assert isinstance(model, nemo.collections.asr.models.EncDecCTCModel)
      ```
  
  Returns:
      An instance of type cls or its underlying config (if return_config is set).
code: def restore_from(
      self,
      calling_cls,
      restore_path: str,
      override_config_path: Optional[Union[OmegaConf, str]] = None,
      map_location: Optional[torch.device] = None,
      strict: bool = True,
      return_config: bool = False,
      trainer: Trainer = None,
  ):
      """
      Restores model instance (weights and configuration) into .nemo file
  
      Args:
          restore_path: path to .nemo file from which model should be instantiated
          override_config_path: path to a yaml config that will override the internal
              config file or an OmegaConf / DictConfig object representing the model config.
          map_location: Optional torch.device() to map the instantiated model to a device.
              By default (None), it will select a GPU if available, falling back to CPU otherwise.
          strict: Passed to load_state_dict. By default True
          return_config: If set to true, will return just the underlying config of the restored
              model as an OmegaConf DictConfig object without instantiating the model.
          trainer: An optional Trainer object, passed to the model constructor.
  
      Example:
          ```
          model = nemo.collections.asr.models.EncDecCTCModel.restore_from('asr.nemo')
          assert isinstance(model, nemo.collections.asr.models.EncDecCTCModel)
          ```
  
      Returns:
          An instance of type cls or its underlying config (if return_config is set).
      """
      # Get path where the command is executed - the artifacts will be "retrieved" there
      # (original .nemo behavior)
      loaded_params = self.load_config_and_state_dict(
          calling_cls,
          restore_path,
          override_config_path,
          map_location,
          strict,
          return_config,
          trainer,
      )
      if not isinstance(loaded_params, tuple) or return_config is True:
          return loaded_params
      conf, instance, state_dict = loaded_params
      state_dict = self.modify_state_dict(conf, state_dict)
      self.load_instance_with_state_dict(instance, state_dict, strict)
      logging.info(
          f"Model {instance.__class__.__name__} was successfully restored from {restore_path}."
      )
      return instance
  
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 6 for calling the SaveRestoreConnector obj's underlying member method code with example usage: obj.restore_from(calling_cls, restore_path, override_config_path, map_location, strict, return_config, trainer) and returns: instance, loaded_params