lightning/tests
Carlos Mocholí 9cf9ded73b
Simplify data fetching (#11466)
2022-01-17 14:46:55 +00:00
..
accelerators Rename `_distrib_type` to `_strategy_type` (#11328) 2022-01-06 06:32:50 +00:00
benchmarks Update strategy import statements (#11231) 2021-12-23 08:26:28 +01:00
callbacks Fix inconsistent exceptions raised with no `rich` installed (#11360) 2022-01-12 03:55:51 +00:00
checkpointing Update `tests/checkpointing/*.py` to use `devices` instead of `gpus` or `ipus` (#11408) 2022-01-12 05:47:01 +00:00
core Update `tests/core/*.py` to use `devices` instead of `gpus` or `ipus` (#11433) 2022-01-17 18:15:02 +09:00
deprecated_api Add typing to accelerators/gpu.py (#11333) 2022-01-12 19:44:51 +00:00
helpers Remove `hpc_save` (#11101) 2022-01-03 12:23:13 +00:00
lite Update strategy import statements (#11231) 2021-12-23 08:26:28 +01:00
loggers update tests for v2 (#11485) 2022-01-16 21:42:18 +05:30
loops update tests for v2 (#11487) 2022-01-16 21:43:37 +05:30
models Add `LightningModule.lr_scheduler_step` (#10249) 2022-01-12 03:53:49 +00:00
overrides Fix retrieval of batch indices when dataloader num_workers > 0 (#10870) 2021-12-02 10:36:10 +00:00
plugins Add typing to accelerators/gpu.py (#11333) 2022-01-12 19:44:51 +00:00
profiler update tests for v2 (#11486) 2022-01-16 21:43:07 +05:30
strategies Fix restoring lr scheduler states with deepspeed strategy (#11322) 2022-01-06 12:34:16 +00:00
trainer Add `LightningModule.lr_scheduler_step` (#10249) 2022-01-12 03:53:49 +00:00
tuner Prune EvalModelTemplate (1/n) (#10969) 2021-12-07 18:04:06 +00:00
utilities Simplify data fetching (#11466) 2022-01-17 14:46:55 +00:00
README.md CI: add mdformat (#8673) 2021-08-03 18:19:09 +00:00
__init__.py Replace `yapf` with `black` (#7783) 2021-07-26 13:37:35 +02:00
conftest.py Drop Python 3.6 support (#11117) 2021-12-21 17:06:15 +00:00
standalone_tests.sh Fix selection of standalone tests (#10857) 2021-12-01 09:48:37 +01:00

README.md

PyTorch-Lightning Tests

Most PL tests train a full MNIST model under various trainer conditions (ddp, ddp2+amp, etc...). This provides testing for most combinations of important settings. The tests expect the model to perform to a reasonable degree of testing accuracy to pass.

Running tests

git clone https://github.com/PyTorchLightning/pytorch-lightning
cd pytorch-lightning

# install dev deps
pip install -r requirements/devel.txt

# run tests
py.test -v

To test models that require GPU make sure to run the above command on a GPU machine. The GPU machine must have at least 2 GPUs to run distributed tests.

Note that this setup will not run tests that require specific packages installed such as Horovod, FairScale, NVIDIA/apex, NVIDIA/DALI, etc. You can rely on our CI to make sure all these tests pass.

Running Coverage

Make sure to run coverage on a GPU machine with at least 2 GPUs and NVIDIA apex installed.

cd pytorch-lightning

# generate coverage (coverage is also installed as part of dev dependencies under requirements/devel.txt)
coverage run --source pytorch_lightning -m py.test pytorch_lightning tests examples -v

# print coverage stats
coverage report -m

# exporting results
coverage xml

Building test image

You can build it on your own, note it takes lots of time, be prepared.

git clone <git-repository>
docker image build -t pytorch_lightning:devel-torch1.9 -f dockers/cuda-extras/Dockerfile --build-arg TORCH_VERSION=1.9 .

To build other versions, select different Dockerfile.

docker image list
docker run --rm -it pytorch_lightning:devel-torch1.9 bash
docker image rm pytorch_lightning:devel-torch1.9