-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
feat: Add trust_remote_code init param to SentenceTransformer embedders #7356
Conversation
@anakin87 verified in an actual example we talked about 🚀 Let's see what CI says |
Pull Request Test Coverage Report for Build 8270286697Details
💛 - Coveralls |
haystack/components/embedders/backends/sentence_transformers_backend.py
Outdated
Show resolved
Hide resolved
haystack/components/embedders/sentence_transformers_document_embedder.py
Outdated
Show resolved
Hide resolved
…mbedder.py Co-authored-by: Stefano Fiorucci <stefanofiorucci@gmail.com>
@anakin87 that should be it - I think, have another look please |
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 left a comment.
Apart from that, this PR is ready to go!
:param trust_remote_code: | ||
If trust_remote_code is false only HuggingFace verified model architectures are allowed. If true | ||
then custom models and scripts are allowed. |
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.
Please also update this.
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.
Done with 2bad887
Why:
This change introduces a new parameter
trust_remote_code
in various classes of the Sentence Transformers embedder component. This parameter allows users to enable or disable the use of unverified model architectures, providing more flexibility in model selection.What:
trust_remote_code
parameter is added to the__init__
method in_SentenceTransformersEmbeddingBackend
,SentenceTransformersDocumentEmbedder
, andSentenceTransformersTextEmbedder
.get_embedding_backend
method in_SentenceTransformersEmbeddingBackendFactory
now acceptstrust_remote_code
as a parameter.warm_up
method in bothSentenceTransformersDocumentEmbedder
andSentenceTransformersTextEmbedder
now acceptstrust_remote_code
.trust_remote_code
parameter.How can it be used:
trust_remote_code
toTrue
when initializing the Sentence Transformers embedder component.How did you test it:
__init__
methods in_SentenceTransformersEmbeddingBackend
,SentenceTransformersDocumentEmbedder
, andSentenceTransformersTextEmbedder
ensure that thetrust_remote_code
parameter is correctly passed and saved during initialization.get_embedding_backend
method in_SentenceTransformersEmbeddingBackendFactory
check that the method accepts thetrust_remote_code
parameter and correctly passes it to theSentenceTransformer
constructor.warm_up
method in bothSentenceTransformersDocumentEmbedder
andSentenceTransformersTextEmbedder
ensure that the method accepts thetrust_remote_code
parameter and correctly passes it to the_SentenceTransformersEmbeddingBackendFactory.get_embedding_backend
method.Notes for the reviewer:
trust_remote_code
parameter is specifically designed to handle custom models or scripts not officially verified by HuggingFace. If you find any issues with this feature or have suggestions for improvement, please let us know.