-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate tests to pytest + add GA (#127)
Co-authored-by: Eitan Turok <[email protected]>
- Loading branch information
1 parent
790d046
commit 1ae7703
Showing
34 changed files
with
1,640 additions
and
1,171 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,45 @@ | ||
name: PR GPU tests | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- release/* | ||
pull_request_target: | ||
branches: | ||
- main | ||
- release/** | ||
workflow_dispatch: | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: ${{ github.ref != 'refs/heads/main'}} | ||
jobs: | ||
pytest-gpu: | ||
name: ${{ matrix.name }} | ||
runs-on: linux-ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- name: "python3.11-pytorch2.3.1-gpus1" | ||
gpu_num: 1 | ||
python_version: 3.11 | ||
container: mosaicml/pytorch:2.3.1_cu121-python3.11-ubuntu20.04 | ||
- name: "python3.11-pytorch2.3.1-gpus2" | ||
gpu_num: 2 | ||
python_version: 3.11 | ||
container: mosaicml/pytorch:2.3.1_cu121-python3.11-ubuntu20.04 | ||
steps: | ||
- name: Run PR GPU tests | ||
uses: mosaicml/ci-testing/.github/actions/[email protected] | ||
with: | ||
name: ${{ matrix.name }} | ||
container: ${{ matrix.container }} | ||
python_version: ${{ matrix.python_version }} | ||
gpu_num: ${{ matrix.gpu_num }} | ||
git_repo: databricks/megablocks | ||
pip_deps: "[all,testing]" | ||
pytest_command: "coverage run -m pytest tests" # todo: remove tests from pytest tests when we delete all tests outside of MegaBlocks repo | ||
pytest_markers: "gpu" | ||
composer_package_name: mosaicml # Required as Composer is built from source | ||
mcloud_timeout: 3600 | ||
mcloud_api_key: ${{ secrets.MCLOUD_API_KEY }} |
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 |
---|---|---|
@@ -1,8 +1,165 @@ | ||
*~ | ||
gpt2-merges.txt | ||
gpt2-vocab.json | ||
core | ||
__pycache__ | ||
*.egg-info | ||
dist | ||
build | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
docs/path/ | ||
docs/source/_build/ | ||
docs/source/api_reference/ | ||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# Virtual Env | ||
venv/ | ||
|
||
# WandB | ||
wandb/ | ||
|
||
# Neptune | ||
.neptune/ | ||
|
||
# Spacemacs | ||
._#* | ||
.#* | ||
.vscode/ | ||
|
||
# Vim | ||
*.swp | ||
|
||
# README backups | ||
README.md.bkp | ||
|
||
# OS X | ||
.DS_Store | ||
|
||
# Sphinx | ||
api_reference/ | ||
|
||
# Node (for pyright) | ||
node_modules/ | ||
package.json | ||
package-lock.json | ||
|
||
# pycharm | ||
.idea/ |
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 |
---|---|---|
@@ -1,11 +1,23 @@ | ||
clean: | ||
rm -rf dist/* | ||
# several pytest settings | ||
WORLD_SIZE ?= 1 # world size for launcher tests | ||
MASTER_PORT ?= 26000 # port for distributed tests | ||
PYTHON ?= python3 # Python command | ||
PYTEST ?= pytest # Pytest command | ||
PYRIGHT ?= pyright # Pyright command. Pyright must be installed seperately -- e.g. `node install -g pyright` | ||
EXTRA_ARGS ?= # extra arguments for pytest | ||
EXTRA_LAUNCHER_ARGS ?= # extra arguments for the composer cli launcher | ||
|
||
dist: clean | ||
python3 setup.py sdist | ||
test: | ||
LOCAL_WORLD_SIZE=1 $(PYTHON) -m $(PYTEST) $(EXTRA_ARGS) | ||
|
||
upload: dist | ||
twine upload dist/* | ||
test-gpu: | ||
LOCAL_WORLD_SIZE=1 $(PYTHON) -m $(PYTEST) -m gpu $(EXTRA_ARGS) | ||
|
||
upload-test: dist | ||
twine upload --repository-url https://test.pypi.org/legacy/ dist/* | ||
# runs tests with the launcher | ||
test-dist: | ||
$(PYTHON) -m composer.cli.launcher -n $(WORLD_SIZE) --master_port $(MASTER_PORT) $(EXTRA_LAUNCHER_ARGS) -m $(PYTEST) $(EXTRA_ARGS) | ||
|
||
test-dist-gpu: | ||
$(PYTHON) -m composer.cli.launcher -n $(WORLD_SIZE) --master_port $(MASTER_PORT) $(EXTRA_LAUNCHER_ARGS) -m $(PYTEST) -m gpu $(EXTRA_ARGS) | ||
|
||
.PHONY: test test-gpu test-dist test-dist-gpu |
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.