from typing import Optional | |
from huggingface_hub import HfFolder, whoami | |
def get_full_repo_name(model_id: str, organization: Optional[str] = None, token: Optional[str] = None): | |
if token is None: | |
token = HfFolder.get_token() | |
if organization is None: | |
username = whoami(token)["name"] | |
return f"{username}/{model_id}" | |
else: | |
return f"{organization}/{model_id}" | |