Make ConsoleLogger flush after each logging line (#8810)

This is necessary to avoid "logging blackouts" when running training on Kubernetes pods
This commit is contained in:
themrmax 2021-08-02 05:33:38 -07:00 committed by GitHub
parent 30f20496d5
commit de076194c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,7 +29,7 @@ def console_logger(progress_bar: bool = False):
def setup_printer(
nlp: "Language", stdout: IO = sys.stdout, stderr: IO = sys.stderr
) -> Tuple[Callable[[Optional[Dict[str, Any]]], None], Callable[[], None]]:
write = lambda text: stdout.write(f"{text}\n")
write = lambda text: print(text, file=stdout, flush=True)
msg = Printer(no_print=True)
# ensure that only trainable components are logged
logged_pipes = [