Skip to content

Commit

Permalink
Fix errors of AttributeError: 'str' object has no attribute 'stdout' (#…
Browse files Browse the repository at this point in the history
…826)

* Update train_bert.py

Fix errors of stdout

* Update train_bert.py

fix errors of stdout

---------

Co-authored-by: Michael Wyatt <[email protected]>
  • Loading branch information
mlzoo and mrwyattii authored Feb 1, 2024
1 parent 6863634 commit 19e0efb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions training/HelloDeepSpeed/train_bert.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def create_experiment_dir(checkpoint_dir: pathlib.Path,
try:
gitlog = sh.git.log("-1", format="%H", _tty_out=False, _fg=False)
with (exp_dir / "githash.log").open("w") as handle:
handle.write(gitlog.stdout.decode("utf-8"))
handle.write(gitlog)
except sh.ErrorReturnCode_128:
logger.info("Seems like the code is not running from"
" within a git repo, so hash will"
Expand All @@ -476,7 +476,7 @@ def create_experiment_dir(checkpoint_dir: pathlib.Path,
try:
gitdiff = sh.git.diff(_fg=False, _tty_out=False)
with (exp_dir / "gitdiff.log").open("w") as handle:
handle.write(gitdiff.stdout.decode("utf-8"))
handle.write(gitdiff)
except sh.ErrorReturnCode_129:
logger.info("Seems like the code is not running from"
" within a git repo, so diff will"
Expand Down

0 comments on commit 19e0efb

Please sign in to comment.