Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while trying merging 2 models #735

Closed
ololiyuki opened this issue Dec 30, 2022 · 5 comments
Closed

Error while trying merging 2 models #735

ololiyuki opened this issue Dec 30, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@ololiyuki
Copy link

Error_Trying_Merge_Models.txt

Hello folks!

Trying the feature for merging models as described in "What's new section" of Easy Diffusion,
I always get the error "positional argument follows keyword argument", as attached in this message.

Any help would be priceless...

Thanks a lot...

Vincent

@ololiyuki ololiyuki added the bug Something isn't working label Dec 30, 2022
@JeLuF
Copy link
Contributor

JeLuF commented Dec 30, 2022

Try to ommit the ratio= and use_fp16= prefixes:

m0 = 'D:/stable-diffusion-ui/models/stable-diffusion/peterpolach.ckpt'
m1 = 'D:/stable-diffusion-ui/models/stable-diffusion/Double_Exposure_v2.ckpt'
out = 'D:/stable-diffusion-ui/models/stable-diffusion/mergedpolachdouble.ckpt'
merge_models(m0, m1, 0.3, out, True)

I moved the pathes to variables for readability, you can pass them directly if you want.

@ololiyuki
Copy link
Author

ololiyuki commented Dec 30, 2022

With this:

merge_models('D:/stable-diffusion-ui/models/stable-diffusion/peterpolach.ckpt', 'D:/stable-diffusion-ui/models/stable-diffusion/Double_Exposure_v2.ckpt', 0.5, 'D:/stable-diffusion-ui/models/stable-diffusion/mergedpolachdouble.ckpt', True)

I get this now:

Traceback (most recent call last):
File "", line 1, in
File "D:\stable-diffusion-ui\stable-diffusion\env\lib\site-packages\sdkit\train\merge_models.py", line 15, in merge_models
save_tensor_file(merged, out_path)
File "D:\stable-diffusion-ui\stable-diffusion\env\lib\site-packages\sdkit\utils\file_utils.py", line 16, in save_tensor_file
return torch.save(data, path, map_location="cpu")
TypeError: save() got an unexpected keyword argument 'map_location'

@JeLuF
Copy link
Contributor

JeLuF commented Dec 30, 2022

There is a pull request to fix this bug. map_location="cpu" is wrong here. It needs to be merged to fix this.

Does merge_models('D:/stable-diffusion-ui/models/stable-diffusion/peterpolach.ckpt', 'D:/stable-diffusion-ui/models/stable-diffusion/Double_Exposure_v2.ckpt', 0.5, 'D:/stable-diffusion-ui/models/stable-diffusion/mergedpolachdouble.safetensors', True) work?

@ololiyuki
Copy link
Author

Hi JeLuf...

Well... with '.safetensors' extension, it works like a charm...!

Thanks

@JeLuF
Copy link
Contributor

JeLuF commented Dec 30, 2022

You should use safetensors anyway :-) In contrast to ckpt, it can not contain executable code.

@cmdr2 cmdr2 closed this as completed May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants