kohya-ss / kohya-ss/sd-scripts
Flux conditional flow implementation
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.2k
- Avg merge
- 11m
- Merged PRs (30d)
- 2
Description
Hi, I'm trying to figure out how Flux LoRA is trained.
According to the paper: https://arxiv.org/abs/2210.02747 (eq. 22), I guess that conditional flow should be implemented as follows: `x_t = t * x_1 + (1 - t) * x_0`, where `x_0` is sampled from Gaussian distribution and `x_1` represents data.
But current implementation: `noisy_model_input = (1 - t) * latents + t * noise` [(code)](https://github.com/kohya-ss/sd-scripts/blob/0047bb1fc30a9987138a20f52f774ca536ff7b6a/library/flux_train_utils.py#L397)
that I believe corresponds to `x_t = (1 - t) * x_1 + t * x_0`
Can you explain please where am I wrong?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with equation 22 in the linked paper and the implementation at library/flux_train_utils.py line 397. Compare the definitions of t, latents, and noise in the surrounding training flow; the investigation is complete when the apparent parameter-order discrepancy is explained or a concrete implementation correction is identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100