Skip to content

Commit 0f4d8d0

Browse files
committed
Fix AttributeError in onnxruntime train_unconditional
The ORT example `examples/research_projects/onnxruntime/unconditional_image_generation/train_unconditional.py` defines `--logger` (argparse line 196) but references `args.report_to` in two places: * Line 280: `if args.report_to == "wandb" and args.hub_token is not None:` * Line 294: `log_with=args.report_to,` Since there is no `--report_to` flag on the parser, both references crash with `AttributeError: 'Namespace' object has no attribute 'report_to'` as soon as `main()` starts — the script cannot run at all. The sibling non-ORT script `examples/unconditional_image_generation/train_unconditional.py` uses `args.logger` consistently; this PR aligns the ORT variant with that behavior, and updates the error message to refer to `--logger=wandb` instead of the non-existent `--report_to=wandb`.
1 parent c8c8401 commit 0f4d8d0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

examples/research_projects/onnxruntime/unconditional_image_generation/train_unconditional.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,9 @@ def parse_args():
277277

278278

279279
def main(args):
280-
if args.report_to == "wandb" and args.hub_token is not None:
280+
if args.logger == "wandb" and args.hub_token is not None:
281281
raise ValueError(
282-
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
282+
"You cannot use both --logger=wandb and --hub_token due to a security risk of exposing your token."
283283
" Please use `hf auth login` to authenticate with the Hub."
284284
)
285285

@@ -291,7 +291,7 @@ def main(args):
291291
accelerator = Accelerator(
292292
gradient_accumulation_steps=args.gradient_accumulation_steps,
293293
mixed_precision=args.mixed_precision,
294-
log_with=args.report_to,
294+
log_with=args.logger,
295295
project_config=accelerator_project_config,
296296
)
297297

0 commit comments

Comments
 (0)