-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Allow passing model_args to ST #2578
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in #2579, I think this PR will be preferable to #2426 due the hacky nature of the latter. I do think that some slight changes in the API would be beneficial, however.
Thanks for taking the time to make your issue & PR, and for dealing with my slow responses.
Also, please do share your opinion on these suggestions.
2b52dfe
to
0c1b5db
Compare
@tomaarsen could you please take a look at the updated PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two small nitpicks, but otherwise this is looking strong!
@tomaarsen could you please look at this PR again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will do some more local tests before I merge this, but I imagine that it's ready to go. I'll merge this into master
and then propagate those changes into v3.0-pre-release.
For context, v3 should release quite soon (~2 weeks?). I am working on refactoring the sbert.net documentation, but it'll be released once that's done.
- Tom Aarsen
Hello! I've had to reintroduce the Instead, I've created an allow-list of keys that should be passed to the AutoConfig based on its documentation. Secondarily, #2630 has requested simpler support to update certain settings from the tokenizer, so I'm having to reconsider the
|
Hello @satyamk7054 I've done some more thinking, and it seems that there is some (albeit rather niche) needs to be able to specify parameters for the tokenizer and config (my comment on that), so I think it might be best to go with your original idea of letting users specify a
|
@tomaarsen Thank you for more testing and updating the PR! I read through the discussion in the linked issue and I think adding these additional kwargs makes sense (thank you for letting me know). |
@muellerzr @osanseviero I was wondering if you could have another quick look. I've changed my mind after a user required This is still a fairly major change, so I wanted your opinions on this, if you have a bit of time.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! I like that much more, and am thankful you document where to find those easily! Keeps your side a bit easier too as things change/etc 🤗
This PR is good that giving more flexible control over the transformers from 3 .. _kwargs because later on the user will need more /more freedom to add something on top of transformers. Just carefully take a look at this PR this morning .. :-) Good work! @satyamk7054 @tomaarsen |
Summary
Allow passing model_args to ST
Details
This fixes #2579.
New models like e5-mistral-7b-instruct use FP16 as the dtype.
However, when loaded using sentence_transformers, they are loaded with FP32. This is because
HF transformers uses FP32 as the default unless torch_dtype='auto' is passed, as mentioned here.
Passing "auto" to model_args does not work because of the below error. Moreover, the SentenceTransformers class does not currently expose a model_args param.
Testing Done
Added a new unit tests that validates the dtype of the loaded model using the embedding tensor
created with it.