Merge branch 'main' into flux3-image

This commit is contained in:
Jaret Burkett committed 2026-10-15 08:26:39 -06:00
commit 9390ca463e
4 files changed
+160 -2

No files matched your search

+4 -1
View File
@@ -36,7 +36,7 @@ from diffusers import EMAModel
import math
from toolkit.train_tools import precondition_model_outputs_flow_match
from toolkit.models.diffusion_feature_extraction import DiffusionFeatureExtractor, load_dfe
from toolkit.util.losses import wavelet_loss, stepped_loss
from toolkit.util.losses import wavelet_loss, stepped_loss, band_loss
import torch.nn.functional as F
from toolkit.unloader import unload_text_encoder
from PIL import Image
@@ -952,6 +952,9 @@ class SDTrainer(BaseSDTrainProcess):
loss = torch.nn.functional.l1_loss(pred.float(), target.float(), reduction="none")
elif self.train_config.loss_type == "wavelet":
loss = wavelet_loss(pred, batch.latents, noise)
elif self.train_config.loss_type == "band":
# per-sample frequency-weighted MSE: bands the noise has buried at this t drop out
loss = band_loss(pred, target, batch.latents, noise, timesteps, self.sd.is_flow_matching, self.sd.noise_scheduler)
elif self.train_config.loss_type == "stepped":
loss = stepped_loss(pred, batch.latents, noise, noisy_latents, timesteps, self.sd.noise_scheduler)
# the way this loss works, it is low, increase it to match predictable LR effects