Fix AttributeError in textual_inversion_bf16 by adding --report_to arg#13528
Open
Ricardo-M-L wants to merge 1 commit intohuggingface:mainfrom
Open
Fix AttributeError in textual_inversion_bf16 by adding --report_to arg#13528Ricardo-M-L wants to merge 1 commit intohuggingface:mainfrom
Ricardo-M-L wants to merge 1 commit intohuggingface:mainfrom
Conversation
`examples/research_projects/intel_opts/textual_inversion/textual_inversion_bf16.py`
reads `args.report_to` twice at the start of `main()`:
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(...)
...
accelerator = Accelerator(..., log_with=args.report_to, ...)
but `--report_to` is never defined on the parser, so any invocation of
the script raises
AttributeError: 'Namespace' object has no attribute 'report_to'
immediately, before any training setup. The script is non-functional
as shipped — it cannot even be run.
The canonical `examples/textual_inversion/textual_inversion.py`
defines this exact argument (default="tensorboard") with the standard
help text. Port that `add_argument` call over so the bf16 variant can
actually run. Value and default match the canonical script for parity.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
The Intel/BF16
textual_inversion_bf16.pyscript readsargs.report_toat the top ofmain():https://github.com/huggingface/diffusers/blob/main/examples/research_projects/intel_opts/textual_inversion/textual_inversion_bf16.py#L366-L378
But
--report_tois never defined on the parser (checked viagrep 'add_argument' textual_inversion_bf16.py). Any invocation of the script therefore crashes immediately with:Why this is a real bug
The check fires at the start of
main(), before any training setup — the script is non-runnable as shipped.Fix
The canonical
examples/textual_inversion/textual_inversion.pyalready defines this exact argument with default"tensorboard"and the standard help text. Mirror that definition in the bf16 variant:Value and default match the canonical script, keeping behavior consistent across the two scripts.
Before submitting
Who can review?
@sayakpaul