Skip to content

Commit

Permalink
Add pre-test step in cross version tests (mlflow#11430)
Browse files Browse the repository at this point in the history
Signed-off-by: harupy <[email protected]>
  • Loading branch information
harupy authored Mar 15, 2024
1 parent 7c274d1 commit abe9ce2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/cross-version-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ jobs:
- name: Check package versions
run: |
python dev/show_package_release_dates.py
- name: Prefetch Transformer models
if: matrix.package == 'transformers' && matrix.category == 'models'
- name: Pre-test
if: matrix.pre_test
run: |
python tests/transformers/helper.py
${{ matrix.pre_test }}
- uses: ./.github/actions/pipdeptree
- name: Run tests
env:
Expand Down
6 changes: 5 additions & 1 deletion dev/set_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class TestConfig(BaseModel):
java: t.Optional[t.Dict[str, str]] = None
run: str
allow_unreleased_max_version: t.Optional[bool] = None
pre_test: t.Optional[str] = None

class Config:
arbitrary_types_allowed = True
Expand Down Expand Up @@ -102,6 +103,7 @@ class MatrixItem(BaseModel):
java: str
supported: bool
free_disk_space: bool
pre_test: t.Optional[str] = None

class Config:
arbitrary_types_allowed = True
Expand Down Expand Up @@ -379,6 +381,7 @@ def expand_config(config):
java=java,
supported=ver <= cfg.maximum,
free_disk_space=free_disk_space,
pre_test=cfg.pre_test,
)
)

Expand Down Expand Up @@ -406,6 +409,7 @@ def expand_config(config):
java=java,
supported=False,
free_disk_space=free_disk_space,
pre_test=cfg.pre_test,
)
)
return matrix
Expand Down Expand Up @@ -461,7 +465,7 @@ def generate_matrix(args):
class CustomEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, MatrixItem):
return dict(o)
return o.model_dump(exclude_none=True)
elif isinstance(o, Version):
return str(o)
return super().default(o)
Expand Down
2 changes: 2 additions & 0 deletions mlflow/ml-package-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,8 @@ transformers:
# prior to 4.30.0 are incompatible with this breaking change in Keras.
# See: https://github.com/huggingface/transformers/issues/23352 for discussion
"< 4.30.0": ["tensorflow<2.13.0"]
pre_test: |
python tests/transformers/helper.py
run: |
# Run all Transformers tests except autologging
pytest tests/transformers --ignore tests/transformers/test_transformers_autolog.py
Expand Down

0 comments on commit abe9ce2

Please sign in to comment.