-
Notifications
You must be signed in to change notification settings - Fork 53
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
Minimal working example of safetensors
support for hezar
#157
base: main
Are you sure you want to change the base?
Conversation
@arxyzan I think this is what you meant I should be doing 😅. If there's anything further wrong with the PR, do let me know please. |
@Adversarian Thanks Arian jan, I tested your code and it works perfectly. As a next step, I will go through the code and apply necessary changes if needed. In the meanwhile, can you please test this on other models too? (Note that you can create models from configs on the hub instead of downloading the weights from there OR you can use google colab which downloads models in seconds). As a bonus, this change will also enable model downloads count on the Hub! :))) (see #56) |
@arxyzan My pleasure! Sure, I can try it on other models, I'll add them to |
@arxyzan I added a more comprehensive test suite for I'll try to investigate myself soon but in the meantime, here's the notebook with the tests performed if you'd like to take a look yourself. |
@Adversarian Thanks Arian, I think that's exactly the case that failed for me too. Back then I didn't test other models since I thought my conversion code was buggy. |
@arxyzan No problem at all Aryan jan. I don't think this is an issue regarding I will try to take a look at this again as soon as I'm able to but is there really no way to subclass HF's models for Again, sorry for the late response and looking forward to hearing your thoughts on the subject. |
@Adversarian Thanks for putting the time into it man. |
@arxyzan I understand, thanks for your explanation. We can make it happen. As I mentioned before I'm a tiny bit swamped at the moment but I'll get back on this first thing after. |
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.