Skip to content
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

Deprecate process_position from the Trainer constructor #9222

Merged
merged 5 commits into from
Aug 31, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Deprecate process_position from the Trainer constructor
kaushikb11 committed Aug 31, 2021
commit e343b3574ca3f3e8e89b6accf2a310ab559617ea
7 changes: 7 additions & 0 deletions pytorch_lightning/trainer/connectors/callback_connector.py
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@
from pytorch_lightning.callbacks.timer import Timer
from pytorch_lightning.utilities import rank_zero_info
from pytorch_lightning.utilities.exceptions import MisconfigurationException
from pytorch_lightning.utilities.warnings import rank_zero_deprecation


class CallbackConnector:
@@ -58,6 +59,12 @@ def on_trainer_init(
self._configure_timer_callback(max_time)

# init progress bar
if process_position != 0:
rank_zero_deprecation(
f"Setting `Trainer(process_position={process_position})` is deprecated in v1.5 and will be removed"
" in v1.7. Please pass :class:`~pytorch_lightning.callbacks.progress.ProgressBar` with"
kaushikb11 marked this conversation as resolved.
Show resolved Hide resolved
" ``process_position`` directly to the Trainer's `callbacks` argument instead."
kaushikb11 marked this conversation as resolved.
Show resolved Hide resolved
)
self.trainer._progress_bar_callback = self.configure_progress_bar(progress_bar_refresh_rate, process_position)

# push all checkpoint callbacks to the end
5 changes: 5 additions & 0 deletions pytorch_lightning/trainer/trainer.py
Original file line number Diff line number Diff line change
@@ -247,6 +247,11 @@ def __init__(
process_position: orders the progress bar when running multiple models on same machine.
.. deprecated:: v1.5
``process_position`` has been deprecated in v1.5 and will be removed in v1.7.
Please pass :class:`~pytorch_lightning.callbacks.progress.ProgressBar` with ``process_position``
directly to the Trainer's ``callbacks`` argument instead.
progress_bar_refresh_rate: How often to refresh progress bar (in steps). Value ``0`` disables progress bar.
Ignored when a custom progress bar is passed to :paramref:`~Trainer.callbacks`. Default: None, means
a suitable value will be chosen based on the environment (terminal, Google COLAB, etc.).
5 changes: 5 additions & 0 deletions tests/deprecated_api/test_remove_1-7.py
Original file line number Diff line number Diff line change
@@ -116,3 +116,8 @@ def test_v1_7_0_deprecated_on_train_dataloader(tmpdir):
def test_v1_7_0_test_tube_logger(_, tmpdir):
with pytest.deprecated_call(match="The TestTubeLogger is deprecated since v1.5 and will be removed in v1.7"):
_ = TestTubeLogger(tmpdir)


def test_v1_7_0_process_position_trainer_constructor(tmpdir):
with pytest.deprecated_call(match=r"Setting `Trainer\(process_position=5\)` is deprecated in v1.5"):
_ = Trainer(process_position=5)