Skip to content

Commit

Permalink
Fix type checker issue with explicit cast of ref_model object (#4457)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeff Yang <[email protected]>
(cherry picked from commit 6211fd4)
  • Loading branch information
SeanNaren authored and Borda committed Nov 4, 2020
1 parent 1efcb87 commit ea10c9c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pytorch_lightning/trainer/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import os
from abc import ABC
from argparse import ArgumentParser, Namespace
from typing import List, Optional, Union, Type, TypeVar
from typing import List, Optional, Union, Type, TypeVar, cast

from pytorch_lightning.callbacks import Callback, ProgressBarBase, ModelCheckpoint
from pytorch_lightning.core.lightning import LightningModule
Expand Down Expand Up @@ -154,6 +154,7 @@ def progress_bar_callback(self):
def progress_bar_dict(self) -> dict:
""" Read-only for progress bar metrics. """
ref_model = self.model if not self.data_parallel else self.model.module
ref_model = cast(LightningModule, ref_model)
return dict(**ref_model.get_progress_bar_dict(), **self.logger_connector.progress_bar_metrics)

@property
Expand Down

0 comments on commit ea10c9c

Please sign in to comment.