Skip to content

Commit

Permalink
Support string_to_param nested dict
Browse files Browse the repository at this point in the history
format:
bundle_emb.EMBNAME.string_to_param.KEYNAME
  • Loading branch information
KohakuBlueleaf committed Oct 10, 2023
1 parent 2aa485b commit 3d8b1af
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion extensions-builtin/Lora/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ def load_network(name, network_on_disk):
if key_network_without_network_parts == "bundle_emb":
emb_name, vec_name = network_part.split(".", 1)
emb_dict = bundle_embeddings.get(emb_name, {})
emb_dict[vec_name] = weight
if vec_name.split('.')[0] == 'string_to_param':
_, k2 = vec_name.split('.', 1)
emb_dict['string_to_param'] = {k2: weight}
else:
emb_dict[vec_name] = weight
bundle_embeddings[emb_name] = emb_dict

key = convert_diffusers_name_to_compvis(key_network_without_network_parts, is_sd2)
Expand Down Expand Up @@ -301,6 +305,7 @@ def load_networks(names, te_multipliers=None, unet_multipliers=None, dyn_dims=No

if emb_db.expected_shape == -1 or emb_db.expected_shape == embedding.shape:
emb_db.register_embedding(embedding, shared.sd_model)
print(f'registered bundle embedding: {embedding.name}')
else:
emb_db.skipped_embeddings[name] = embedding

Expand Down

0 comments on commit 3d8b1af

Please sign in to comment.