docstr: Loads the Estimator state (including model and optimizer) or the entire model
  from the provided model_path.
  
  :param model_path: (str) Path to the existing model. Model class must be defined
         on the driver when loading the entire model.
docstr_tok: ["Loads","the","Estimator","state","(","including","model","and","optimizer",")","or","the","entire","model","from","the","provided","model_path",".",":","param","model_path",":","(","str",")","Path","to","the","existing","model",".","Model","class","must","be","defined","on","the","driver","when","loading","the","entire","model","."]
code: def load(self, model_path: str):
      """
      Loads the Estimator state (including model and optimizer) or the entire model
      from the provided model_path.
  
      :param model_path: (str) Path to the existing model. Model class must be defined
             on the driver when loading the entire model.
      """
      import torch.nn as nn
  
      if is_local_path(model_path):
          res = torch.load(model_path)
      else:
          file_name = os.path.basename(model_path)
          temp_dir = tempfile.mkdtemp()
          temp_path = os.path.join(temp_dir, file_name)
          try:
              get_remote_file_to_local(model_path, temp_path)
              res = torch.load(temp_path)
          finally:
              shutil.rmtree(temp_dir)
      if isinstance(res, Iterable) and not isinstance(
          res, nn.Sequential
      ):
          if "models" in res:
              self.state_dict = res
          else:
              self.state_dict = [re.state_dict() for re in res]
      else:
          self.state_dict = res.state_dict()
      if self.model_creator is None:
          self.model_creator = lambda config: res
          self.worker_init_params["model_creator"] = self.model_creator
  
imports: import types
  import torch
  import copy
  import os
  import shutil
  import tempfile
  import logging
  import math
  from pyspark.sql.dataframe import DataFrame
  from bigdl.dllib.utils.file_utils import is_local_path
  from bigdl.orca.learn.pytorch.pytorch_pyspark_worker import PytorchPysparkWorker
  from bigdl.orca.learn.pytorch.utils import process_stats
  from bigdl.orca.learn.utils import maybe_dataframe_to_xshards, dataframe_to_xshards, convert_predict_xshards_to_dataframe, make_data_creator, update_predict_xshards, process_xshards_of_pandas_dataframe, add_predict_to_pd_xshards
  from bigdl.orca.data import SparkXShards
  from bigdl.orca import OrcaContext
  from bigdl.orca.learn.base_estimator import BaseEstimator
  from bigdl.orca.data.file import get_remote_file_to_local, put_local_file_to_remote
  from bigdl.dllib.utils.common import get_node_and_core_number
  from bigdl.orca.learn.log_monitor import start_log_server, stop_log_server
  from bigdl.orca.learn.pytorch.callbacks.maincallback import make_only_mainCallback
  from bigdl.orca.learn.pytorch.callbacks.tqdm import TqdmCallback, is_tqdm_exists
  from bigdl.orca.learn.pytorch.callbacks.maxsteps import MaxstepsCallback
  from bigdl.orca.learn.utils import find_free_port, find_ip_and_free_port
  from bigdl.dllib.utils.utils import get_node_ip
  from bigdl.dllib.utils.log4Error import invalidInputError
  from typing import TYPE_CHECKING, Union, Optional, Callable, Dict, List
  from bigdl.orca.learn.pytorch.callbacks import Callback
label_desc: Use image node_id 13 for calling the PyTorchPySparkEstimator obj's underlying member method code with example usage: obj.load(model_path) without return types