Skip to content

Fix wrong indent for examples of controlnet script #11632

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

Merged
merged 1 commit into from
May 29, 2025
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions examples/controlnet/train_controlnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ def log_validation(
else:
logger.warning(f"image logging not implemented for {tracker.name}")

del pipeline
gc.collect()
torch.cuda.empty_cache()
del pipeline
gc.collect()
torch.cuda.empty_cache()

return image_logs
return image_logs


def import_model_class_from_model_name_or_path(pretrained_model_name_or_path: str, revision: str):
Expand Down
6 changes: 3 additions & 3 deletions examples/controlnet/train_controlnet_flux.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ def log_validation(
else:
logger.warning(f"image logging not implemented for {tracker.name}")

del pipeline
free_memory()
return image_logs
del pipeline
free_memory()
return image_logs


def save_model_card(repo_id: str, image_logs=None, base_model=str, repo_folder=None):
Expand Down
10 changes: 5 additions & 5 deletions examples/controlnet/train_controlnet_sd3.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,13 @@ def log_validation(controlnet, args, accelerator, weight_dtype, step, is_final_v
else:
logger.warning(f"image logging not implemented for {tracker.name}")

del pipeline
free_memory()
del pipeline
free_memory()

if not is_final_validation:
controlnet.to(accelerator.device)
if not is_final_validation:
controlnet.to(accelerator.device)

return image_logs
return image_logs


# Copied from dreambooth sd3 example
Expand Down
8 changes: 4 additions & 4 deletions examples/controlnet/train_controlnet_sdxl.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,11 @@ def log_validation(vae, unet, controlnet, args, accelerator, weight_dtype, step,
else:
logger.warning(f"image logging not implemented for {tracker.name}")

del pipeline
gc.collect()
torch.cuda.empty_cache()
del pipeline
gc.collect()
torch.cuda.empty_cache()

return image_logs
return image_logs


def import_model_class_from_model_name_or_path(
Expand Down