Skip to content

Commit fced207

Browse files
committed
fix(lora): handle missing files for already loaded networks
Add check to mark networks as unavailable when they are already loaded in memory but their source files no longer exist on disk. This prevents errors when attempting to use networks whose files have been deleted after initial loading. The change adds an additional condition in load_networks() to verify file existence for previously loaded networks and properly adds them to the unavailable_networks list for cleanup.
1 parent d8c584a commit fced207

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

extensions-builtin/Lora/networks.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ def load_networks(names, te_multipliers=None, unet_multipliers=None, dyn_dims=No
305305
net = get_network_on_disk(name)
306306
if net is None:
307307
unavailable_networks.append(name)
308+
elif already_loaded.get(name, None) is not None and not os.path.exists(net.filename):
309+
# already loaded but file doesn't exist
310+
unavailable_networks.append(name)
308311

309312
if unavailable_networks:
310313
update_available_networks_by_names(unavailable_networks)

0 commit comments

Comments
 (0)