Skip to content

Commit 7a1f1c8

Browse files
Alexander SnorkinAlexander Snorkin
authored andcommitted
Progress Callback fixes
1 parent a4f09ad commit 7a1f1c8

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
@@ -142,11 +145,11 @@ def enable(self):
142145
"""
143146
raise NotImplementedError
144147

145-
def print(self, *args):
148+
def print(self, *args, **kwargs):
146149
"""
147150
You should provide a way to print without breaking the progress bar.
148151
"""
149-
raise NotImplementedError
152+
print(*args, **kwargs)
150153

151154
def on_init_end(self, trainer):
152155
self._trainer = trainer
@@ -379,7 +382,14 @@ def on_test_end(self, trainer, pl_module):
379382
super().on_test_end(trainer, pl_module)
380383
self.test_progress_bar.close()
381384

382-
def print(self, *args, sep=' ', end='\n', file=None, nolock=False):
385+
def print(
386+
self,
387+
*args,
388+
sep: str = ' ',
389+
end: str = os.linesep,
390+
file: Optional[io.TextIOBase] = None,
391+
nolock: bool = False
392+
):
383393
active_progress_bar = None
384394

385395
if not self.main_progress_bar.disable:

0 commit comments

Comments
 (0)