callback for optimizer (#99)

This commit is contained in:
evonneng authored and GitHub committed 2022-05-23 08:57:27 -07:00
1 parent 9df71ae4f3
commit 985560eace
5 files changed
+36 -18

No files matched your search

+6 -3
View File
@@ -320,15 +320,18 @@ class LocalWriter(Writer):
def _update_header(self, latest_map, new_key):
"""helper to handle the printing of the header labels"""
if (not self.max_log_size and len(self.past_mssgs) == 0) or (
self.max_log_size and (len(self.past_mssgs) == 0 or new_key)
):
full_log_cond = not self.max_log_size and GLOBAL_BUFFER["step"] <= GLOBAL_BUFFER["steps_per_log"]
capped_log_cond = self.max_log_size and (len(self.past_mssgs) <= 2 or new_key)
if full_log_cond or capped_log_cond:
mssg = f"{'Step (% Done)':<20}"
for name, _ in latest_map.items():
if name in self.stats_to_track:
mssg += f"{name:<20} "
self.past_mssgs[0] = mssg
self.past_mssgs[1] = "-" * len(mssg)
if full_log_cond:
print(mssg)
print("-" * len(mssg))
def _print_stats(self, latest_map, padding=" "):
"""helper to print out the stats in a readable format"""