2020from lightning_utilities .core .imports import RequirementCache
2121from torch import Tensor
2222from torch .nn import Module
23+ from typing_extensions import override
2324
2425from lightning .fabric .loggers .logger import Logger , rank_zero_experiment
2526from lightning .fabric .utilities .cloud_io import _is_dir , get_filesystem
@@ -109,6 +110,7 @@ def __init__(
109110 self ._kwargs = kwargs
110111
111112 @property
113+ @override
112114 def name (self ) -> str :
113115 """Get the name of the experiment.
114116
@@ -119,6 +121,7 @@ def name(self) -> str:
119121 return self ._name
120122
121123 @property
124+ @override
122125 def version (self ) -> Union [int , str ]:
123126 """Get the experiment version.
124127
@@ -131,6 +134,7 @@ def version(self) -> Union[int, str]:
131134 return self ._version
132135
133136 @property
137+ @override
134138 def root_dir (self ) -> str :
135139 """Gets the save directory where the TensorBoard experiments are saved.
136140
@@ -141,6 +145,7 @@ def root_dir(self) -> str:
141145 return self ._root_dir
142146
143147 @property
148+ @override
144149 def log_dir (self ) -> str :
145150 """The directory for this run's tensorboard checkpoint.
146151
@@ -191,6 +196,7 @@ def experiment(self) -> "SummaryWriter":
191196 self ._experiment = SummaryWriter (log_dir = self .log_dir , ** self ._kwargs )
192197 return self ._experiment
193198
199+ @override
194200 @rank_zero_only
195201 def log_metrics (self , metrics : Mapping [str , float ], step : Optional [int ] = None ) -> None :
196202 assert rank_zero_only .rank == 0 , "experiment tried to log from global_rank != 0"
@@ -212,6 +218,7 @@ def log_metrics(self, metrics: Mapping[str, float], step: Optional[int] = None)
212218 f"\n you tried to log { v } which is currently not supported. Try a dict or a scalar/tensor."
213219 ) from ex
214220
221+ @override
215222 @rank_zero_only
216223 def log_hyperparams ( # type: ignore[override]
217224 self , params : Union [Dict [str , Any ], Namespace ], metrics : Optional [Dict [str , Any ]] = None
@@ -251,6 +258,7 @@ def log_hyperparams( # type: ignore[override]
251258 writer .add_summary (ssi )
252259 writer .add_summary (sei )
253260
261+ @override
254262 @rank_zero_only
255263 def log_graph (self , model : Module , input_array : Optional [Tensor ] = None ) -> None :
256264 model_example_input = getattr (model , "example_input_array" , None )
@@ -278,10 +286,12 @@ def log_graph(self, model: Module, input_array: Optional[Tensor] = None) -> None
278286 else :
279287 self .experiment .add_graph (model , input_array )
280288
289+ @override
281290 @rank_zero_only
282291 def save (self ) -> None :
283292 self .experiment .flush ()
284293
294+ @override
285295 @rank_zero_only
286296 def finalize (self , status : str ) -> None :
287297 if self ._experiment is not None :
0 commit comments