kohya-ss / kohya-ss/sd-scripts

[Feature Request] Add new way to manage timestep distribution and new loss offset feature

Open
#1,375 17 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.2k
Forks
1.2k
Avg merge
11m
Merged PRs (30d)
2

Description

We were working some time on an way to create timestep distribution specific to any particular dataset used in training.

We tested it for last couple months using Derrian easy scripts trainer with hardcoded changes, but we're not familiar with sd-scripts structure enough to fully integrate that as toggleable feature on our own at the current point in time, hence feature request.

https://github.com/Anzhc/Timestep-Attention-and-other-shenanigans

Here we give code of functions structured roughly correctly for usage with variables in sd-scripts. Also examples how we implemented it in hardcoded way are included in repo (look into "Kohya file examples" folder).
It builds distribution based on received loss values, similar to this:
![322636402-c5368e3c-c074-45a9-a929-e49808f87618](https://github.com/kohya-ss/sd-scripts/assets/133806049/a75b8150-360b-4ea0-919b-9bd934047c37)
But unique to each dataset(as it's based on particular loss values received in scope of training).

In majority of cases it improved convergence speed and quality of outcome in our tests.

We also provide code for Loss Offset Curve feature that works with said distribution, can be scaled and scheduled. It also supposed to improve convergence speed.

Some experimental loss functions are included too, but those are really just experiments.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked Timestep-Attention-and-other-shenanigans repository and its “Kohya file examples” folder, then compare the referenced functions with sd-scripts. Determine the integration points for dataset-specific timestep distributions and the scalable, scheduled Loss Offset Curve. Done means both features are integrated as toggleable training options; experimental loss functions are optional.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.