class_docstr: Defines the base class RAIBaseInsights for the top-level API.
  
  This class is abstract and should not be instantiated.
class_docstr_tok: ["Defines","the","base","class","RAIBaseInsights","for","the","top-level","API",".","This","class","is","abstract","and","should","not","be","instantiated","."]
docstr: Load the model.
  
  :param inst: RAIBaseInsights object instance.
  :type inst: RAIBaseInsights
  :param path: The directory path to model location.
  :type path: str
docstr_tok: ["Load","the","model",".",":","param","inst",":","RAIBaseInsights","object","instance",".",":","type","inst",":","RAIBaseInsights",":","param","path",":","The","directory","path","to","model","location",".",":","type","path",":","str"]
code: def _load_model(inst, path):
      """Load the model.
  
      :param inst: RAIBaseInsights object instance.
      :type inst: RAIBaseInsights
      :param path: The directory path to model location.
      :type path: str
      """
      # Communicate with locally served model
      # if the environment variable RAI_MODEL_SERVING_PORT is set.
      model_serving_port = os.getenv(
          ModelServingConstants.RAI_MODEL_SERVING_PORT_ENV_VAR
      )
      if model_serving_port is not None:
          inst.__dict__["_" + _SERIALIZER] = None
          inst.__dict__[Metadata.MODEL] = ServedModelWrapper(
              port=model_serving_port
          )
          return
  
      # Otherwise use the conventional paths with local artifacts
      top_dir = Path(path)
      serializer_path = top_dir / _SERIALIZER
      model_load_err = (
          "ERROR-LOADING-USER-MODEL: "
          "There was an error loading the user model."
      )
      if serializer_path.exists():
          try:
              with open(serializer_path, "rb") as file:
                  serializer = pickle.load(file)
              inst.__dict__["_" + _SERIALIZER] = serializer
              inst.__dict__[Metadata.MODEL] = serializer.load(top_dir)
          except Exception as e:
              warnings.warn(model_load_err)
              raise e
      else:
          inst.__dict__["_" + _SERIALIZER] = None
          try:
              with open(top_dir / _MODEL_PKL, "rb") as file:
                  inst.__dict__[Metadata.MODEL] = pickle.load(file)
          except Exception as e:
              warnings.warn(model_load_err)
              raise e
  
imports: import json
  import os
  import pickle
  import warnings
  from abc import ABC, abstractmethod
  from pathlib import Path
  from typing import Any, Optional
  import pandas
  import responsibleai
  from raiutils.exceptions import UserConfigValidationException
  from responsibleai._internal._served_model_wrapper import ServedModelWrapper
  from responsibleai._internal.constants import FileFormats, Metadata, ModelServingConstants, SerializationAttributes
label_desc: Use image node_id 17 for calling the RAIBaseInsights obj's underlying member method code with example usage: obj._load_model(inst, path) without return types