Skip to content

add partial .safetensors support #1

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ProducerMatt
Copy link

Allows loading of ST and saving as ST. To verify, merge two small models that don't need pruning.

Can't be merged yet as there's no support in prune and the other external scripts yet. I got stuck on the details regarding ema_keys. When I have time I'll try to take a shot at it.

Should I make a file for shared functions, i.e. model loading/saving funcs for ckpt+safetensors?

Allows loading of ST and saving as ST. However there's no support in
prune and the other external scripts yet.
@diStyApps diStyApps marked this pull request as ready for review December 20, 2022 16:41
@diStyApps
Copy link
Owner

Hey great work,
Thank you for your work on adding support for SafeTensors.

Can't be merged yet as there's no support in prune and the other external scripts yet. I got stuck on the details regarding ema_keys. When I have time I'll try to take a shot at it.

i did merged .safetensors and .ckpt your PR successfully.

Important to note the "Use FP16" is how the model merges, and how its exactly saves the model.

and you can save .safetensors to fp16 by adding this line to make_safetensors:

if make_safetensors:
    theta_0 = {name: tensor.half() for name, tensor in theta_0.items()}

    safetensors.torch.save_file(theta_0, output_file)

The app originally functioned as a direct GUI for the source, but some of its behavior was not correct.

Planned updates include:

Adding the ability to save models as FP16.
Adding a new button to convert models to FP16.
Adding support for SafeTensors (which has already been implemented by you).

it appears that the current PR introduces a bug that prevents models from being saved in the .ckpt format and makes .safetensors the default format even if it is not selected.

Should I make a file for shared functions, i.e. model loading/saving funcs for ckpt+safetensors?

sounds like a good idea.

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.

2 participants