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

CI: setup-dependent pip cache #16751

Merged
merged 3 commits into from
Apr 13, 2022
Merged

Conversation

gante
Copy link
Member

@gante gante commented Apr 13, 2022

What does this PR do?

This PR makes two changes to the way we cache our pip dependencies in the add-model-like.yml GH actions workflow:

  1. The name of the cache depends on the hash of setup.py;
  2. We do not restore the cache from partial name matches.

(this pattern exists in one of our CI files, github-torch-hub.yml , here)

Together, these changes will make us start from a fresh environment whenever we change setup.py. Having a stale cache was causing us to have dependency problems (e.g. old, incompatible protobuf version), and potentially miss dependency issues from fresh installs.

If you agree, I will also port these changes to model-templates.yml and update_metdata.yml, which have the same pattern/issue. EDIT: ported.

@gante gante requested review from sgugger and ydshieh April 13, 2022 14:22
Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Thanks for fixing! Pinging @LysandreJik also on this.

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

Ok for me!

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Apr 13, 2022

The documentation is not available anymore as the PR was closed or merged.

@gante
Copy link
Member Author

gante commented Apr 13, 2022

Cool, porting the changes to the other two files as well then 👍

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 learn this thing from you in this PR, @gante!

LGTM.

@ydshieh
Copy link
Collaborator

ydshieh commented Apr 13, 2022

@gante: to learn more from you: how you figured out the cause for the error you mentioned:

https://github.com/huggingface/transformers/runs/6007067240?check_suite_focus=true

If it was me, I don't even know if I could figure this out!

@gante
Copy link
Member Author

gante commented Apr 13, 2022

@ydshieh It definitely helps that I had this exact issue (stale CI caches) in my previous role :)

To pin the error to this issue, I reran the failing CI workflow locally, from a fresh virtual env. Since it ran without issues, I had a look at the .yml file, and saw that it had a cache for pip. Then I went on to see that pip install -e .[dev] was doing in the failing CI file, and I noticed that it had error messages due to incompatible package versions, which I did not have locally -- because an old version was cached.

@gante gante merged commit 0b8f697 into huggingface:main Apr 13, 2022
@gante gante deleted the cache_setup_dependent branch April 13, 2022 15:19
elusenji pushed a commit to elusenji/transformers that referenced this pull request Jun 12, 2022
* Setup-dependent pip cache

* Do not restore from old versions
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.

5 participants