Skip to content

Commit

Permalink
move download_checkpoint_from_wandb from engine to runner
Browse files Browse the repository at this point in the history
  • Loading branch information
KuoHaoZeng committed Jul 12, 2024
1 parent 9aedd25 commit 25cbe11
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 0 additions & 8 deletions allenact/algorithms/onpolicy_sync/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1901,14 +1901,6 @@ def train(
# noinspection PyBroadException
try:
if checkpoint_file_name is not None:
if "wandb://" == checkpoint_file_name[:8]:
ckpt_dir = "/tmp/wandb_ckpts"
os.makedirs(ckpt_dir, exist_ok=True)
checkpoint_file_name = download_checkpoint_from_wandb(
checkpoint_file_name,
ckpt_dir,
only_allow_one_ckpt=True
)
self.checkpoint_load(checkpoint_file_name, restart_pipeline)

self.run_pipeline(valid_on_initial_weights=valid_on_initial_weights)
Expand Down
9 changes: 9 additions & 0 deletions allenact/algorithms/onpolicy_sync/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,15 @@ def start_train(

worker_ids = self.local_worker_ids(TRAIN_MODE_STR)

if "wandb://" == checkpoint[:8]:
ckpt_dir = "/tmp/wandb_ckpts"
os.makedirs(ckpt_dir, exist_ok=True)
checkpoint = download_checkpoint_from_wandb(
checkpoint,
ckpt_dir,
only_allow_one_ckpt=True
)

model_hash = None
for trainer_id in worker_ids:
training_kwargs = dict(
Expand Down

0 comments on commit 25cbe11

Please sign in to comment.