Cytrex commited on
Commit
6a5efbf
·
verified ·
1 Parent(s): 78128f3

Fix: unbuffered stdout compat with Python 3.11

Browse files
scripts/hf_job_selfdistill_train.py CHANGED
@@ -60,8 +60,9 @@ GEN_BATCH = int(os.environ.get("GEN_BATCH", "8"))
60
  GEN_MAX_TOKENS = int(os.environ.get("GEN_MAX_TOKENS", "2048"))
61
 
62
  import sys as _sys
 
63
  # Force unbuffered output so HF job logs stream in real-time
64
- if not _sys.flags.unbuffered:
65
  import io
66
  _sys.stdout = io.TextIOWrapper(open(_sys.stdout.fileno(), 'wb', 0), write_through=True)
67
  _sys.stderr = io.TextIOWrapper(open(_sys.stderr.fileno(), 'wb', 0), write_through=True)
 
60
  GEN_MAX_TOKENS = int(os.environ.get("GEN_MAX_TOKENS", "2048"))
61
 
62
  import sys as _sys
63
+ import os as _os
64
  # Force unbuffered output so HF job logs stream in real-time
65
+ if _os.environ.get("PYTHONUNBUFFERED") or True:
66
  import io
67
  _sys.stdout = io.TextIOWrapper(open(_sys.stdout.fileno(), 'wb', 0), write_through=True)
68
  _sys.stderr = io.TextIOWrapper(open(_sys.stderr.fileno(), 'wb', 0), write_through=True)