Skip to content

Commit c7db564

Browse files
Alexander SnorkinAlexander Snorkin
authored andcommitted
Progress Callback fixes
1 parent d4bd0a7 commit c7db564

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

pytorch_lightning/callbacks/progress.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
2121
"""
2222
import importlib
23+
import io
24+
import os
2325
import sys
26+
from typing import Optional
2427

2528
# check if ipywidgets is installed before importing tqdm.auto
2629
# to ensure it won't fail and a progress bar is displayed
@@ -150,11 +153,11 @@ def print(self, *args):
150153
"""
151154
raise NotImplementedError
152155

153-
def print(self, *args):
156+
def print(self, *args, **kwargs):
154157
"""
155158
You should provide a way to print without breaking the progress bar.
156159
"""
157-
raise NotImplementedError
160+
print(*args, **kwargs)
158161

159162
def on_init_end(self, trainer):
160163
self._trainer = trainer
@@ -388,7 +391,14 @@ def on_test_end(self, trainer, pl_module):
388391
super().on_test_end(trainer, pl_module)
389392
self.test_progress_bar.close()
390393

391-
def print(self, *args, sep=' ', end='\n', file=None, nolock=False):
394+
def print(
395+
self,
396+
*args,
397+
sep: str = ' ',
398+
end: str = os.linesep,
399+
file: Optional[io.TextIOBase] = None,
400+
nolock: bool = False
401+
):
392402
active_progress_bar = None
393403

394404
if not self.main_progress_bar.disable:

0 commit comments

Comments
 (0)