Skip to content

[bugfix] Fix the issue that will save the model card if push to hub is not applied in HiDream #11629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions examples/dreambooth/train_dreambooth_lora_hidream.py
Original file line number Diff line number Diff line change
Expand Up @@ -1771,16 +1771,16 @@ def get_sigmas(timesteps, n_dim=4, dtype=torch.float32):
free_memory()

validation_prompt = args.validation_prompt if args.validation_prompt else args.final_validation_prompt
save_model_card(
(args.hub_model_id or Path(args.output_dir).name) if not args.push_to_hub else repo_id,
images=images,
base_model=args.pretrained_model_name_or_path,
instance_prompt=args.instance_prompt,
validation_prompt=validation_prompt,
repo_folder=args.output_dir,
)

if args.push_to_hub:
save_model_card(
(args.hub_model_id or Path(args.output_dir).name) if not args.push_to_hub else repo_id,
images=images,
base_model=args.pretrained_model_name_or_path,
instance_prompt=args.instance_prompt,
validation_prompt=validation_prompt,
repo_folder=args.output_dir,
)
upload_folder(
repo_id=repo_id,
folder_path=args.output_dir,
Expand All @@ -1789,6 +1789,7 @@ def get_sigmas(timesteps, n_dim=4, dtype=torch.float32):
)

images = None
del pipeline

accelerator.end_training()

Expand Down
Loading