-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make gpus=str in Trainer consistent with command line parsing of string #6388
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
819a087
string gpu input
awaelchli c5f3893
update docs
awaelchli 875e472
deprecation warning
awaelchli 02850ed
Revert "update docs"
awaelchli a994daf
deprecation
awaelchli 7d9bb44
add changelog
awaelchli 84cae6b
update parser
awaelchli b41e5a6
update warning
awaelchli 623feb3
Merge branch 'master' into bugfix/str-gpu
awaelchli 318b97c
Merge branch 'master' into bugfix/str-gpu
awaelchli 975aab7
implement v1.5 behavior ahead of time
awaelchli 08a3ba8
formatting
awaelchli 76b927a
set accelerator in test to avoid different warning
awaelchli ca603ba
Merge branch 'master' into bugfix/str-gpu
awaelchli eac3926
add warning
awaelchli 50b13ba
remove todo warn
awaelchli b420d9e
Update pytorch_lightning/utilities/device_parser.py
awaelchli 16196fd
Merge branch 'master' into bugfix/str-gpu
Borda 99b81a3
resolve flake8
tchaton fe4f636
clarify int in message
awaelchli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
import operator | ||
from collections import namedtuple | ||
from unittest.mock import patch | ||
|
||
|
@@ -22,12 +23,14 @@ | |
from pytorch_lightning import Trainer | ||
from pytorch_lightning.utilities import device_parser | ||
from pytorch_lightning.utilities.exceptions import MisconfigurationException | ||
from pytorch_lightning.utilities.imports import _compare_version | ||
from tests.helpers import BoringModel | ||
from tests.helpers.datamodules import ClassifDataModule | ||
from tests.helpers.imports import Batch, Dataset, Example, Field, LabelField | ||
from tests.helpers.runif import RunIf | ||
from tests.helpers.simple_models import ClassificationModel | ||
|
||
PL_VERSION_LT_1_5 = _compare_version("pytorch_lightning", operator.lt, "1.5") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice ! |
||
PRETEND_N_OF_GPUS = 16 | ||
|
||
|
||
|
@@ -171,8 +174,8 @@ def test_determine_root_gpu_device(gpus, expected_root_gpu): | |
pytest.param([0], [0]), | ||
pytest.param([1, 3], [1, 3]), | ||
pytest.param((1, 3), [1, 3]), | ||
pytest.param('0', [0]), | ||
pytest.param('3', [3]), | ||
pytest.param('0', None, marks=pytest.mark.skipif(PL_VERSION_LT_1_5, reason="available from v1.5")), | ||
pytest.param('3', [0, 1, 2], marks=pytest.mark.skipif(PL_VERSION_LT_1_5, reason="available from v1.5")), | ||
pytest.param('1, 3', [1, 3]), | ||
pytest.param('2,', [2]), | ||
carmocca marked this conversation as resolved.
Show resolved
Hide resolved
|
||
pytest.param('-1', list(range(PRETEND_N_OF_GPUS)), id="'-1' - use all gpus"), | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we announcing a change in 2 versions ahead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you saying one version is enough? I followed deprecation guideline of two versions.