-
Notifications
You must be signed in to change notification settings - Fork 30.9k
Add -e flag to some GH workflow yml files #16959
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
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
| with: | ||
| path: ~/venv/ | ||
| key: v2-tests_model_like-${{ hashFiles('setup.py') }} | ||
| key: v3-tests_model_like-${{ hashFiles('setup.py') }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in order to make the change effective (then saved to a new cache)
| python -m venv ~/venv && . ~/venv/bin/activate | ||
| pip install --upgrade pip!=21.3 | ||
| pip install .[dev] | ||
| pip install -e .[dev] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the main change in order to use /home/runner/work/transformers/transformers/src
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't usually work, as an editable install writes some content in some folders, and this is not allowed on GitHub action pull-request (for security reasons, since the user have put code on their own in their PR).
I have no idea why the check passes now, maybe it's not executing this version of the test script.
| - name: Check transformers location | ||
| run: | | ||
| . ~/venv/bin/activate | ||
| transformer_loc=$(pip show transformers | grep "Location: " | cut -c11-) | ||
| transformer_repo_loc=$(pwd .) | ||
| if [ "$transformer_loc" != "$transformer_repo_loc/src" ]; then | ||
| echo "transformers is from $transformer_loc but it shoud be from $transformer_repo_loc/src." | ||
| echo "A fix is required. Stop testing." | ||
| exit 1 | ||
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a check of the package location, so we won't be fooled in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the fix 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline, good for me, but let's be super vigilant after merging and ready to revert.
Thanks for working on this!
|
after the new cache is built the first time and job completes (pass the check I added too), the next run when we have the check failed with which means I will try to make it work - I really like to have this test. |
|
Confirmed this (with I still think there might be some workaround, let me try. Set to draft for now currently error |
.github/workflows/add-model-like.yml
Outdated
| # make `transformers` available as package (required since we use `-e` flag) and check it indeeds from the repo. | ||
| run: | | ||
| . ~/venv/bin/activate | ||
| python setup.py build install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sgugger let me know if you have any comment regarding this new change. 🙏
(Lysandre and gante are OK with it on a Slack message)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
.github/workflows/add-model-like.yml
Outdated
| # make `transformers` available as package (required since we use `-e` flag) and check it's indeed from the repo. | ||
| run: | | ||
| . ~/venv/bin/activate | ||
| python setup.py build install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually when installing it with -e, you should do python setup.py develop, no?
If this works well here, fine by me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change it to develop as it makes more sense. Thank you for the information!
* Add -e flag * add check * create new keys * run python setup.py build install * add comments * change to develop Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
* Add -e flag * add check * create new keys * run python setup.py build install * add comments * change to develop Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>

What does this PR do?
Current 2 GitHub actions workflow yml use
pip install [.dev]. This installstransformersin/home/runner/venv/lib/python3.6/site-packages, and this is cached. In future job runs, the cache is restored, and thattransformersversion is used - instead of the latest commit, i.e. we want to use/home/runner/work/transformers/transformers/src.Without this PR, I have trouble after updating
add_new_model.py(to change test model folders fromtests/totests/models/) because theadd_new_model.pyfrom/home/runner/venv/lib/python3.6/site-packageswould be used, which would put the test template models undertests/This PR makes sure the latest
transformersis used by usingpip install -e [.dev], and builds a new cache with it.transformerslocation