-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Initialize CI for code quality and testing #256
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
Changes from 5 commits
610a65e
c03d666
2cb3a34
4033c0f
422d26a
96549f1
5ac7659
323672e
25d3b66
6e70c20
726afc6
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Run code quality checks | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
check_code_quality: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.7" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install .[quality] | ||
- name: Check quality | ||
run: | | ||
black --check --preview examples tests src utils scripts | ||
isort --check-only examples tests src utils scripts | ||
flake8 examples tests src utils scripts | ||
doc-builder style src/diffusers docs/source --max_len 119 --check_only --path_to_docs docs/source | ||
anton-l marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Run non-slow tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
HF_HOME: /mnt/cache | ||
OMP_NUM_THREADS: 8 | ||
MKL_NUM_THREADS: 8 | ||
PYTEST_TIMEOUT: 60 | ||
|
||
jobs: | ||
run_tests_single_gpu: | ||
anton-l marked this conversation as resolved.
Show resolved
Hide resolved
|
||
name: Diffusers tests | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
machine_type: [ single-gpu ] | ||
runs-on: [ self-hosted, docker-gpu, '${{ matrix.machine_type }}' ] | ||
container: | ||
image: nvcr.io/nvidia/pytorch:22.07-py3 | ||
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. wonder whether it might be easier to here just use 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. Or maybe even easier we define a It's also arguably a bit easier to debug, e.g. I could just ssh into it, do pip installs instead of having to pull a docker and then having to work in the docker shell 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. But no expert here, just wonder if 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. Also maybe I'd set up a new CPU machine (they're cheap) so that we can easier disentangle CPU and GPU? 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. Agreed, let's start with a bare minimum "python:3.7" image and set up the frameworks on top for better environment control. Will test it now 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. Ok, I take that back, our cloud network speeds are crazy fast, will use 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. I guess 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, correct |
||
options: --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/ | ||
|
||
steps: | ||
- name: Checkout diffusers | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install -e .[quality,test] | ||
|
||
- name: Run all non-slow selected tests on CPU | ||
run: | | ||
python -m pytest -n 2 --max-worker-restart=0 --dist=loadfile -s | ||
anton-l marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Run all tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
HF_HOME: /mnt/cache | ||
OMP_NUM_THREADS: 8 | ||
MKL_NUM_THREADS: 8 | ||
PYTEST_TIMEOUT: 180 | ||
anton-l marked this conversation as resolved.
Show resolved
Hide resolved
|
||
RUN_SLOW: yes | ||
|
||
jobs: | ||
run_tests_single_gpu: | ||
name: Diffusers tests | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
machine_type: [ single-gpu ] | ||
runs-on: [ self-hosted, docker-gpu, '${{ matrix.machine_type }}' ] | ||
container: | ||
image: nvcr.io/nvidia/pytorch:22.07-py3 | ||
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. Do you know which PyTorch version this is? Couldn't really find it here: https://catalog.ngc.nvidia.com/orgs/nvidia/containers/pytorch 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.
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. I think Yeah PyTorch 1.13 is nightly-build or from source so I think PyTorch 1.12 would be the better choice here. In Transformers we automatically update the docker, but I think this is a bit too much here for now. Maybe let's better just do it manually in the beginning. 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. In |
||
options: --gpus 0 --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/ | ||
|
||
steps: | ||
- name: Checkout diffusers | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: NVIDIA-SMI | ||
run: | | ||
nvidia-smi | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install -e .[quality,test] | ||
python -m pip install scipy transformers | ||
|
||
- name: Run all (incl. slow) tests on GPU | ||
run: | | ||
python -m pytest -n 2 --max-worker-restart=0 --dist=loadfile -s | ||
anton-l marked this conversation as resolved.
Show resolved
Hide resolved
|
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.