Skip to content

Commit 506b9ca

Browse files
committed
fix formatting
1 parent fc71c8a commit 506b9ca

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

examples/research_projects/lpl/__init__.py

Whitespace-only changes.

examples/research_projects/lpl/lpl_loss.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright 2025 Berrada et al.
2+
13
import numpy as np
24
import torch
35
import torch.nn as nn
@@ -186,4 +188,4 @@ def get_first_layer(self, input, target, target_layer="conv"):
186188

187189
feat_in, feat_tar = cross_normalize(feat_in, feat_tar)
188190

189-
return F.mse_loss(feat_in, feat_tar, reduction="mean")
191+
return F.mse_loss(feat_in, feat_tar, reduction="mean")

examples/research_projects/lpl/lpl_sdxl.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
from accelerate.utils import DistributedType, ProjectConfiguration, set_seed
4242
from datasets import concatenate_datasets, load_dataset
4343
from huggingface_hub import create_repo, upload_folder
44+
from lpl_loss import LatentPerceptualLoss
4445
from packaging import version
4546
from torchvision import transforms
4647
from torchvision.transforms.functional import crop
@@ -55,7 +56,6 @@
5556
from diffusers.utils.hub_utils import load_or_create_model_card, populate_model_card
5657
from diffusers.utils.import_utils import is_torch_npu_available, is_xformers_available
5758
from diffusers.utils.torch_utils import is_compiled_module
58-
from .lpl_loss import LatentPerceptualLoss
5959

6060

6161
# Will error if the minimal version of diffusers is not installed. Remove at your own risks.
@@ -1208,7 +1208,6 @@ def unwrap_model(model):
12081208

12091209
for epoch in range(first_epoch, args.num_train_epochs):
12101210
train_loss = 0.0
1211-
lpl_accumulated = 0.0
12121211
for step, batch in enumerate(train_dataloader):
12131212
with accelerator.accumulate(unet):
12141213
# Sample noise that we'll add to the latents

0 commit comments

Comments
 (0)