class_docstr: This ``Estimator`` can be used to easily train and evaluate any GluonTS
  model on any dataset (own or built-in) in AWS Sagemaker using the provided
  Docker container. It also allows for the execution of custom scripts on AWS
  Sagemaker. Training is started by calling :meth:`GluonTSFramework.train` on
  this Estimator. After training is complete, calling
  :meth:`~sagemaker.amazon.estimator.Framework.deploy` creates a hosted
  SageMaker endpoint and returns an :class:`GluonTSPredictor` instance that
  can be used to perform inference against the hosted model. Alternatively,
  one can call the :meth:`GluonTSFramework.run` method to run a custom script
  defined by the "entry_point" argument of the :meth:`GluonTSFramework.run`
  method. Technical documentation on preparing GluonTSFramework scripts for
  SageMaker training and using the GluonTsFramework Estimator is available on
  the project home-page: https://github.com/awslabs/gluonts. See
  how_to_notebooks for examples of how to use this SDK.
  
  Parameters
  ----------
  sagemaker_session:
      Session object which manages interactions with Amazon SageMaker APIs
      and any other AWS services needed.
  role:
      An AWS IAM role (either name or full ARN). The Amazon SageMaker
      training jobs and APIs that create Amazon SageMaker endpoints use this
      role to access training data and model artifacts. After the endpoint is
      created, the inference code might use the IAM role, if it needs to
      access an AWS resource.
  image_uri:
      The estimator will use this image for training and hosting. It must be
      an ECR url. If you use an image with MXNET with GPU support, you will
      have to use a GPU instance.
      Example::
  
          '123.dkr.ecr.us-west-2.amazonaws.com/my-custom-image:1.0'
  
  base_job_name:
      Prefix for training job name when the :meth:`GluonTSFramework.train` or
      :meth:`GluonTSFramework.run` method is called.
  instance_type:
      Type of EC2 instance to use for training.
      Example::
  
          'ml.c5.xlarge' # CPU,
          'ml.p2.xlarge' # GPU
  
  instance_count:
      Currently not more than one supported.
      Otherwise the number of Amazon EC2 instances to use for training.
  dependencies:
      A list of paths to files or directories (absolute or relative) with any
      additional libraries that will be exported to the container. The
      library folders will be copied to SageMaker in the same folder where
      the "train.py" is copied. Include a path to a "requirements.txt" to
      install further dependencies at runtime. The provided dependencies take
      precedence over the pre-installed ones. If 'git_config' is provided,
      'dependencies' should be a list of relative locations to directories
      with any additional libraries needed in the Git repo.
      Example::
  
          GluonTSFramework(
              entry_point='train.py',
              dependencies=['my/libs/common', 'requirements.txt']
          )
  
      results in the following inside the container::
  
          opt/ml/code
               ├---> train.py
               ├---> common
               └---> requirements.txt
  
      To use a custom GluonTS version just import your custom GluonTS version
      and then call::
  
           GluonTSFramework(
              entry_point='train.py',
              dependencies=[gluonts.__path__[0]]
          )
  
      This may brake the :meth:`GluonTSFramework.train` method though. If not
      specified, them dependencies from the Estimator will be used.
  output_path:
      S3 location for saving the transform result. If not specified, results
      are stored to a default bucket.
  code_location:
      The S3 prefix URI where custom code will be uploaded. The code file
      uploaded in S3 is 'code_location/source/sourcedir.tar.gz'. If not
      specified, the default code location is s3://default_bucket/job-name/.
      And code file uploaded to S3 is
      s3://default_bucket/job-name/source/sourcedir.tar.gz
  framework_version:
      GluonTS version. If not specified, this will default to 0.4.1.
      Currently has no effect.
  hyperparameters:
      # TODO add support for HPO
      Not the Estimator hyperparameters, those are provided through the
      Estimator in the :meth:`GluonTSFramework.train` method. If you use the
      :meth:`GluonTSFramework.run` method its up to you what you do with this
      parameter and you could use it to define the hyperparameters of your
      models. There is no support for Hyper Parameter Optimization (HPO) so
      far. In general hyperparameters will be used for training. They are
      made accessible as a dict[str, str] to the training code on SageMaker.
      For convenience, this accepts other types for keys and values, but
      ``str()`` will be called to convert them before training.
  entry_point:
      Should not be overwritten if you intend to use the
      :meth:`GluonTSFramework.train` method, and only be specified through
      the :meth:`GluonTSFramework.run` method.
  **kwargs:
      Additional kwargs passed to the :class:`~sagemaker.estimator.Framework`
      constructor.
code: def _retrieve_model(self, locations):
      with self._s3fs.open(locations.model_archive, "rb") as stream:
          with tarfile.open(mode="r:gz", fileobj=stream) as archive:
              with TemporaryDirectory() as temp_dir:
                  safe_extractall(archive, temp_dir)
                  predictor = Predictor.deserialize(Path(temp_dir))
  
      return predictor
  
imports: import json
  import logging
  import tarfile
  from functools import partial
  from pathlib import Path
  from tempfile import TemporaryDirectory
  from typing import Dict, List, NamedTuple, Optional, Tuple, Union
  import pandas
  import s3fs
  import sagemaker
  from sagemaker.estimator import Framework
  from sagemaker.s3 import parse_s3_url
  from sagemaker.vpc_utils import VPC_CONFIG_DEFAULT
  from gluonts.core import serde
  from gluonts.dataset.repository import datasets
  from gluonts.model.estimator import Estimator
  from gluonts.model.predictor import Predictor
  from gluonts.util import safe_extractall
  from .defaults import ENTRY_POINTS_FOLDER, FRAMEWORK_NAME, GLUONTS_VERSION, LATEST_GLUONTS_VERSION, LOWEST_SCRIPT_MODE_VERSION, MONITORED_METRICS, NUM_SAMPLES, PYTHON_VERSION, QUANTILES, TRAIN_SCRIPT
  from .model import GluonTSModel
  from .utils import make_job_name, make_metrics
label_desc: Use image node_id 8 for calling the GluonTSFramework obj's underlying member method code with example usage: obj._retrieve_model(locations) and returns: predictor