Skip to content

Commit

Permalink
docstring changes in tuner (Lightning-AI#6264)
Browse files Browse the repository at this point in the history
* docstring changes in tuner

* added full stop
  • Loading branch information
AlKun25 authored and kaushikb11 committed Mar 2, 2021
1 parent 0f93f58 commit cdb3900
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pytorch_lightning/tuner/auto_gpu_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@


def pick_multiple_gpus(nb):
'''
Raises:
MisconfigurationException:
If ``gpus`` is set to 0, when ``auto_select_gpus=True``.
'''
if nb == 0:
raise MisconfigurationException(
r"auto_select_gpus=True, gpus=0 is not a valid configuration.\
Expand All @@ -33,6 +38,11 @@ def pick_multiple_gpus(nb):


def pick_single_gpu(exclude_gpus: list):
'''
Raises:
RuntimeError:
If you try to allocate a GPU, when no GPUs are available.
'''
for i in range(torch.cuda.device_count()):
if i in exclude_gpus:
continue
Expand Down
7 changes: 7 additions & 0 deletions pytorch_lightning/tuner/batch_size_scaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ def scale_batch_size(
**fit_kwargs: remaining arguments to be passed to .fit(), e.g., dataloader
or datamodule.
Raises:
MisconfigurationException:
If field ``batch_arg_name`` is not found in ``model`` and ``model.hparams``, or
if batch scaling feature is used with dataloaders passed directly to ``.fit()``.
ValueError:
If mode in method ``scale_batch_size`` is neither ``power`` nor ``binsearch``.
"""
if trainer.fast_dev_run:
rank_zero_warn('Skipping batch size scaler since fast_dev_run is enabled.', UserWarning)
Expand Down
4 changes: 4 additions & 0 deletions pytorch_lightning/tuner/lr_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ def lr_find(
update_attr: Whether to update the learning rate attribute or not.
Raises:
MisconfigurationException:
If learning rate/lr in ``model`` or ``model.hparams`` isn't overriden when ``auto_lr_find=True``, or
if you are using `more than one optimizer` with learning rate finder.
Example::
Expand Down

0 comments on commit cdb3900

Please sign in to comment.