Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX [Gemma / CI] Make sure our runners have access to the model #29242

Merged
merged 8 commits into from
Feb 28, 2024

Conversation

younesbelkada
Copy link
Contributor

What does this PR do?

As discussed offline cc @ydshieh @sanchit-gandhi @ArthurZucker

Copy link
Collaborator

@ydshieh ydshieh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to just put token as a top module variable. Kind a bit strange to has a class attribute as token.

Thanks for the quick fix.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the token not work as long as it's set with export HF_HUB_READ_TOKEN=$GIT_SECRET

@ydshieh
Copy link
Collaborator

ydshieh commented Feb 26, 2024

Anyone wants to run the corresponding tests have to do

export HF_HUB_READ_TOKEN= ...(their own token, not the token stored on github as secret) ...

For CI, it will work fine as the secret is stored on Github Actions.

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Wauplin , after offline talks, seems that we should have something like:

def require_read_token(fn):
    token = os.getenv("HF_HUB_READ_TOKEN")

    @wraps(fn)
    def _inner(*args, **kwargs):
        with patch(huggingface_hub.utils._headers, "get_token", return_value=token):
            return fn(*args, **kwargs)

    return _inner

Users who want to test locally are usually logged in, so if they don't pass a token (False) it should still be alright

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM otherwise

tests/models/gemma/test_modeling_flax_gemma.py Outdated Show resolved Hide resolved
tests/models/gemma/test_modeling_gemma.py Outdated Show resolved Hide resolved
@ArthurZucker ArthurZucker merged commit ad00c48 into huggingface:main Feb 28, 2024
2 of 6 checks passed
@ArthurZucker ArthurZucker deleted the add-tokens-in-test branch February 28, 2024 05:25
ArthurZucker added a commit that referenced this pull request Feb 28, 2024
…29242)

* pu hf token in gemma tests

* update suggestion

* add to flax

* revert

* fix

* fixup

* forward contrib credits from discussion

---------

Co-authored-by: ArthurZucker <ArthurZucker@users.noreply.github.com>
itazap pushed a commit that referenced this pull request May 14, 2024
…29242)

* pu hf token in gemma tests

* update suggestion

* add to flax

* revert

* fix

* fixup

* forward contrib credits from discussion

---------

Co-authored-by: ArthurZucker <ArthurZucker@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants