class_docstr: Abstract class offering interface which should be implemented by all NeMo models.
class_docstr_tok: ["Abstract","class","offering","interface","which","should","be","implemented","by","all","NeMo","models","."]
docstr: Resolve the NGC model pretrained information given a model name.
  Assumes the model subclass implements the `list_available_models()` inherited method.
  
  Args:
      model_name: Str name of the model. Must be the original name or an alias of the model, without any '/'.
      refresh_cache: Bool, determines whether cache must be refreshed (model is re-downloaded).
  
  Returns:
      A tuple of details describing :
      -   The resolved class of the model. This requires subclass to implement PretrainedModelInfo.class_.
          If the class cannot be resolved, default to the class that called this method.
      -   The path to the NeMo model (.nemo file) in some cached directory.
docstr_tok: ["Resolve","the","NGC","model","pretrained","information","given","a","model","name",".","Assumes","the","model","subclass","implements","the","`","list_available_models","(",")","`","inherited","method",".","Args",":","model_name",":","Str","name","of","the","model",".","Must","be","the","original","name","or","an","alias","of","the","model",",","without","any","'\/","'",".","refresh_cache",":","Bool",",","determines","whether","cache","must","be","refreshed","(","model","is","re-downloaded",")",".","Returns",":","A","tuple","of","details","describing",":","-","The","resolved","class","of","the","model",".","This","requires","subclass","to","implement","PretrainedModelInfo.class_",".","If","the","class","can","not","be","resolved",",","default","to","the","class","that","called","this","method",".","-","The","path","to","the","NeMo","model","(",".nemo","file",")","in","some","cached","directory","."]
code: def _get_ngc_pretrained_model_info(
      cls, model_name: str, refresh_cache: bool = False
  ) -> Tuple[type, str]:
      """
      Resolve the NGC model pretrained information given a model name.
      Assumes the model subclass implements the `list_available_models()` inherited method.
  
      Args:
          model_name: Str name of the model. Must be the original name or an alias of the model, without any '/'.
          refresh_cache: Bool, determines whether cache must be refreshed (model is re-downloaded).
  
      Returns:
          A tuple of details describing :
          -   The resolved class of the model. This requires subclass to implement PretrainedModelInfo.class_.
              If the class cannot be resolved, default to the class that called this method.
          -   The path to the NeMo model (.nemo file) in some cached directory.
      """
      location_in_the_cloud = None
      description = None
      class_ = None
      models = cls.list_available_models()
      if models is not None:
          for pretrained_model_info in cls.list_available_models():
              found = False
              if (
                  pretrained_model_info.pretrained_model_name
                  == model_name
              ):
                  found = True
              elif pretrained_model_info.aliases is not None:
                  for alias in pretrained_model_info.aliases:
                      if alias == model_name:
                          found = True
                          break
              if found:
                  location_in_the_cloud = pretrained_model_info.location
                  description = pretrained_model_info.description
                  class_ = pretrained_model_info.class_
                  break
  
      if location_in_the_cloud is None:
          raise FileNotFoundError(
              f"Model {model_name} was not found. Check cls.list_available_models() for the list of all available models."
          )
      filename = location_in_the_cloud.split("/")[-1]
      url = location_in_the_cloud.replace(filename, "")
      cache_dir = Path.joinpath(resolve_cache_dir(), f"{filename[:-5]}")
      # If either description and location in the cloud changes, this will force re-download
      cache_subfolder = hashlib.md5(
          (location_in_the_cloud + description).encode("utf-8")
      ).hexdigest()
      # if file exists on cache_folder/subfolder, it will be re-used, unless refresh_cache is True
      nemo_model_file_in_cache = maybe_download_from_cloud(
          url=url,
          filename=filename,
          cache_dir=cache_dir,
          subfolder=cache_subfolder,
          refresh_cache=refresh_cache,
      )
  
      logging.info("Instantiating model from pre-trained checkpoint")
  
      if class_ is None:
          class_ = cls
  
      return class_, nemo_model_file_in_cache
  
imports: import hashlib
  import inspect
  import traceback
  from abc import ABC, abstractmethod
  from contextlib import contextmanager
  from dataclasses import dataclass, field
  from enum import Enum
  from functools import total_ordering
  from pathlib import Path
  from typing import Dict, Iterable, List, Optional, Tuple, Union
  import hydra
  import torch
  import wrapt
  from huggingface_hub import HfApi, HfFolder, ModelFilter, hf_hub_download
  from huggingface_hub.hf_api import ModelInfo
  from omegaconf import DictConfig, OmegaConf
  import nemo
  from nemo.core.connectors.save_restore_connector import SaveRestoreConnector
  from nemo.core.neural_types import NeuralType, NeuralTypeComparisonResult
  from nemo.utils import logging
  from nemo.utils.cloud import maybe_download_from_cloud
  from nemo.utils.data_utils import resolve_cache_dir
  from nemo.utils.model_utils import import_class_by_path, maybe_update_config_version
label_desc: Use image node_id 6 for calling the Model obj's underlying member method code with example usage: obj._get_ngc_pretrained_model_info(cls, model_name, refresh_cache) and returns: class_,  nemo_model_file_in_cache