-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Fix Python PostCommit Dependency #37725
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
base: master
Are you sure you want to change the base?
Changes from all commits
590684f
417922c
81fe00c
d64c214
0f805b5
cd821e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,6 +109,7 @@ deps = | |
| pip==25.0.1 | ||
| accelerate>=1.6.0 | ||
| onnx<1.19.0 | ||
| pip_pre = False | ||
| setenv = | ||
| extras = test,gcp,dataframe,ml_test | ||
| commands = | ||
|
|
@@ -512,16 +513,16 @@ commands = | |
| # Allow exit code 5 (no tests run) so that we can run this command safely on arbitrary subdirectories. | ||
| /bin/sh -c 'pytest -o junit_suite_name={envname} --junitxml=pytest_{envname}.xml -n 6 -m uses_xgboost {posargs}; ret=$?; [ $ret = 5 ] && exit 0 || exit $ret' | ||
|
|
||
| [testenv:py{310,311}-transformers-{428,447,448,latest}] | ||
| [testenv:py{310,311}-transformers-{428,447,latest}] | ||
| deps = | ||
| # Environment dependencies are defined in the `setenv` section and installed in the `commands` section. | ||
| extras = test,gcp,ml_test | ||
| pip_pre = False | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what happens if we don't do this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it keeps tox from installing pre release versions of dependencies which tends to make the test environments more stable
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that is true; but the point of using are test environments unstable because pip cannot resolve dependencies or for some other reasons (pre-release deps have bugs, etc.)?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if using
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes mostly it was pip having trouble resolving things when pre releases happening as i saw installs fail or get flaky so i turned it off to make CI more stable |
||
| extras = test | ||
| setenv = | ||
| COMMON_DEPS = tensorflow==2.12.0 protobuf==4.25.5 pip==25.0.1 | ||
| # sentence-transformers 2.2.2 is the latest version that supports transformers 4.28.x | ||
| 428: DEPS = sentence-transformers==2.2.2 'transformers>=4.28.0,<4.29.0' 'torch>=1.9.0,<1.14.0' | ||
| 447: DEPS = 'transformers>=4.47.0,<4.48.0' 'torch>=1.9.0,<1.14.0' | ||
| 455: DEPS = 'transformers>=4.55.0,<4.56.0' 'torch>=2.0.0,<2.1.0' | ||
| latest: DEPS = 'transformers>=4.55.0' 'torch>=2.0.0' 'accelerate>=1.6.0' | ||
| commands = | ||
| /bin/sh -c "pip install .[{extras}] {env:DEPS} {env:COMMON_DEPS}" | ||
|
|
||
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.
Note that adding
vertex_ai_postcommit would make these tests run on Dataflow, instead of Beam direct runner:
beam/sdks/python/test-suites/dataflow/common.gradle
Line 500 in 3197d88
Was that your intent?
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.
yes that is intentional as these vertex AI tests are integration tests and kept it to run in the dataflow vertexAIInferenceTest suite rather than the standard DirectRunner unit test jobs and the vertex_ai_postcommit marker makes sure the dataflow gradle task collects them and at the same time local runs can skip them by markers if needed.
Uh oh!
There was an error while loading. Please reload this page.
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.
ok, we typically name dataflow tests as _it_test (integration test) in the file name, in this case I'd suggest we also rename this file to vertex_ai_it_test.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.
for example, in this particular case: we already import
i would then ask - why do we also need to try to import vertexai -- doesn't a successful import of
from vertexai.vision_models import Imagealready imply that vertexai is importable?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.
okay sure i will rename it
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.
ahh the decorator runs at collection time and only checks if the sdk is there at all so the test file’s imports run when the test runs and are for the specific stuff that test needs soo the skip is one generic check as the test file does its own imports for the APIs it uses