-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from huggingface/xrsrke/setup_cicd
Add CI/CD for unit tests
- Loading branch information
Showing
23 changed files
with
517 additions
and
163 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,63 @@ | ||
name: Run non-FA2-related unit tests | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
# Only run tests if we modify the following files | ||
paths: | ||
- "src/**/*.py" | ||
- "examples/**/*.py" | ||
- "tests/**/*.py" | ||
|
||
pull_request: | ||
branches: [ '**' ] | ||
paths: | ||
- "src/**/*.py" | ||
- "examples/**/*.py" | ||
- "tests/**/*.py" | ||
|
||
jobs: | ||
tests: | ||
runs-on: [multi-gpu, nvidia-gpu, 8-t4, ci] | ||
container: | ||
image: runpod/pytorch:2.1.1-py3.10-cuda12.1.1-devel-ubuntu22.04 | ||
ports: | ||
- 80 | ||
options: --gpus all --shm-size "8G" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Python environment | ||
run: | | ||
which python | ||
python --version | ||
- name: Check Pytorch version | ||
run: | | ||
nvidia-smi | ||
python -c "import torch; print('torch:', torch.__version__, torch)" | ||
python -c "import torch; print('CUDA available:', torch.cuda.is_available())" | ||
- name: Instal nanotron | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install packaging | ||
pip install wheel | ||
pip install -e . | ||
pip install -e .[dev] | ||
pip install -e .[test] | ||
- name: Show installed libraries and their versions | ||
run: pip freeze | tee installed.txt | ||
|
||
- name: Run tests | ||
# NOTE: -m "not fa2" will run all the unit tests that don't have the mark | ||
# "fa2" (these are FA2-related tests, we can't run it on T4) | ||
run: | | ||
pytest \ | ||
-m "not fa2" \ | ||
--color=yes \ | ||
--durations=0 \ | ||
--ignore tests/kernels \ | ||
--ignore tests/fp8 \ | ||
--verbose \ | ||
tests/ |
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,26 @@ | ||
name: Code Quality | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ main ] | ||
# Only run tests if we modify the following files | ||
paths: | ||
- "src/**/*.py" | ||
|
||
pull_request: | ||
branches: [ '**' ] | ||
paths: | ||
- "src/**/*.py" | ||
|
||
jobs: | ||
cloc: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Count Lines of Code (cloc) | ||
uses: djdefi/cloc-action@6 | ||
with: | ||
options: --by-file-by-lang --exclude-dir=docs,tests,examples --exclude-lang=YAML,Markdown,TOML --exclude-list-file=sanity_checks.py |
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,58 @@ | ||
name: Run FA2-related unit tests | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ main ] | ||
# Only run tests if we modify the following files | ||
paths: | ||
- "src/**/*.py" | ||
- "examples/**/*.py" | ||
- "tests/**/*.py" | ||
|
||
pull_request: | ||
branches: [ '**' ] | ||
paths: | ||
- "src/**/*.py" | ||
- "examples/**/*.py" | ||
- "tests/**/*.py" | ||
|
||
jobs: | ||
tests: | ||
runs-on: [single-gpu, nvidia-gpu, a10, ci] | ||
container: | ||
image: runpod/pytorch:2.1.1-py3.10-cuda12.1.1-devel-ubuntu22.04 | ||
ports: | ||
- 80 | ||
options: --gpus all --shm-size "8G" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Python environment | ||
run: | | ||
which python | ||
python --version | ||
- name: Check Pytorch version | ||
run: | | ||
nvidia-smi | ||
python -c "import torch; print('torch:', torch.__version__, torch)" | ||
python -c "import torch; print('CUDA available:', torch.cuda.is_available())" | ||
- name: Instal nanotron | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install packaging | ||
pip install wheel | ||
pip install "flash-attn>=2.5.0" --no-build-isolation | ||
pip install -e . | ||
pip install -e .[dev] | ||
pip install -e .[test] | ||
- name: Show installed libraries and their versions | ||
run: pip freeze | tee installed.txt | ||
|
||
- name: Run tests | ||
# NOTE: -m fa2 will only run the unit tests that have the mark | ||
# "fa2" (these are FA2-related tests) | ||
run: pytest -m fa2 --color=yes --durations=0 --ignore tests/fp8 --verbose tests/ |
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 |
---|---|---|
|
@@ -160,6 +160,5 @@ cython_debug/ | |
#.idea/ | ||
|
||
.vscode | ||
.github | ||
|
||
checkpoints/ |
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
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
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
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
Oops, something went wrong.