mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-02-22 15:53:58 +00:00
13 lines
227 B
Python
13 lines
227 B
Python
import torch
|
|
|
|
|
|
def filter_state_dict_with_prefix(sd, prefix):
|
|
new_sd = {}
|
|
|
|
for k, v in list(sd.items()):
|
|
if k.startswith(prefix):
|
|
new_sd[k[len(prefix):]] = v
|
|
del sd[k]
|
|
|
|
return new_sd
|