in src/sagemaker_huggingface_inference_toolkit/transformers_utils.py [0:0]
def _build_storage_path(model_id: str, model_dir: Path, revision: Optional[str] = None):
"""
creates storage path for hub model based on model_id and revision
"""
if "/" and revision is None:
storage_path = os.path.join(model_dir, model_id.replace("/", REPO_ID_SEPARATOR))
elif "/" and revision is not None:
storage_path = os.path.join(model_dir, model_id.replace("/", REPO_ID_SEPARATOR) + "." + revision)
elif revision is not None:
storage_path = os.path.join(model_dir, model_id + "." + revision)
else:
storage_path = os.path.join(model_dir, model_id)
return storage_path