aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/sd_hijack.py4
-rw-r--r--modules/ui.py7
2 files changed, 7 insertions, 4 deletions
diff --git a/modules/sd_hijack.py b/modules/sd_hijack.py
index ccbaa9ad..7b2030d4 100644
--- a/modules/sd_hijack.py
+++ b/modules/sd_hijack.py
@@ -201,7 +201,7 @@ class StableDiffusionModelHijack:
def process_file(path, filename):
name = os.path.splitext(filename)[0]
- data = torch.load(path)
+ data = torch.load(path, map_location="cpu")
# textual inversion embeddings
if 'string_to_param' in data:
@@ -217,7 +217,7 @@ class StableDiffusionModelHijack:
if len(emb.shape) == 1:
emb = emb.unsqueeze(0)
- self.word_embeddings[name] = emb.detach()
+ self.word_embeddings[name] = emb.detach().to(device)
self.word_embeddings_checksums[name] = f'{const_hash(emb.reshape(-1)*100)&0xffff:04x}'
ids = tokenizer([name], add_special_tokens=False)['input_ids'][0]
diff --git a/modules/ui.py b/modules/ui.py
index 54c80df6..f7ca5588 100644
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -1044,8 +1044,8 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
if getattr(obj,'custom_script_source',None) is not None:
key = 'customscript/' + obj.custom_script_source + '/' + key
- if getattr(obj,'do_not_save_to_config',False):
- return
+ if getattr(obj, 'do_not_save_to_config', False):
+ return
saved_value = ui_settings.get(key, None)
if saved_value is None:
@@ -1053,6 +1053,9 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
elif condition is None or condition(saved_value):
setattr(obj, field, saved_value)
+ if type(x) in [gr.Slider, gr.Radio, gr.Checkbox, gr.Textbox, gr.Number] and x.visible:
+ apply_field(x, 'visible')
+
if type(x) == gr.Slider:
apply_field(x, 'value')
apply_field(x, 'minimum')