diff options
author | Volpeon <git@volpeon.ink> | 2023-02-07 20:56:37 +0100 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2023-02-07 20:56:37 +0100 |
commit | 757e6af0af2f8de6da696976f3110cd70085adad (patch) | |
tree | cf219fffa359440bc8f2a2d6dd4a647715d66893 /training/functional.py | |
parent | Add Lora (diff) | |
download | textual-inversion-diff-757e6af0af2f8de6da696976f3110cd70085adad.tar.gz textual-inversion-diff-757e6af0af2f8de6da696976f3110cd70085adad.tar.bz2 textual-inversion-diff-757e6af0af2f8de6da696976f3110cd70085adad.zip |
Fix Lora memory usage
Diffstat (limited to 'training/functional.py')
-rw-r--r-- | training/functional.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/training/functional.py b/training/functional.py index 8f47734..ccbb4ad 100644 --- a/training/functional.py +++ b/training/functional.py | |||
@@ -261,8 +261,8 @@ def loss_step( | |||
261 | eval: bool = False | 261 | eval: bool = False |
262 | ): | 262 | ): |
263 | # Convert images to latent space | 263 | # Convert images to latent space |
264 | latents = vae.encode(batch["pixel_values"]).latent_dist.sample().detach() | 264 | latents = vae.encode(batch["pixel_values"]).latent_dist.sample() |
265 | latents = latents * 0.18215 | 265 | latents = latents * vae.config.scaling_factor |
266 | 266 | ||
267 | generator = torch.Generator(device=latents.device).manual_seed(seed + step) if eval else None | 267 | generator = torch.Generator(device=latents.device).manual_seed(seed + step) if eval else None |
268 | 268 | ||