CLI Companion

  • Hugging Face CLI
    • login
    • whoami
    • repo create
    • upload
    • download
    • lfs-enable-largefiles
    • scan-cache
    • delete-cache
  • Hapi CLI
    • new
    • start
    • build
    • test
    • plugin create
    • route add
  • Cloudflared
    • tunnel
    • tunnel run
    • tunnel list
    • tunnel delete
    • access
    • access tcp
    • update

    The `huggingface-cli whoami` command is used to display information about the currently authenticated user with the Hugging Face Hub. This command is useful for verifying your login status and confirming which account you are currently using.

    Syntax

    bash
    huggingface-cli whoami

    There are no additional arguments or options for this command.

    Usage Examples

    **1. Checking your currently logged-in account:**

    To simply check who you are logged in as, execute the command:

    bash
    huggingface-cli whoami

    **Expected Output (if logged in):**

    Logged in as user_name (id: user_id)

    For example:

    Logged in as JohnDoe (id: 123456789)

    **Expected Output (if not logged in):**

    If you are not logged in, the command will indicate that no user is logged in:

    Not logged in

    Explanation

    `huggingface-cli whoami` leverages the authentication token stored locally by the Hugging Face CLI (typically after running `huggingface-cli login`). It reads this token, validates it against the Hugging Face Hub, and retrieves the associated user information. The output confirms:

    * Whether you are currently logged in.

    * If logged in, the `user_name` associated with your account on the Hugging Face Hub.

    * The unique `user_id` for that account.

    This command is a quick way to ensure that your local environment is correctly authenticated to interact with the Hugging Face Hub, especially when performing actions that require authentication, such as uploading models, datasets, or Spaces, or accessing private repositories.