Loading fairseq/progress_bar.py +4 −6 Changes for fairseq/progress_bar.py: 4 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ class json_progress_bar(progress_bar): self.log_interval is not None and i % self.log_interval == 0: update = self.epoch + float(i / size) if self.epoch is not None else None stats = self._format_stats(self.stats, epoch=self.epoch, update=update) print("sweep_log: " + json.dumps(stats)) print("sweep_log: " + json.dumps(stats), flush=True) def log(self, stats): """Log intermediate stats according to log_interval.""" Loading @@ -99,7 +99,7 @@ class json_progress_bar(progress_bar): def print(self, stats): """Print end-of-epoch stats.""" stats = self._format_stats(self.stats, epoch=self.epoch) print("sweep_log: " + json.dumps(stats)) print("sweep_log: " + json.dumps(stats), flush=True) def _format_stats(self, stats, epoch=None, update=None): postfix = OrderedDict() Loading Loading @@ -152,8 +152,7 @@ class simple_progress_bar(progress_bar): if self.stats is not None and i > 0 and \ self.log_interval is not None and i % self.log_interval == 0: postfix = self._str_commas(self.stats) print(f'{self.prefix}: {i:5d} / {size:d} {postfix}') sys.stdout.flush() print(f'{self.prefix}: {i:5d} / {size:d} {postfix}', flush=True) def log(self, stats): """Log intermediate stats according to log_interval.""" Loading @@ -162,8 +161,7 @@ class simple_progress_bar(progress_bar): def print(self, stats): """Print end-of-epoch stats.""" postfix = self._str_pipes(self._format_stats(stats)) print(f'{self.prefix} | {postfix}') sys.stdout.flush() print(f'{self.prefix} | {postfix}', flush=True) class tqdm_progress_bar(progress_bar): Loading Loading
fairseq/progress_bar.py +4 −6 Changes for fairseq/progress_bar.py: 4 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ class json_progress_bar(progress_bar): self.log_interval is not None and i % self.log_interval == 0: update = self.epoch + float(i / size) if self.epoch is not None else None stats = self._format_stats(self.stats, epoch=self.epoch, update=update) print("sweep_log: " + json.dumps(stats)) print("sweep_log: " + json.dumps(stats), flush=True) def log(self, stats): """Log intermediate stats according to log_interval.""" Loading @@ -99,7 +99,7 @@ class json_progress_bar(progress_bar): def print(self, stats): """Print end-of-epoch stats.""" stats = self._format_stats(self.stats, epoch=self.epoch) print("sweep_log: " + json.dumps(stats)) print("sweep_log: " + json.dumps(stats), flush=True) def _format_stats(self, stats, epoch=None, update=None): postfix = OrderedDict() Loading Loading @@ -152,8 +152,7 @@ class simple_progress_bar(progress_bar): if self.stats is not None and i > 0 and \ self.log_interval is not None and i % self.log_interval == 0: postfix = self._str_commas(self.stats) print(f'{self.prefix}: {i:5d} / {size:d} {postfix}') sys.stdout.flush() print(f'{self.prefix}: {i:5d} / {size:d} {postfix}', flush=True) def log(self, stats): """Log intermediate stats according to log_interval.""" Loading @@ -162,8 +161,7 @@ class simple_progress_bar(progress_bar): def print(self, stats): """Print end-of-epoch stats.""" postfix = self._str_pipes(self._format_stats(stats)) print(f'{self.prefix} | {postfix}') sys.stdout.flush() print(f'{self.prefix} | {postfix}', flush=True) class tqdm_progress_bar(progress_bar): Loading