Skip to content

Commit

Permalink
Merge branch 'master' into feature/python_3_10_numpy_1_25
Browse files Browse the repository at this point in the history
  • Loading branch information
sarthakpati authored Nov 11, 2023
2 parents 2369753 + 13abd55 commit 74be0da
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions GANDLF/utils/modelio.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,14 @@ def save_model(
model_dict["parameters"] = params

try:
# this will try to encode the git hash of the current GaNDLF codebase, and reverts to "None" if not found
model_dict["git_hash"] = (
subprocess.check_output(["git", "rev-parse", "HEAD"])
subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=os.getcwd())
.decode("ascii")
.strip()
)
except subprocess.CalledProcessError:
model_dict["git_hash"] = None
except (subprocess.CalledProcessError, FileNotFoundError):
model_dict["git_hash"] = "None"

torch.save(model_dict, path)

Expand Down

0 comments on commit 74be0da

Please sign in to comment.