code: def load(path: tp.Union[str, Path]) -> ModelBase:
      """
      Loads a model from disk.
  
      This function will restore both the model architecture,
      that is, its `Model` class instance, along with all of its
      parameters, states, and optimizer states.
  
      Example:
  
      ```python
      import elegy
  
      model.save('my_model')  # creates folder at 'my_model'
      del model  # deletes the existing model
  
      # returns a model identical to the previous one
      model = elegy.model.load('my_model')
      ```
  
      Arguments:
          path: path to a saved model's directory.
          include_optimizer: If True, loads optimizer's state if available.
  
      Raises:
          OSError: in case the model was not found or could not be
              loaded from disk successfully.
      """
      if isinstance(path, str):
          path = Path(path)
  
      try:
          model_bytes = (path / "model.pkl").read_bytes()
      except BaseException as e:
          raise OSError(f"Could not load the model. Got exception: {e}")
  
      model: ModelBase = pickle.loads(model_bytes)
      model.load(path)
  
      return model
  
imports: import pickle
  import threading
  import typing
  from contextlib import contextmanager
  from copy import copy
  from dataclasses import dataclass
  from pathlib import Path
  import jax
  import jax.numpy
  import numpy
  import treex
  from elegy import data, types, utils
  from elegy.callbacks import Callback, CallbackList, History, history
  from elegy.callbacks.sigint import SigIntMode
  from elegy.data import utils
  from elegy.model.model_core import ModelCore, PredStepOutput, TestStepOutput
label_desc: Use image node_id 1 for calling a global function with example usage: load(path) and returns: model