security: prefer safetensors over torch dumps#204
Open
coldwaterq wants to merge 2 commits intonikopueringer:mainfrom
Open
security: prefer safetensors over torch dumps#204coldwaterq wants to merge 2 commits intonikopueringer:mainfrom
coldwaterq wants to merge 2 commits intonikopueringer:mainfrom
Conversation
and provide a conversion script
Author
|
It's not related to this change so I didn't include it in the PR, but I also believe that HF_CHECKPOINT_FILENAME = "CorridorKey.pth"is supposed to be HF_CHECKPOINT_FILENAME = "CorridorKey_v1.0.pth" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
Add a conversion script and update the loading to make it easy to swap to safetensors without breaking backwards compatability. Safetesnors ensures that pickles aren't used to save the models at all, since pytorch keeps having security advisories this ensures that you don't have to worry if you are running the latest version of pytorch and know that even if the model is corrupted, an attacker can't get a shell on your system.
How was it tested?
The conversion script was tested on the model in huggingface and then that converted file was loaded to ensure the safetensor load calls are setup correctly and nothing the model requires was lost.
ran
uv run pytestChecklist
uv run pytestpassesuv run ruff checkpassesuv run ruff format --checkpasses