def _update_available_models(model_cache_key: str, model_name: str, validated_model_properties: dict,
                             device: str, normalize_embeddings: bool, model_auth: ModelAuth = None) -> None:
    """loads the model if it is not already loaded.
    Note this method assume the model_properties are validated.
    """
    if model_cache_key not in _available_models:
        model_size = get_model_size(model_name, validated_model_properties)
        if lock.locked():
            raise ModelCacheManagementError(
                "Request rejected, as this request attempted to update the model cache, while "
                "another request was updating the model cache at the same time. "
                "Please wait for 10 seconds and send the request again ")
        with lock:
            _validate_model_into_device(model_name, validated_model_properties, device,
                                        calling_func=_update_available_models.__name__)
            try:
                most_recently_used_time = datetime.datetime.now()
                _available_models[model_cache_key] = {
                    AvailableModelsKey.model: _load_model(
                        model_name, validated_model_properties,
                        device=device,
                        calling_func=_update_available_models.__name__,
                        model_auth=model_auth
                    ),
                    AvailableModelsKey.most_recently_used_time: most_recently_used_time,
                    AvailableModelsKey.model_size: model_size
                }
                logger.info(
                    f'loaded {model_name} on device {device} with normalization={normalize_embeddings} at time={most_recently_used_time}.')
            except Exception as e:
                logger.error(
                    f"Error loading model {model_name} on device {device} with normalization={normalize_embeddings}. \n"
                    f"Error message is {str(e)}")

                if isinstance(e, ModelDownloadError):
                    raise e
                raise ModelLoadError(
                    f"Unable to load model={model_name} on device={device} with normalization={normalize_embeddings}. "
                    f"If you are trying to load a custom model, "
                    f"please check that model_properties={validated_model_properties} is correct "
                    f"and Marqo has access to the weights file.") from e

    else:
        most_recently_used_time = datetime.datetime.now()
        logger.debug(f'renewed {model_name} on device {device} with new most recently time={most_recently_used_time}.')
        try:
            _available_models[model_cache_key][AvailableModelsKey.most_recently_used_time] = most_recently_used_time
        except KeyError as e:
            raise ModelNotInCacheError(
                f"Marqo cannot renew model {model_name} on device {device} with normalization={normalize_embeddings}. "
                f"Maybe another thread is updating the model cache at the same time."
                f"Please wait for 10 seconds and send the request again.\n") from e
loads the model if it is not already loaded.
    Note this method assume the model_properties are validated.
    
src/marqo/inference/native_inference/load_model.py