code: def download_pretrained_model(model_name, *args, **kwargs):
      import omegaconf
      from mmf.utils.configuration import get_mmf_env, load_yaml
      from omegaconf import OmegaConf
  
      model_zoo = load_yaml(get_mmf_env(key="model_zoo"))
      OmegaConf.set_struct(model_zoo, True)
      OmegaConf.set_readonly(model_zoo, True)
  
      data_dir = get_absolute_path(get_mmf_env("data_dir"))
      model_data_dir = os.path.join(data_dir, "models")
      download_path = os.path.join(model_data_dir, model_name)
  
      try:
          model_config = OmegaConf.select(model_zoo, model_name)
      except omegaconf.errors.OmegaConfBaseException as e:
          print(f"No such model name {model_name} defined in mmf zoo")
          raise e
  
      if (
          "version" not in model_config
          or "resources" not in model_config
      ):
          # Version and Resources are not present time to try the defaults
          try:
              model_config = model_config.defaults
              download_path = os.path.join(
                  model_data_dir, model_name + ".defaults"
              )
          except omegaconf.errors.OmegaConfBaseException as e:
              print(
                  f"Model name {model_name} doesn't specify 'resources' and 'version' "
                  "while no defaults have been provided"
              )
              raise e
  
      # Download requirements if any specified by "zoo_requirements" field
      # This can either be a list or a string
      if "zoo_requirements" in model_config:
          requirements = model_config.zoo_requirements
          if isinstance(requirements, str):
              requirements = [requirements]
          for item in requirements:
              download_pretrained_model(item, *args, **kwargs)
  
      version = model_config.version
      resources = model_config.resources
  
      download_resources(resources, download_path, version)
  
      return download_path
  
imports: import collections
  import datetime
  import hashlib
  import io
  import json
  import os
  import shutil
  import time
  from pathlib import Path
  import numpy
  import requests
  import tqdm
  from mmf.utils.file_io import PathManager
  from mmf.utils.general import get_absolute_path
  from PIL import Image
label_desc: Use image node_id 5 for calling a global function with example usage: download_pretrained_model(model_name) and returns: download_path