feat(hpc): include git hash in run_name for traceability
This commit is contained in:
parent
bd06feea5f
commit
0aeff0f2da
1 changed files with 9 additions and 1 deletions
10
src/train.py
10
src/train.py
|
|
@ -1,4 +1,5 @@
|
||||||
import random
|
import random
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from dataclasses import asdict
|
from dataclasses import asdict
|
||||||
|
|
@ -43,7 +44,14 @@ def train(args: PPOArgs):
|
||||||
args.batch_size = args.num_envs * args.num_steps
|
args.batch_size = args.num_envs * args.num_steps
|
||||||
args.minibatch_size = args.batch_size // args.num_minibatches
|
args.minibatch_size = args.batch_size // args.num_minibatches
|
||||||
args.num_iterations = args.total_timesteps // args.batch_size
|
args.num_iterations = args.total_timesteps // args.batch_size
|
||||||
run_name = f"{args.exp_name}__seed_{args.seed}__{int(time.time())}"
|
|
||||||
|
# Try to get git short hash
|
||||||
|
try:
|
||||||
|
git_hash = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]).decode("ascii").strip()
|
||||||
|
except Exception:
|
||||||
|
git_hash = "none"
|
||||||
|
|
||||||
|
run_name = f"{args.exp_name}__seed_{args.seed}__{git_hash}__{int(time.time())}"
|
||||||
print(f"running name: {run_name}")
|
print(f"running name: {run_name}")
|
||||||
|
|
||||||
if args.run_dir is None:
|
if args.run_dir is None:
|
||||||
|
|
|
||||||
Reference in a new issue