diff options
author | noodleanon <122053346+noodleanon@users.noreply.github.com> | 2023-01-07 14:18:09 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-07 14:18:09 +0000 |
commit | 50e25362794d46cd9a55c70e953a8b4126fd42f7 (patch) | |
tree | ea528f29a7c967de32f08217c50d994eebb277b3 /modules/hypernetworks/hypernetwork.py | |
parent | eadd1bf06adbd7263875640a6446d3b0184d1561 (diff) | |
parent | 151233399c4b79934bdbb7c12a97eeb6499572fb (diff) | |
download | stable-diffusion-webui-gfx803-50e25362794d46cd9a55c70e953a8b4126fd42f7.tar.gz stable-diffusion-webui-gfx803-50e25362794d46cd9a55c70e953a8b4126fd42f7.tar.bz2 stable-diffusion-webui-gfx803-50e25362794d46cd9a55c70e953a8b4126fd42f7.zip |
Merge branch 'AUTOMATIC1111:master' into img2img-api-scripts
Diffstat (limited to 'modules/hypernetworks/hypernetwork.py')
-rw-r--r-- | modules/hypernetworks/hypernetwork.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/hypernetworks/hypernetwork.py b/modules/hypernetworks/hypernetwork.py index 6a9b1398..b0cfbe71 100644 --- a/modules/hypernetworks/hypernetwork.py +++ b/modules/hypernetworks/hypernetwork.py @@ -13,7 +13,7 @@ import tqdm from einops import rearrange, repeat
from ldm.util import default
from modules import devices, processing, sd_models, shared, sd_samplers
-from modules.textual_inversion import textual_inversion
+from modules.textual_inversion import textual_inversion, logging
from modules.textual_inversion.learn_schedule import LearnRateScheduler
from torch import einsum
from torch.nn.init import normal_, xavier_normal_, xavier_uniform_, kaiming_normal_, kaiming_uniform_, zeros_
@@ -457,7 +457,14 @@ def train_hypernetwork(hypernetwork_name, learn_rate, batch_size, gradient_step, pin_memory = shared.opts.pin_memory
ds = modules.textual_inversion.dataset.PersonalizedBase(data_root=data_root, width=training_width, height=training_height, repeats=shared.opts.training_image_repeats_per_epoch, placeholder_token=hypernetwork_name, model=shared.sd_model, cond_model=shared.sd_model.cond_stage_model, device=devices.device, template_file=template_file, include_cond=True, batch_size=batch_size, gradient_step=gradient_step, shuffle_tags=shuffle_tags, tag_drop_out=tag_drop_out, latent_sampling_method=latent_sampling_method)
-
+
+ if shared.opts.save_training_settings_to_txt:
+ saved_params = dict(
+ model_name=checkpoint.model_name, model_hash=checkpoint.hash, num_of_dataset_images=len(ds),
+ **{field: getattr(hypernetwork, field) for field in ['layer_structure', 'activation_func', 'weight_init', 'add_layer_norm', 'use_dropout', ]}
+ )
+ logging.save_settings_to_file(log_directory, {**saved_params, **locals()})
+
latent_sampling_method = ds.latent_sampling_method
dl = modules.textual_inversion.dataset.PersonalizedDataLoader(ds, latent_sampling_method=latent_sampling_method, batch_size=ds.batch_size, pin_memory=pin_memory)
|