-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add responsibleai-text package tests to build gate
- Loading branch information
1 parent
32408d5
commit d191295
Showing
3 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
name: CI ResponsibleAI-Text pytest | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
paths: | ||
- "responsibleai_text/**" | ||
- ".github/workflows/CI-responsibleai-text-pytest.yml" | ||
|
||
jobs: | ||
ci-python: | ||
strategy: | ||
matrix: | ||
packageDirectory: ["responsibleai_text"] | ||
operatingSystem: [ubuntu-latest, macos-latest, windows-latest] | ||
pythonVersion: ["3.7", "3.8", "3.9", "3.10"] | ||
exclude: | ||
- packageDirectory: "responsibleai_text" | ||
operatingSystem: macos-latest | ||
pythonVersion: 3.8 | ||
runs-on: ${{ matrix.operatingSystem }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
auto-update-conda: true | ||
python-version: ${{ matrix.pythonVersion }} | ||
|
||
- if: ${{ matrix.operatingSystem != 'macos-latest' }} | ||
name: Install pytorch on non-MacOS | ||
shell: bash -l {0} | ||
run: | | ||
conda install --yes --quiet pytorch torchvision captum cpuonly -c pytorch | ||
- if: ${{ matrix.operatingSystem == 'macos-latest' }} | ||
name: Install Anaconda packages on MacOS, which should not include cpuonly according to official docs | ||
shell: bash -l {0} | ||
run: | | ||
conda install --yes --quiet pytorch torchvision captum -c pytorch | ||
- name: Setup tools | ||
shell: bash -l {0} | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --upgrade setuptools | ||
pip install --upgrade "pip-tools<=6.13.0" | ||
- name: Install dependencies | ||
shell: bash -l {0} | ||
run: | | ||
pip install -r requirements-dev.txt | ||
pip install . | ||
working-directory: ${{ matrix.packageDirectory }} | ||
|
||
- name: Setup spacy | ||
shell: bash -l {0} | ||
run: | | ||
python -m spacy download en_core_web_sm | ||
- name: Install package | ||
shell: bash -l {0} | ||
run: | | ||
pip install -v -e . | ||
working-directory: ${{ matrix.packageDirectory }} | ||
|
||
- name: Run tests | ||
shell: bash -l {0} | ||
run: | | ||
pytest -s -v --durations=10 --doctest-modules --junitxml=junit/test-results.xml --cov=${{ matrix.packageDirectory }} --cov-report=xml --cov-report=html | ||
working-directory: ${{ matrix.packageDirectory }} | ||
|
||
- name: Upload code coverage results | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.packageDirectory }}-code-coverage-results | ||
path: ${{ matrix.packageDirectory }}/htmlcov | ||
# Use always() to always run this step to publish test results when there are test failures | ||
if: ${{ always() }} | ||
|
||
- if: ${{ (matrix.operatingSystem == 'windows-latest') && (matrix.pythonVersion == '3.8') }} | ||
name: Upload to codecov | ||
id: codecovupload1 | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
directory: ${{ matrix.packageDirectory }} | ||
env_vars: OS,PYTHON | ||
fail_ci_if_error: false | ||
files: ./${{ matrix.packageDirectory }}/coverage.xml | ||
flags: unittests | ||
name: codecov-umbrella | ||
verbose: true | ||
|
||
- if: ${{ (steps.codecovupload1.outcome == 'failure') && (matrix.pythonVersion == '3.8') && (matrix.operatingSystem == 'windows-latest') }} | ||
name: Retry upload to codecov | ||
id: codecovupload2 | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
directory: ${{ matrix.packageDirectory }} | ||
env_vars: OS,PYTHON | ||
fail_ci_if_error: false | ||
files: ./${{ matrix.packageDirectory }}/coverage.xml | ||
flags: unittests | ||
name: codecov-umbrella | ||
verbose: true | ||
|
||
- name: Set codecov status | ||
if: ${{ (matrix.pythonVersion == '3.8') && (matrix.operatingSystem == 'windows-latest') }} | ||
shell: bash | ||
run: | | ||
if ${{ (steps.codecovupload1.outcome == 'success') || (steps.codecovupload2.outcome == 'success') }} ; then | ||
echo fine | ||
else | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Responsible AI Text SDK for Python | ||
|
||
### This package has been tested with Python 3.6, 3.7, 3.8 and 3.9 | ||
|
||
The Responsible AI Text sdk enables users to analyze their machine learning models for text data in one API. Users will be able to analyze errors, explain the most important features, and understand their data using a single API. | ||
|
||
Highlights of the package include: | ||
|
||
- `explainer.add()` explains the model | ||
|
||
### Supported scenarios, models and datasets | ||
|
||
The Responsible AI Text SDK supports multiclass classification and question answering models on text data currently. | ||
|
||
The open source code for the visualization dashboard can be found here: | ||
https://github.com/microsoft/responsible-ai-toolbox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
pytest==7.0.1 | ||
pytest-cov | ||
pytest-mock==3.6.1 | ||
|
||
requirements-parser==0.2.0 | ||
|
||
transformers | ||
datasets | ||
tensorflow<2.11.0 | ||
opencv-python | ||
|
||
fastai | ||
mlflow |