Fix AttributeError in train_t2i_adapter_sdxl checkpoint resume#13521
Open
Ricardo-M-L wants to merge 1 commit intohuggingface:mainfrom
Open
Fix AttributeError in train_t2i_adapter_sdxl checkpoint resume#13521Ricardo-M-L wants to merge 1 commit intohuggingface:mainfrom
Ricardo-M-L wants to merge 1 commit intohuggingface:mainfrom
Conversation
`load_model_hook` gates `model.register_to_config(**load_model.config)`
behind `args.control_type != "style"`, but `--control_type` is not
defined as an argparse argument anywhere in this script, so resuming
from a checkpoint (any `--resume_from_checkpoint ...`) crashes with:
AttributeError: 'Namespace' object has no attribute 'control_type'
The gate appears to be a leftover from a controlnet variant that
differentiated style adapters. T2IAdapter training here has no such
distinction, and the analogous `train_controlnet_sdxl.py` hook always
calls `register_to_config` unconditionally. Drop the broken gate so
checkpoint resume works.
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 does this PR do?
Fixes a latent
AttributeErrorinexamples/t2i_adapter/train_t2i_adapter_sdxl.pythat breaks--resume_from_checkpoint.The accelerate
load_model_hookreferencesargs.control_type, which is never declared as a CLI argument in this script:So any resume (
accelerator.load_state(...)triggered by--resume_from_checkpoint) crashes with:The
args.control_type != "style"gate looks like a copy-paste leftover from a controlnet variant that distinguished style adapters. This T2IAdapter training script has no such distinction, and the analogous hook inexamples/controlnet/train_controlnet_sdxl.pycallsregister_to_configunconditionally. Dropping the broken gate aligns with that script and makes resume work.Fix
Before submitting
Who can review?
@sayakpaul