diff --git a/pytorch_lightning/profiler/profilers.py b/pytorch_lightning/profiler/profilers.py index bc9e3541dbaa8..78327fa0a91d8 100644 --- a/pytorch_lightning/profiler/profilers.py +++ b/pytorch_lightning/profiler/profilers.py @@ -148,7 +148,9 @@ def describe(self) -> None: # so to avoid them, we open and close the files within this function # by calling `_prepare_streams` and `teardown` self._prepare_streams() - self._write_stream(self.summary()) + summary = self.summary() + if summary: + self._write_stream(summary) if self._output_file is not None: self._output_file.flush() self.teardown(stage=self._stage)