class_docstr: TorchServe 1.0 Model Loader
docstr: Load TorchServe 1.0 model from file.
  
  :param model_name:
  :param model_dir:
  :param handler:
  :param gpu_id:
  :param batch_size:
  :param envelope:
  :param limit_max_image_pixels:
  :param metrics_cache: MetricsCacheYamlImpl object
  :return:
docstr_tok: ["Load","TorchServe","1.0","model","from","file",".",":","param","model_name",":",":","param","model_dir",":",":","param","handler",":",":","param","gpu_id",":",":","param","batch_size",":",":","param","envelope",":",":","param","limit_max_image_pixels",":",":","param","metrics_cache",":","MetricsCacheYamlImpl","object",":","return",":"]
code: def load(
      self,
      model_name: str,
      model_dir: str,
      handler: Optional[str] = None,
      gpu_id: Optional[int] = None,
      batch_size: Optional[int] = None,
      envelope: Optional[str] = None,
      limit_max_image_pixels: Optional[bool] = True,
      metrics_cache: Optional[MetricsCacheYamlImpl] = None,
  ) -> Service:
      """
      Load TorchServe 1.0 model from file.
  
      :param model_name:
      :param model_dir:
      :param handler:
      :param gpu_id:
      :param batch_size:
      :param envelope:
      :param limit_max_image_pixels:
      :param metrics_cache: MetricsCacheYamlImpl object
      :return:
      """
      logging.debug("Loading model - working dir: %s", os.getcwd())
  
      # Backwards Compatibility with releases <=0.6.0
      # Request ID is not set for model load requests
      # TODO: UUID serves as a temporary request ID for model load requests
      if metrics_cache is not None:
          metrics_cache.set_request_ids(str(uuid.uuid4()))
  
      manifest_file = os.path.join(
          model_dir, "MAR-INF", "MANIFEST.json"
      )
      manifest = None
      if os.path.exists(manifest_file):
          with open(manifest_file) as f:
              manifest = json.load(f)
  
      function_name = None
      try:
          module, function_name = self._load_handler_file(handler)
      except ImportError:
          module = self._load_default_handler(handler)
  
      if module is None:
          raise ValueError(
              "Unable to load module {}, make sure it is added to python path".format(
                  handler
              )
          )
      function_name = function_name or "handle"
  
      if hasattr(module, function_name):
          entry_point, initialize_fn = self._get_function_entry_point(
              module, function_name
          )
      else:
          entry_point, initialize_fn = self._get_class_entry_point(
              module
          )
  
      if envelope is not None:
          envelope_class = self._load_default_envelope(envelope)
          if envelope_class is not None:
              envelope_instance = envelope_class(entry_point)
              entry_point = envelope_instance.handle
  
      service = Service(
          model_name,
          model_dir,
          manifest,
          entry_point,
          gpu_id,
          batch_size,
          limit_max_image_pixels,
          metrics_cache,
      )
      initialize_fn(service.context)
  
      return service
  
imports: import importlib
  import json
  import logging
  import os
  import uuid
  from abc import ABCMeta, abstractmethod
  from builtins import str
  from typing import Optional
  from ts.metrics.metric_cache_yaml_impl import MetricsCacheYamlImpl
  from ts.service import Service
  from .utils.util import list_classes_from_module
label_desc: Use image node_id 1 for calling the TsModelLoader obj's underlying member method code with example usage: obj.load(model_name, model_dir, handler, gpu_id, batch_size, envelope, limit_max_image_pixels, metrics_cache) and returns: service