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 part of the Hugging Face CLI, a tool for interacting with the Hugging Face Hub directly from your terminal. It allows you to display information about the currently authenticated user.

    Purpose

    This command is primarily used to verify your login status and to see which Hugging Face Hub account you are currently logged in as. It provides details such as your username, full name, and email associated with your authenticated token.

    Syntax

    bash
    huggingface-cli whoami

    Usage Examples

    #### 1. Checking your current login status and user information:

    If you are logged in, running the command will display your user details:

    bash
    huggingface-cli whoami

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

    > User:  [your_username]
    > Name:  [Your Full Name]
    > Email: [your_email@example.com]

    #### 2. What happens if you are not logged in:

    If you are not logged in to the Hugging Face Hub (i.e., no authentication token is found or valid), the command will indicate this:

    bash
    huggingface-cli whoami

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

    Not logged in.

    Explanation

    * When you run `huggingface-cli whoami`, the CLI checks for a valid Hugging Face authentication token. This token is typically stored locally after you use `huggingface-cli login`.

    * If a valid token is found, it uses this token to query the Hugging Face Hub API and retrieve your user profile information, which is then displayed in the terminal.

    * The displayed information includes your `User` (Hugging Face username), `Name` (your full name as set in your profile), and `Email` (the email associated with your account).

    * If no valid token is found, or if the token is expired/invalid, the command will report "Not logged in."

    Related Commands

    * `huggingface-cli login`: Use this command to log in to the Hugging Face Hub. It will prompt you for your Hugging Face token.

    * `huggingface-cli logout`: Use this command to log out of the Hugging Face Hub by removing your local authentication token.