parameters: (self, save_path: str)
return_statement: return model
docstring: Check if a trained model exists at the path.
          Load the model into cache if it is not.
          :param save_path: path to model to load
          :return: None if no model exists at path, or Model map saved at path
docstring_summary: Check if a trained model exists at the path.
          Load the model into cache if it is not.
          :param save_path: path to model to load
          :return: None if no model exists at path, or Model map saved at path
docstring_tokens: Check if a trained model exists at the path . Load the model into cache if it is not . : param save_path : path to model to load : return : None if no model exists at path or Model map saved at path
function: def _load_model(self, save_path: str):
          """
          Check if a trained model exists at the path.
          Load the model into cache if it is not.
          :param save_path: path to model to load
          :return: None if no model exists at path, or Model map saved at path
          """
          save_path = Path(save_path)
  
          # Check model exists
          if not save_path.exists():
              return None
  
          # use the path string as the key of the cache
          save_path_str = str(save_path)
  
          # Load from cache
          if self.model_cache.get(save_path_str, None) is not None:
              return self.model_cache[save_path_str]
  
          # Load into cache
          model = self._load_model_from_disk(save_path)
  
          self.model_cache[save_path_str] = model
          return model
function_tokens: def _load_model ( self , save_path : str ) : save_path = Path ( save_path ) # Check model exists if not save_path . exists ( ) : return None # use the path string as the key of the cache save_path_str = str ( save_path ) # Load from cache if self . model_cache . get ( save_path_str , None ) is not None : return self . model_cache [ save_path_str ] # Load into cache model = self . _load_model_from_disk ( save_path ) self . model_cache [ save_path_str ] = model return model