Skip to content

Commit

Permalink
wandb disabled command can cause error upon start
Browse files Browse the repository at this point in the history
  • Loading branch information
bghira committed Jan 18, 2025
1 parent bd5ace5 commit 641b134
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions helpers/training/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1648,18 +1648,32 @@ def init_trackers(self):
tracker_run_name = (
self.config.tracker_run_name or "simpletuner-training-run"
)
self.accelerator.init_trackers(
project_name,
config=vars(public_args),
init_kwargs={
"wandb": {
"name": tracker_run_name,
"id": f"{public_args_hash}",
"resume": "allow",
"allow_val_change": True,
}
},
)
try:
self.accelerator.init_trackers(
project_name,
config=vars(public_args),
init_kwargs={
"wandb": {
"name": tracker_run_name,
"id": f"{public_args_hash}",
"resume": "allow",
"allow_val_change": True,
}
},
)
except Exception as e:
if "Object has no attribute 'disabled'" in repr(e):
logger.warning(
"WandB is disabled, and Accelerate was not quite happy about it."
)
else:
logger.error(f"Could not initialize trackers: {e}")
self._send_webhook_raw(
structured_data={
"message": f"Could not initialize trackers. Continuing without. {e}"
},
message_type="error",
)
self._send_webhook_raw(
structured_data=public_args.__dict__,
message_type="training_config",
Expand Down

0 comments on commit 641b134

Please sign in to comment.