class_docstr: Abstract class representing predictor objects.
  Parameters
  ----------
  prediction_length
      Prediction horizon.
class_docstr_tok: ["Abstract","class","representing","predictor","objects",".","Parameters","--","--","--","--","--","prediction_length","Prediction","horizon","."]
docstr: Load a serialized predictor from the given path.
  
  Parameters
  ----------
  path
      Path to the serialized files predictor.
  **kwargs
      Optional context/device parameter to be used with the predictor.
      If nothing is passed will use the GPU if available and CPU
      otherwise.
docstr_tok: ["Load","a","serialized","predictor","from","the","given","path",".","Parameters","--","--","--","--","--","path","Path","to","the","serialized","files","predictor",".","*","*","kwargs","Optional","context\/device","parameter","to","be","used","with","the","predictor",".","If","nothing","is","passed","will","use","the","GPU","if","available","and","CPU","otherwise","."]
code: def deserialize(cls, path: Path, **kwargs) -> "Predictor":
      """
      Load a serialized predictor from the given path.
  
      Parameters
      ----------
      path
          Path to the serialized files predictor.
      **kwargs
          Optional context/device parameter to be used with the predictor.
          If nothing is passed will use the GPU if available and CPU
          otherwise.
      """
      # deserialize Predictor type
      if (path / "gluonts-config.json").exists():
          with (path / "gluonts-config.json").open("r") as fp:
              tpe_str = json.load(fp)["type"]
      else:
          logger.warning(
              "Deserializing an old version of gluonts predictor. "
              "Support for old gluonts predictors will be removed in v0.16. "
              "Consider serializing this predictor again.",
          )
          with (path / "type.txt").open("r") as fp:
              tpe_str = fp.readline()
  
      tpe = locate(tpe_str)
      assert tpe is not None, f"Cannot locate {tpe_str}."
      assert isinstance(tpe, type)
  
      # ensure that predictor_cls is a subtype of Predictor
      if not issubclass(tpe, Predictor):
          raise OSError(
              f"Class {fqname_for(tpe)} is not "
              f"a subclass of {fqname_for(Predictor)}"
          )
  
      # call deserialize() for the concrete Predictor type
      return tpe.deserialize(path, **kwargs)
  
imports: import itertools
  import json
  import logging
  import multiprocessing
  import sys
  import traceback
  from pathlib import Path
  from pydoc import locate
  from tempfile import TemporaryDirectory
  from typing import TYPE_CHECKING, Callable, Iterator, Optional, Dict, Any
  import numpy
  import gluonts
  from gluonts.core import fqname_for
  from gluonts.core.component import equals, from_hyperparameters
  from gluonts.core.serde import dump_json, load_json
  from gluonts.dataset.common import DataEntry, Dataset
  from gluonts.model.forecast import Forecast
label_desc: Use image node_id 4 for calling the Predictor obj's underlying member method code with example usage: obj.deserialize(cls, path) and returns: tpe