Skip to content

Commit

Permalink
Functional tests for MNIST (#87)
Browse files Browse the repository at this point in the history
* ADD: use case tests

* FIX: move use case models out of itwinai

* FIX: rearrange modules

* ADD: ConsoleLogger and LoggersCollection

* FIX: loggers filter

* FIX: add TF env creation

* UPDATE: test flag

* ADD: early pytest on slurm

* FIX: duplicated code in TF Trainer
  • Loading branch information
matbun authored Oct 18, 2023
1 parent 4bdde4e commit 1cd81a6
Show file tree
Hide file tree
Showing 59 changed files with 374 additions and 640 deletions.
2 changes: 1 addition & 1 deletion .github/linters/.jscpd.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"threshold": 2.0,
"ignore": [
"**/itwinai/backend/loggers.py"
"**/itwinai/loggers.py"
]
}
6 changes: 5 additions & 1 deletion .github/workflows/workflows-dt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ jobs:
shell: bash -l {0}
run: make torch-cpu

- name: Make tensorflow env
shell: bash -l {0}
run: make tf-2.13

- name: Install dev version
shell: bash -l {0}
run: micromamba run -p ./.venv-pytorch pip install .[dev]

- name: Run pytest for workflows
shell: bash -l {0}
run: micromamba run -p ./.venv-pytorch pytest -v ./tests/ -m "not distributed"
run: micromamba run -p ./.venv-pytorch pytest -v ./tests/ -m "not slurm"

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TODO
data
/data
nohup*
lightning_logs
mlruns
Expand Down
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,25 @@ adding the `dev` extra:
pip install -e .[dev]
```

To **run tests** on itwinai package:
#### Test with `pytest`

To run tests on itwinai package:

```bash
# Activate env
micromamba activate ./.venv-pytorch # or ./.venv-tf

pytest -v tests/
pytest -v -m "not slurm" tests/
```

However, some tests are intended to be executed only on an HPC system,
where SLURM is available. They are marked with "slurm" tag. To run also
those tests, use the dedicated job script:

```bash
sbatch tests/slurm_tests_startscript

# Upon completion, check the output:
cat job.err
cat job.out
```
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,6 @@ itwinai = "itwinai.cli:app"
[tool.pytest.ini_options]
markers = [
"integration: integration tests (deselect with '-m \"not integration\"')",
"distributed: test distributed ML on multiple GPUs/nodes (deselect with '-m \"not distributed\"')",
"slurm: needs SLURM and HPC resources (multiple GPUs/nodes). (deselect with '-m \"not slurm\"')",
"functional: functional tests. (deselect with '-m \"not functional\"')",
]
24 changes: 0 additions & 24 deletions src/itwinai/backend/torch/_utils.py

This file was deleted.

13 changes: 0 additions & 13 deletions src/itwinai/backend/utils.py

This file was deleted.

Loading

0 comments on commit 1cd81a6

Please sign in to comment.