Release/0.9 (#141)
* add flake8 and prettier to pre-commit-config * add setup.cfg * add workers=True to seed_everything() * update lightning badge logo * bump package versions * update README.md * add __init__.py files * add more logger configs parameters * add default Dockerfile * change .env.template to .env.example * move inference example to readme * remove img_dataset.py * simplify names of wandb callbacks * remove wandb test marker * format files with prettier
This commit is contained in:
1 parent
023d4bdecc
commit
70ab061f75
49 files changed
+473
-415
No files matched your search
@@ -1,3 +0,0 @@
|
||||
def pytest_configure(config):
|
||||
config.addinivalue_line("markers", "slow: Run slow tests.")
|
||||
config.addinivalue_line("markers", "wandb: Run the wandb tests.")
|
||||
@@ -8,8 +8,7 @@ Adapted from:
|
||||
|
||||
|
||||
def _module_available(module_path: str) -> bool:
|
||||
"""
|
||||
Check if a path is available in your environment.
|
||||
"""Check if a path is available in your environment.
|
||||
|
||||
>>> _module_available('os')
|
||||
True
|
||||
|
||||
+9
-17
@@ -11,7 +11,6 @@ Adapted from:
|
||||
https://github.com/PyTorchLightning/pytorch-lightning/blob/master/tests/helpers/runif.py
|
||||
"""
|
||||
|
||||
|
||||
from tests.helpers.module_available import (
|
||||
_APEX_AVAILABLE,
|
||||
_DEEPSPEED_AVAILABLE,
|
||||
@@ -23,12 +22,16 @@ from tests.helpers.module_available import (
|
||||
|
||||
class RunIf:
|
||||
"""
|
||||
RunIf wrapper for simple marking specific cases, fully compatible with pytest.mark::
|
||||
RunIf wrapper for conditional skipping of tests.
|
||||
Fully compatible with `@pytest.mark`.
|
||||
|
||||
@RunIf(min_torch="0.0")
|
||||
@pytest.mark.parametrize("arg1", [1, 2.0])
|
||||
Example:
|
||||
|
||||
@RunIf(min_torch="1.8")
|
||||
@pytest.mark.parametrize("arg1", [1.0, 2.0])
|
||||
def test_wrapper(arg1):
|
||||
assert arg1 > 0.0
|
||||
assert arg1 > 0
|
||||
|
||||
"""
|
||||
|
||||
def __new__(
|
||||
@@ -51,7 +54,7 @@ class RunIf:
|
||||
max_torch: maximum pytorch version to run test
|
||||
min_python: minimum python version required to run test
|
||||
amp_apex: NVIDIA Apex is installed
|
||||
skip_windows: skip test for Windows platform (typically fo some limited torch functionality)
|
||||
skip_windows: skip test for Windows platform
|
||||
rpc: requires Remote Procedure Call (RPC)
|
||||
fairscale: if `fairscale` module is required to run the test
|
||||
deepspeed: if `deepspeed` module is required to run the test
|
||||
@@ -107,14 +110,3 @@ class RunIf:
|
||||
reason=f"Requires: [{' + '.join(reasons)}]",
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
||||
@RunIf(min_torch="99")
|
||||
def test_always_skip():
|
||||
exit(1)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("arg1", [0.5, 1.0, 2.0])
|
||||
@RunIf(min_torch="0.0")
|
||||
def test_wrapper(arg1: float):
|
||||
assert arg1 > 0.0
|
||||
File renamed without changes.
@@ -1,3 +1,5 @@
|
||||
import pytest
|
||||
|
||||
from tests.helpers.run_command import run_command
|
||||
from tests.helpers.runif import RunIf
|
||||
|
||||
@@ -26,6 +28,7 @@ def test_default_gpu():
|
||||
run_command(command)
|
||||
|
||||
|
||||
@pytest.mark.slow
|
||||
def test_experiments():
|
||||
"""Train 1 epoch with all experiment configs."""
|
||||
command = ["run.py", "-m", "experiment=glob(*)", "trainer.max_epochs=1"]
|
||||
File renamed without changes.
File renamed without changes.
@@ -3,12 +3,12 @@ import pytest
|
||||
from tests.helpers.run_command import run_command
|
||||
|
||||
"""
|
||||
Use the following command to skip wandb tests:
|
||||
pytest -k "not wandb"
|
||||
Use the following command to skip slow tests:
|
||||
pytest -k "not slow"
|
||||
"""
|
||||
|
||||
|
||||
# @pytest.mark.wandb
|
||||
# @pytest.mark.slow
|
||||
# def test_wandb_optuna_sweep():
|
||||
# """Test wandb logging with Optuna sweep."""
|
||||
# command = [
|
||||
@@ -26,7 +26,7 @@ Use the following command to skip wandb tests:
|
||||
# run_command(command)
|
||||
|
||||
|
||||
# @pytest.mark.wandb
|
||||
# @pytest.mark.slow
|
||||
# def test_wandb_callbacks():
|
||||
# """Test wandb callbacks."""
|
||||
# command = [
|
||||
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user