Skip to content

hf_hub_download requires authentication for Gemma 3 models #197

Description

@Reidmen

Hi!,

When working with the Gemma 3 models, convert_hf.py uses hf_hub_download, which requires verification.

In a clean environment, once installed the required python packages, the following command

python3 tools/convert_hf.py google/gemma-3-1b-it weights/gemma3-1b/ --precision INT8

gets an error, caught in stdout:

Converting google/gemma-3-1b-it to INT8...
Error: You are trying to access a gated repo.
Make sure to have access to it at https://huggingface.co/google/gemma-3-1b-it.
401 Client Error. (Request ID: Root=1-69082383-3b6d59c846f1b4790a81fac5;44c286de-ddb0-4d22-bb08-a20b0acf0c79)

Cannot access gated repo for url https://huggingface.co/google/gemma-3-1b-it/resolve/main/config.json.
Access to model google/gemma-3-1b-it is restricted. You must have access to it and be authenticated to access it. Please log in.

A quick fix is to export the HF_TOKEN variable. I might do a PR on this, feel free to ignore if it's not relevant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions