mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-13 12:50:26 +08:00
fix defecation warnings (#570)
* fix defecation warnings * flake8 * update deprecations
This commit is contained in:
committed by
William Falcon
parent
3a58937d8b
commit
ab4fea0b55
@@ -814,15 +814,6 @@ class LightningModule(GradInformation, ModelIO, ModelHooks):
|
||||
|
||||
return splits
|
||||
|
||||
@data_loader
|
||||
def tng_dataloader(self):
|
||||
"""
|
||||
Implement a PyTorch DataLoader
|
||||
* Deprecated in v0.5.0. use train_dataloader instead. *
|
||||
:return:
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@data_loader
|
||||
def train_dataloader(self):
|
||||
"""Implement a PyTorch DataLoader
|
||||
@@ -851,7 +842,14 @@ class LightningModule(GradInformation, ModelIO, ModelHooks):
|
||||
|
||||
|
||||
"""
|
||||
#
|
||||
raise NotImplementedError
|
||||
|
||||
@data_loader
|
||||
def tng_dataloader(self):
|
||||
"""Implement a PyTorch DataLoader.
|
||||
|
||||
.. warning:: Deprecated in v0.5.0. use train_dataloader instead.
|
||||
"""
|
||||
try:
|
||||
output = self.tng_dataloader()
|
||||
warnings.warn("`tng_dataloader` has been renamed to `train_dataloader` since v0.5.0"
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
"""
|
||||
.. warning:: `model_saving` module has been renamed to `saving` since v0.5.3 and will be removed in v0.8.0
|
||||
"""
|
||||
|
||||
import warnings
|
||||
|
||||
warnings.warn("`model_saving` module has been renamed to `saving` since v0.5.3"
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
"""
|
||||
.. warning:: `root_module` module has been renamed to `lightning` since v0.5.3 and will be removed in v0.8.0
|
||||
"""
|
||||
|
||||
import warnings
|
||||
|
||||
warnings.warn("`root_module` module has been renamed to `lightning` since v0.5.3"
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
"""
|
||||
.. warning:: `comet_logger` module has been renamed to `comet` since v0.5.3 and will be removed in v0.8.0
|
||||
"""
|
||||
|
||||
import warnings
|
||||
|
||||
warnings.warn("`comet_logger` module has been renamed to `comet` since v0.5.3"
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
"""
|
||||
.. warning:: `mlflow_logger` module has been renamed to `mlflow` since v0.5.3 and will be removed in v0.8.0
|
||||
"""
|
||||
|
||||
import warnings
|
||||
|
||||
warnings.warn("`mlflow_logger` module has been renamed to `mlflow` since v0.5.3"
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
"""
|
||||
.. warning:: `test_tube_logger` module has been renamed to `test_tube` since v0.5.3 and will be removed in v0.8.0
|
||||
"""
|
||||
|
||||
import warnings
|
||||
|
||||
warnings.warn("`test_tube_logger` module has been renamed to `test_tube` since v0.5.3"
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
"""
|
||||
.. warning:: `override_data_parallel` module has been renamed to `data_parallel` since v0.5.3
|
||||
and will be removed in v0.8.0
|
||||
"""
|
||||
|
||||
import warnings
|
||||
|
||||
warnings.warn("`override_data_parallel` module has been renamed to `data_parallel` since v0.5.3"
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
"""
|
||||
.. warning:: `pt_overrides` package has been renamed to `overrides` since v0.5.3 and will be removed in v0.8.0
|
||||
"""
|
||||
|
||||
import warnings
|
||||
|
||||
warnings.warn("`pt_overrides` package has been renamed to `overrides` since v0.5.3"
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
"""
|
||||
.. warning:: `root_module` package has been renamed to `core` since v0.5.3 and will be removed in v0.8.0
|
||||
"""
|
||||
|
||||
import warnings
|
||||
|
||||
warnings.warn("`root_module` package has been renamed to `core` since v0.5.3"
|
||||
|
||||
@@ -260,11 +260,12 @@ class Trainer(TrainerIOMixin,
|
||||
# logging
|
||||
self.log_save_interval = log_save_interval
|
||||
self.val_check_interval = val_check_interval
|
||||
if not (add_row_log_interval is None):
|
||||
if add_row_log_interval is not None:
|
||||
# backward compatibility
|
||||
warnings.warn("`gradient_clip` has renamed to `gradient_clip_val` since v0.5.0"
|
||||
warnings.warn("`add_row_log_interval` has renamed to `row_log_interval` since v0.5.0"
|
||||
" and will be removed in v0.8.0", DeprecationWarning)
|
||||
row_log_interval = add_row_log_interval
|
||||
if not row_log_interval: # in case you did not set the proper value
|
||||
row_log_interval = add_row_log_interval
|
||||
self.row_log_interval = row_log_interval
|
||||
|
||||
# how much of the data to use
|
||||
@@ -288,9 +289,10 @@ class Trainer(TrainerIOMixin,
|
||||
return job_id
|
||||
|
||||
def __parse_gpu_ids(self, gpus):
|
||||
"""
|
||||
:param gpus: Int, string or list of ids
|
||||
:return:
|
||||
"""Parse GPUs id.
|
||||
|
||||
:param list|str|int gpus: input GPU ids
|
||||
:return list(int):
|
||||
"""
|
||||
# if gpus = -1 then use all available devices
|
||||
# otherwise, split the string using commas
|
||||
@@ -334,8 +336,7 @@ class Trainer(TrainerIOMixin,
|
||||
|
||||
@property
|
||||
def training_tqdm_dict(self):
|
||||
"""
|
||||
Read-only for tqdm metrics
|
||||
"""Read-only for tqdm metrics.
|
||||
:return:
|
||||
"""
|
||||
tqdm_dict = {
|
||||
@@ -358,10 +359,12 @@ class Trainer(TrainerIOMixin,
|
||||
|
||||
@property
|
||||
def tng_tqdm_dic(self):
|
||||
"""*Deprecated in v0.5.0. use training_tqdm_dict instead.*
|
||||
"""Read-only for tqdm metrics.
|
||||
|
||||
.. warning:: Deprecated in v0.5.0. use training_tqdm_dict instead.
|
||||
:return:
|
||||
"""
|
||||
warnings.warn("`tng_tqdm_dict` has renamed to `training_tqdm_dict` since v0.5.0"
|
||||
warnings.warn("`tng_tqdm_dic` has renamed to `training_tqdm_dict` since v0.5.0"
|
||||
" and will be removed in v0.8.0", DeprecationWarning)
|
||||
return self.training_tqdm_dict
|
||||
|
||||
@@ -393,8 +396,7 @@ class Trainer(TrainerIOMixin,
|
||||
else:
|
||||
# run through amp wrapper
|
||||
if self.use_amp:
|
||||
raise MisconfigurationException('amp + cpu is not supported.'
|
||||
' Please use a GPU option')
|
||||
raise MisconfigurationException('amp + cpu is not supported. Please use a GPU option')
|
||||
|
||||
# CHOOSE OPTIMIZER
|
||||
# allow for lr schedulers as well
|
||||
|
||||
Reference in New Issue
Block a user