def cache_model(self, model_id: str, model_json: dict) -> None:
        """Upload output model to shared cache.

            model path and adapter path (if exists)
                will be uploaded to shared cache to `<model_id>/model_path.json`.
            model files will be uploaded to shared cache to `<model_id>/model/`.
            adapter files will be uploaded to shared cache to `<model_id>/adapter/`.
            HF model with model path as repo name will not be uploaded to shared cache.

        Args:
            model_id (str): Output model id
            model_json (Dict): Output model config json

        """
        if self.exist_in_shared_cache(model_id):
            logger.info("Model is already in shared cache.")
            return

        logger.info("Uploading model %s to shared cache ...", model_id)
        model_path = model_json["config"].get("model_path")

        if model_path is None:
            logger.error("Model path is not found in the output model config. Upload failed.")
            return

        try:
            adapter_path = None

            model_json_copy = deepcopy(model_json)
            model_json_copy["config"]["shared_cache"] = True

            if model_json["config"].get("model_attributes"):
                model_json_copy["config"]["model_attributes"].pop("additional_files", None)

            if model_json["type"].lower() == "hfmodel" and Path(model_path).exists():
                model_json_copy["config"]["model_path"] = Path(model_path).name
            else:
                model_json_copy["config"]["model_path"] = model_path

            if model_json["type"].lower() == "hfmodel" and model_json["config"].get("adapter_path"):
                adapter_path = Path(model_json["config"]["adapter_path"])
                model_json_copy["config"]["adapter_path"] = adapter_path.name

            model_files_blob = f"{model_id}/model"

            # upload model files
            model_blob = f"{model_files_blob}/model/{model_json_copy['config']['model_path']}"
            self.upload_model_files(model_path, model_blob)

            # upload adapter files
            adapter_blob = f"{model_files_blob}/adapter"
            self.upload_model_files(adapter_path, adapter_blob)

            # upload additional files
            if model_json["config"].get("model_attributes") and model_json["config"]["model_attributes"].get(
                "additional_files"
            ):
                additional_files = model_json["config"]["model_attributes"]["additional_files"]
                for file in additional_files:
                    file_path = Path(file)
                    if file_path.exists():
                        self._upload_file_to_blob(file_path, f"{model_files_blob}/additional_files/{file_path.name}")

            # upload model config file
            model_config_bytes = json.dumps(model_json_copy).encode()
            with io.BytesIO(model_config_bytes) as data:
                self.container_client_factory.upload_blob(f"{model_id}/model.json", data)
            logger.info("Model %s is uploaded to shared cache.", model_id)

        except Exception:
            logger.exception("Failed to upload model to shared cache.")
            # delete all uploaded files if any upload fails
            try:
                self.container_client_factory.delete_blob(model_id)
            except Exception:
                logger.exception(
                    "Upload model to shared cache failed. There might be some dirty files in the shared cache."
                    "Please manually clean up. %s",
                    model_id,
                )
Upload output model to shared cache.

            model path and adapter path (if exists)
                will be uploaded to shared cache to `<model_id>/model_path.json`.
            model files will be uploaded to shared cache to `<model_id>/model/`.
            adapter files will be uploaded to shared cache to `<model_id>/adapter/`.
            HF model with model path as repo name will not be uploaded to shared cache.

        Args:
            model_id (str): Output model id
            model_json (Dict): Output model config json

        
olive/cache.py