def load_from_hf_hub(repo_path: str, cache_dir: str = None) -> str:
    """
    Loads a checkpoint from the Hugging Face Hub.

    Args:
        repo_path (str): The path to the checkpoint on the Hugging Face Hub.
        cache_dir (str): The directory to cache the downloaded checkpoint.

    Returns:
        str: The path to the downloaded checkpoint.
    """
    repo_id = "/".join(repo_path.split("/")[:-1])
    repo_file = repo_path.split("/")[-1]
    ckpt_path = hf_hub_download(repo_id=repo_id, filename=repo_file, cache_dir=cache_dir)
    return ckpt_path

    Loads a checkpoint from the Hugging Face Hub.

    Args:
        repo_path (str): The path to the checkpoint on the Hugging Face Hub.
        cache_dir (str): The directory to cache the downloaded checkpoint.

    Returns:
        str: The path to the downloaded checkpoint.
    
opensora/utils/ckpt.py