Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 10, 2021
1 parent d6d6c19 commit 9aee3ac
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pytorch_lightning/core/lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def lr_schedulers(self) -> Optional[Union[Any, List[Any]]]:

# multiple schedulers
return lr_schedulers

@property
def spawn_callback_metrics(self) -> Dict:
return self.trainer.spawn_callback_metrics
Expand Down
8 changes: 5 additions & 3 deletions pytorch_lightning/plugins/training_type/ddp_spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
import logging
import os
from pytorch_lightning.utilities.apply_func import apply_to_collection
import re
from typing import Any, List, Optional, Union

Expand Down Expand Up @@ -293,8 +292,11 @@ def transfer_distrib_spawn_state_on_fit_end(self, results):
self.mp_queue.put(best_model_path)
self.mp_queue.put(last_path)
self.mp_queue.put(results)
self.mp_queue.put(apply_to_collection(self.lightning_module.trainer.logger_connector.callback_metrics,
torch.Tensor, lambda x: x.item()))
self.mp_queue.put(
apply_to_collection(
self.lightning_module.trainer.logger_connector.callback_metrics, torch.Tensor, lambda x: x.item()
)
)

def __recover_child_process_weights(self, best_path, last_path):
# transfer back the best path to the trainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def reset(self, metrics: Optional[bool] = None) -> None:
self._batch_idx = None
self._split_idx = None
self._current_fx = None

@property
def spawn_callback_metrics(self) -> Dict[MetricSource, Dict[str, _METRIC]]:
return self._spawn_callback_metrics
Expand Down
2 changes: 1 addition & 1 deletion pytorch_lightning/trainer/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ def _active_loop(self) -> Optional[Union[TrainLoop, EvaluationLoop]]:
@property
def spawn_callback_metrics(self) -> dict:
return self.logger_connector.spawn_callback_metrics

@spawn_callback_metrics.setter
def spawn_callback_metrics(self, val: dict) -> None:
self.logger_connector.spawn_callback_metrics = val
Expand Down

0 comments on commit 9aee3ac

Please sign in to comment.