Skip to content

remove InternalDebugger #9680

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

Merged
merged 17 commits into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from 16 commits
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
2 changes: 0 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,6 @@ def test_explain_what_is_being_tested(tmpdir):
Test description about text reason to be
"""

# os.environ["PL_DEV_DEBUG"] = '1' # [OPTIONAL] When activated, you can use internal trainer.dev_debugger

class ExtendedModel(BoringModel):
...

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Removed deprecated properties `DeepSpeedPlugin.cpu_offload*` in favor of `offload_optimizer`, `offload_parameters` and `pin_memory` ([#9244](https://github.com/PyTorchLightning/pytorch-lightning/pull/9244))


- Removed `pytorch_lightning.utilities.debugging.InternalDebugger` ([#9680](https://github.com/PyTorchLightning/pytorch-lightning/pull/9680))


### Fixed


Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ module = [
"pytorch_lightning.utilities.argparse",
"pytorch_lightning.utilities.cli",
"pytorch_lightning.utilities.cloud_io",
"pytorch_lightning.utilities.debugging",
"pytorch_lightning.utilities.device_dtype_mixin",
"pytorch_lightning.utilities.device_parser",
"pytorch_lightning.utilities.distributed",
Expand Down
8 changes: 0 additions & 8 deletions pytorch_lightning/trainer/data_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
FastForwardSampler,
)
from pytorch_lightning.utilities.data import has_iterable_dataset, has_len
from pytorch_lightning.utilities.debugging import InternalDebugger
from pytorch_lightning.utilities.exceptions import MisconfigurationException
from pytorch_lightning.utilities.imports import _fault_tolerant_training
from pytorch_lightning.utilities.model_helpers import is_overridden
Expand All @@ -64,7 +63,6 @@ class TrainerDataLoadingMixin(ABC):
distributed_sampler_kwargs: dict
accelerator: Accelerator
accelerator_connector: AcceleratorConnector
dev_debugger: InternalDebugger
call_hook: Callable

def _worker_check(self, dataloader: DataLoader, name: str) -> None:
Expand Down Expand Up @@ -304,9 +302,6 @@ def reset_train_dataloader(self, model: Optional["pl.LightningModule"] = None) -
self.train_dataloader, SequentialSampler(self.train_dataloader.dataset), mode=RunningStage.TRAINING
)

# debugging
self.dev_debugger.track_load_dataloader_call("train_dataloader", dataloaders=[self.train_dataloader])

# automatically add samplers
self.train_dataloader = apply_to_collection(
self.train_dataloader, DataLoader, self.auto_add_sampler, shuffle=True, mode=RunningStage.TRAINING
Expand Down Expand Up @@ -385,7 +380,6 @@ def _reset_eval_dataloader(
assert mode.evaluating or mode == RunningStage.PREDICTING

# always get the loaders first so we can count how many there are
loader_name = f"{mode.dataloader_prefix}_dataloader"
dataloaders = self.request_dataloader(mode, model=model)

if not isinstance(dataloaders, list):
Expand All @@ -397,8 +391,6 @@ def _reset_eval_dataloader(
train_dataloader = self.request_dataloader(RunningStage.TRAINING, model=model)
dataloaders = [deepcopy(train_dataloader) for _ in range(len(dataloaders))]

self.dev_debugger.track_load_dataloader_call(loader_name, dataloaders=dataloaders)

for loader_i in range(len(dataloaders)):
loader = dataloaders[loader_i]

Expand Down
2 changes: 0 additions & 2 deletions pytorch_lightning/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
parse_env_variables,
)
from pytorch_lightning.utilities.cloud_io import get_filesystem
from pytorch_lightning.utilities.debugging import InternalDebugger
from pytorch_lightning.utilities.distributed import distributed_available
from pytorch_lightning.utilities.exceptions import MisconfigurationException
from pytorch_lightning.utilities.imports import _fault_tolerant_training
Expand Down Expand Up @@ -379,7 +378,6 @@ def __init__(
gpu_ids, tpu_cores = self._parse_devices(gpus, auto_select_gpus, tpu_cores)

# init connectors
self.dev_debugger = InternalDebugger(self)
self.config_validator = ConfigValidator(self)
self.data_connector = DataConnector(self, multiple_trainloader_mode)
self.optimizer_connector = OptimizerConnector(self)
Expand Down
78 changes: 0 additions & 78 deletions pytorch_lightning/utilities/debugging.py

This file was deleted.

21 changes: 15 additions & 6 deletions tests/deprecated_api/test_remove_1-6.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Test deprecated functionality which will be removed in v1.6.0."""
from unittest.mock import Mock, call

import pytest

from pytorch_lightning import Trainer
Expand Down Expand Up @@ -89,9 +91,17 @@ def test_v1_6_0_ddp_spawn_sync_batchnorm():


def test_v1_6_0_reload_dataloaders_every_epoch(tmpdir):

model = BoringModel()

tracker = Mock()
model.train_dataloader = Mock(wraps=model.train_dataloader)
model.val_dataloader = Mock(wraps=model.val_dataloader)
model.test_dataloader = Mock(wraps=model.test_dataloader)

tracker.attach_mock(model.train_dataloader, "train_dataloader")
tracker.attach_mock(model.val_dataloader, "val_dataloader")
tracker.attach_mock(model.test_dataloader, "test_dataloader")

with pytest.deprecated_call(match="`reload_dataloaders_every_epoch` is deprecated in v1.4 and will be removed"):
trainer = Trainer(
default_root_dir=tmpdir,
Expand All @@ -103,11 +113,10 @@ def test_v1_6_0_reload_dataloaders_every_epoch(tmpdir):
trainer.fit(model)
trainer.test()

# verify the sequence
calls = trainer.dev_debugger.dataloader_sequence_calls
expected_sequence = ["val_dataloader"] + ["train_dataloader", "val_dataloader"] * 3 + ["test_dataloader"]
for call, expected in zip(calls, expected_sequence):
assert call["name"] == expected
expected_sequence = (
[call.val_dataloader()] + [call.train_dataloader(), call.val_dataloader()] * 3 + [call.test_dataloader()]
)
assert tracker.mock_calls == expected_sequence


def test_v1_6_0_tbptt_reduce_fx(tmpdir):
Expand Down
Loading