This commit is contained in:
lvmin
2023-02-11 21:18:27 -08:00
parent 126ed386d4
commit e0793b33a5

View File

@@ -10,12 +10,22 @@ import os
assert os.path.exists(path_sd15), 'Input path_sd15 does not exists!'
assert os.path.exists(path_sd15_with_control), 'Input path_sd15_with_control does not exists!'
assert os.path.exists(path_input), 'Input path_input does not exists!'
assert not os.path.exists(path_output), 'Output path_output already exists!'
assert os.path.exists(os.path.dirname(path_output)), 'Output folder not exists!'
import torch
from share import *
from cldm.model import load_state_dict, create_model
from cldm.model import load_state_dict
sd15_state_dict = load_state_dict(path_sd15)
sd15_with_control_state_dict = load_state_dict(path_sd15_with_control)
input_state_dict = load_state_dict(path_input)
a = 0
model = create_model('./models/cldm_v15.yaml').cpu()
output_state_dict = model.state_dict()
# balabala
torch.save(output_state_dict, path_output)
print('Transferred model saved at ' + path_output)