Minimal working example of safetensors
support for hezar
#156
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.
Pull Request
Description
The
save
andload
methods for thehezar.models.Model
class have been altered to accommodate forsafetensors
support.Changes
safetensors
exposed through the keyword argumentload_safetensors
underModel.load()
.safetensors
exposed through the keyword argumentsafe_serialization
underModel.save()
.SAFETENSORS
added to theenumlist
ofBackends
inconstants.py
.test_safetensors.py
. This serves just to demonstrate the changes and is by no means a comprehensive test ready for production.Related Issues
Resolves #153
Additional Comments
Please keep in mind that this is meant to serve as a draft PR and is by no means production-ready. The changes made to the code base are very crude and the aim was only to show how it may be possible to incorporate
safetensors
support inhezar
. After the architectural details and design decisions regarding how and where this change should be introduced within the codebase are approved, I can happily edit this PR (or submit a new one) with a cleaner code that adheres to this library's standards.Notes
Model.push_to_hub()
also requires changes but for the purposes of this quick prototype it was left unchanged for the time being.