Skip to content

Commit

Permalink
change default output path for aim run export
Browse files Browse the repository at this point in the history
Signed-off-by: Dushyant Behl <[email protected]>
  • Loading branch information
dushyantbehl committed Feb 23, 2024
1 parent a28aa7b commit 4bbe5d3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
19 changes: 14 additions & 5 deletions tuning/tracker/aimstack_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class CustomAimCallback(AimCallback):

# A path to export run hash generated by Aim
# This is used to link back to the expriments from outside aimstack
aim_run_hash_export_path = None
run_hash_export_path = None

def on_init_end(self, args, state, control, **kwargs):

Expand All @@ -20,9 +20,18 @@ def on_init_end(self, args, state, control, **kwargs):

self.setup() # initializes the run_hash

# store the run hash
if self.aim_run_hash_export_path:
with open(self.aim_run_hash_export_path, 'w') as f:
# Store the run hash
# Change default run hash path to output directory
if self.run_hash_export_path is None:
if args and args.output_dir:
# args.output_dir/.aim_run_hash
self.run_hash_export_path = os.path.join(
args.output_dir,
'.aim_run_hash'
)

if self.run_hash_export_path:
with open(self.run_hash_export_path, 'w') as f:
f.write('{\"run_hash\":\"'+str(self._run.hash)+'\"}\n')

def on_train_begin(self, args, state, control, model=None, **kwargs):
Expand Down Expand Up @@ -60,7 +69,7 @@ def get_hf_callback(self):
else:
aim_callback = CustomAimCallback(experiment=exp)

aim_callback.aim_run_hash_export_path = hash_export_path
aim_callback.run_hash_export_path = hash_export_path
self.hf_callback = aim_callback
return self.hf_callback

Expand Down
3 changes: 2 additions & 1 deletion tuning/tracker/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ def __init__(self, name=None, tracker_config=None) -> None:
else:
self._name = name

def get_hf_callback():
# we use args here to denote any argument.
def get_hf_callback(self):
return None

def track(self, metric, name, stage):
Expand Down

0 comments on commit 4bbe5d3

Please sign in to comment.