aboutsummaryrefslogtreecommitdiffstats
path: root/modules/hypernetworks
diff options
context:
space:
mode:
authorShondoit <shondoit@gmail.com>2023-01-12 14:34:11 +0000
committerShondoit <shondoit@gmail.com>2023-02-15 09:03:59 +0000
commitbc50936745e1a349afdc28cf1540109ba20bc71a (patch)
tree10c5a91caf895e58dffbf5a2d5d30924651e0bbf /modules/hypernetworks
parent21642000b33a3069e3408ea1a50239006176badb (diff)
downloadstable-diffusion-webui-gfx803-bc50936745e1a349afdc28cf1540109ba20bc71a.tar.gz
stable-diffusion-webui-gfx803-bc50936745e1a349afdc28cf1540109ba20bc71a.tar.bz2
stable-diffusion-webui-gfx803-bc50936745e1a349afdc28cf1540109ba20bc71a.zip
Call weighted_forward during training
Diffstat (limited to 'modules/hypernetworks')
-rw-r--r--modules/hypernetworks/hypernetwork.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/hypernetworks/hypernetwork.py b/modules/hypernetworks/hypernetwork.py
index 825a93b2..9c79b7d0 100644
--- a/modules/hypernetworks/hypernetwork.py
+++ b/modules/hypernetworks/hypernetwork.py
@@ -640,13 +640,14 @@ def train_hypernetwork(id_task, hypernetwork_name, learn_rate, batch_size, gradi
with devices.autocast():
x = batch.latent_sample.to(devices.device, non_blocking=pin_memory)
+ w = batch.weight.to(devices.device, non_blocking=pin_memory)
if tag_drop_out != 0 or shuffle_tags:
shared.sd_model.cond_stage_model.to(devices.device)
c = shared.sd_model.cond_stage_model(batch.cond_text).to(devices.device, non_blocking=pin_memory)
shared.sd_model.cond_stage_model.to(devices.cpu)
else:
c = stack_conds(batch.cond).to(devices.device, non_blocking=pin_memory)
- loss = shared.sd_model(x, c)[0] / gradient_step
+ loss = shared.sd_model.weighted_forward(x, c, w)[0] / gradient_step
del x
del c