-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* cli examples * ddp * CI * CI * req * tests * skip DDP Co-authored-by: William Falcon <[email protected]>
- Loading branch information
1 parent
6673fc9
commit 4e13e41
Showing
6 changed files
with
108 additions
and
80 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
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
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,47 @@ | ||
from unittest import mock | ||
|
||
import pytest | ||
import torch | ||
|
||
|
||
@pytest.mark.parametrize('cli_args', ['--max_epochs 1 --max_steps 3']) | ||
def test_cpu_template(cli_args): | ||
"""Test running CLI for an example with default params.""" | ||
from pl_examples.basic_examples.cpu_template import run_cli | ||
|
||
cli_args = cli_args.split(' ') if cli_args else [] | ||
with mock.patch("argparse._sys.argv", ["any.py"] + cli_args): | ||
run_cli() | ||
|
||
|
||
@pytest.mark.parametrize('cli_args', ['--max_epochs 1 --max_steps 3']) | ||
@pytest.mark.skipif(not torch.cuda.is_available(), reason="test requires GPU machine") | ||
def test_gpu_template(cli_args): | ||
"""Test running CLI for an example with default params.""" | ||
from pl_examples.basic_examples.gpu_template import run_cli | ||
|
||
cli_args = cli_args.split(' ') if cli_args else [] | ||
with mock.patch("argparse._sys.argv", ["any.py"] + cli_args): | ||
run_cli() | ||
|
||
|
||
# @pytest.mark.parametrize('cli_args', ['--max_epochs 1 --max_steps 3 --num_nodes 1 --gpus 2']) | ||
# @pytest.mark.skipif(torch.cuda.device_count() < 2, reason="test requires multi-GPU machine") | ||
# def test_multi_node_ddp(cli_args): | ||
# """Test running CLI for an example with default params.""" | ||
# from pl_examples.basic_examples.multi_node_ddp_demo import run_cli | ||
# | ||
# cli_args = cli_args.split(' ') if cli_args else [] | ||
# with mock.patch("argparse._sys.argv", ["any.py"] + cli_args): | ||
# run_cli() | ||
|
||
|
||
# @pytest.mark.parametrize('cli_args', ['--max_epochs 1 --max_steps 3 --num_nodes 1 --gpus 2']) | ||
# @pytest.mark.skipif(torch.cuda.device_count() < 2, reason="test requires multi-GPU machine") | ||
# def test_multi_node_ddp2(cli_args): | ||
# """Test running CLI for an example with default params.""" | ||
# from pl_examples.basic_examples.multi_node_ddp2_demo import run_cli | ||
# | ||
# cli_args = cli_args.split(' ') if cli_args else [] | ||
# with mock.patch("argparse._sys.argv", ["any.py"] + cli_args): | ||
# run_cli() |