huggingface / huggingface/diffusers

Explicit support of masked loss and schedulefree optimizers

Offen
#10,389 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
stale
Vorherrschende Sprache
Python
Sterne
34.5k
Forks
7.3k
Ø Merge
3 T. 3 Std.
Gemergte PRs (30 T.)
91

Beschreibung

ETA: this is my first massive involvement with scripts using diffusers, so I might not be getting some concepts for now, but I'm trying to learn as I go.

I'm trying to extend a script from the advanced_diffusion_training folder that deals with finetuning a dreambooth lora for flux (https://github.com/huggingface/diffusers/blob/main/examples/advanced_diffusion_training/train_dreambooth_lora_flux_advanced.py),
but I'm trying to:

1. add support for schedulefree optimizers (primarily `AdamWScheduleFree`)
2. add a way to use masked loss (based on the mask images or alpha channel info). (possibly related to https://github.com/huggingface/diffusers/issues/10194)

I'm basing both additions on the way it's handled in sd-scripts by kohya-ss (https://github.com/kohya-ss/sd-scripts/blob/sd3/flux_train_network.py is the main source of inspiration), but

1. I'm not sure I'm adding schedulefree optimizer `train` / `eval` switching in all the right places (before actual training, before sampling images, before saving checpoints, &c)
2. the masked loss part has me stumped; I think that we can use the way the dataset is constructed (`DreamBoothDataset` has no out-of-the-box support for `alpha_mask`, but `DreamBoothSubset` from sd-scripts does), but maybe I’m missing something

My current attempts live here: https://gist.github.com/StrangeTcy/dc15b5880dd0d0d92639fe7aba595d54

Any pointers would be welcome.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit examples/advanced_diffusion_training/train_dreambooth_lora_flux_advanced.py und vergleiche dessen Optimizer-Lebenszyklus und Datensatzkonstruktion mit sd-scripts' flux_train_network.py. Prüfe das verlinkte gist und Issue 10194 auf die aktuellen Ansätze und den zugehörigen masked-loss-Kontext. Als abgeschlossen gilt die Unterstützung sowohl von schedulefree-Optimizer-Modusübergängen als auch von masked loss im Flux DreamBooth LoRA-Skript, mit verifiziertem Verhalten beim Training, Sampling und bei Checkpoints.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python, pytorch
Bereich
machine-learning
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.