Replies: 2 comments 2 replies
-
To merge the split import safetensors.torch
merge_state_dict ={}
files = ["name1.safetensors", "name2.safetensors"...] #file you want to be merged
merged_file = "merged_file.safetensors"
for file in files:
load_files_dict = safetensors.torch.load_file(your.safetensors files)
merge_state_dict.update(load_files_dict)
# save
safetensors.torch.save_file(merge_state_dict, merged_file)
this merged_file will be now saved to the combined state dictionary with .safetensors file |
Beta Was this translation helpful? Give feedback.
2 replies
-
While finetuning an LLM on a local cluster, I needed to reshard safetensor files, so I created a code that merges them then resplits them into N parts. This might prove useful to you if you're still looking for a solution, or for other people who might refer to this page when facing the same problem. Here is the code i made for it : https://github.com/NotTheStallion/reshard-safetensors |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there, I got diffusion_pytorch_model-00001-of-00003.safetensors, diffusion_pytorch_model-00002-of-00003.safetensors and diffusion_pytorch_model-00003-of-00003.safetensors after full finetuned Flux with Ostris AI tool kit, I guess at this point I will have to fusion/merge theses 3 parts for created the whole checkpoint usable for a1111 Forge . Is anyone know a script or a tool who can allow this last step ?
Thanks a lot
Beta Was this translation helpful? Give feedback.
All reactions