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

Fix #10460 #10473

Merged
merged 1 commit into from
May 17, 2023
Merged

Fix #10460 #10473

merged 1 commit into from
May 17, 2023

Conversation

dongweiming
Copy link
Contributor

Describe what this pull request is trying to achieve.

If i uncheck the checkbox "Save metadata (.safetensors only"), this error will be reported:

Loading /Users/weiming.dong/workspace/stable-diffusion-webui/models/Stable-diffusion/CounterfeitV30_v30.safetensors...
Loading /Users/weiming.dong/workspace/stable-diffusion-webui/models/Stable-diffusion/AnythingV5_v5PrtRE.safetensors...
Merging...
100%|██████████████████████████████████████████████████████████████████████████████████████████| 1133/1133 [00:02<00:00, 429.50it/s]
Saving to /Users/weiming.dong/workspace/stable-diffusion-webui/models/Stable-diffusion/0.85(AnythingV5_v5PrtRE) + 0.15(CounterfeitV30_v30).safetensors...
Error loading/saving model file:
Traceback (most recent call last):
  File "/Users/weiming.dong/workspace/stable-diffusion-webui/modules/ui.py", line 1719, in modelmerger
    results = modules.extras.run_modelmerger(*args)
  File "/Users/weiming.dong/workspace/stable-diffusion-webui/modules/extras.py", line 285, in run_modelmerger
    safetensors.torch.save_file(theta_0, output_modelname, metadata=metadata)
  File "/Users/weiming.dong/workspace/stable-diffusion-webui/venv/lib/python3.10/site-packages/safetensors/torch.py", line 232, in save_file
    serialize_file(_flatten(tensors), filename, metadata=metadata)
TypeError: argument 'metadata': 'dict' object cannot be converted to 'PyString'

I fixed this error: #10460

Environment this was tested in

List the environment you have developed / tested this on. As per the contributing page, changes should be able to work on Windows out of the box.

  • OS: Mac M1
  • Browser: chrome, safari

This is required for anything that touches the user interface.

@AUTOMATIC1111
Copy link
Owner

the problem seems bigger than that and also you save metadata regardless of whether the user has enabled it via the checkbox

@dongweiming
Copy link
Contributor Author

the problem seems bigger than that and also you save metadata regardless of whether the user has enabled it via the checkbox

How about this? i saw the default value of metadata is None

@AUTOMATIC1111
Copy link
Owner

yeah and I was also incorrect about the problem being bigger, everything's fine

@AUTOMATIC1111 AUTOMATIC1111 merged commit 36c1483 into AUTOMATIC1111:dev May 17, 2023
@dongweiming
Copy link
Contributor Author

I'm glad I could help~

@cvar66
Copy link

cvar66 commented Nov 30, 2023

Issue is still happening

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants