diff options
author | Volpeon <git@volpeon.ink> | 2023-03-03 09:23:00 +0100 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2023-03-03 09:23:00 +0100 |
commit | 20d3dd06070d8f532effada9b698aad2cfaa94aa (patch) | |
tree | 4da572dbf16a23986c2b587b5c7d2a237a740649 | |
parent | Better low freq noise (diff) | |
download | textual-inversion-diff-20d3dd06070d8f532effada9b698aad2cfaa94aa.tar.gz textual-inversion-diff-20d3dd06070d8f532effada9b698aad2cfaa94aa.tar.bz2 textual-inversion-diff-20d3dd06070d8f532effada9b698aad2cfaa94aa.zip |
Low freq noise with randomized strength
-rw-r--r-- | training/functional.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/training/functional.py b/training/functional.py index ac89048..2d582bf 100644 --- a/training/functional.py +++ b/training/functional.py | |||
@@ -277,7 +277,14 @@ def loss_step( | |||
277 | ) | 277 | ) |
278 | 278 | ||
279 | if low_freq_noise != 0: | 279 | if low_freq_noise != 0: |
280 | noise = noise * (1 - low_freq_noise) + low_freq_noise * torch.randn( | 280 | low_freq_factor = low_freq_noise * torch.randn( |
281 | latents.shape[0], 1, 1, 1, | ||
282 | dtype=latents.dtype, | ||
283 | layout=latents.layout, | ||
284 | device=latents.device, | ||
285 | generator=generator | ||
286 | ) | ||
287 | noise = noise * (1 - low_freq_factor) + low_freq_factor * torch.randn( | ||
281 | latents.shape[0], latents.shape[1], 1, 1, | 288 | latents.shape[0], latents.shape[1], 1, 1, |
282 | dtype=latents.dtype, | 289 | dtype=latents.dtype, |
283 | layout=latents.layout, | 290 | layout=latents.layout, |