-
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
feat: add trust remote code to cross encoders #2595
feat: add trust remote code to cross encoders #2595
Conversation
:param trust_remote_code: Whether or not to allow for custom models defined on the Hub in their own modeling files. | ||
This option should only be set to True for repositories you trust and in which you have read the code, as it | ||
will execute code present on the Hub on your local machine. | ||
:param revision: The specific model version to use. It can be a branch name, a tag name, or a commit id, |
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.
Well spotted!
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.
Looks quite clean. Are you sure that it's not necessary to add trust_remote_code
to the AutoModel.from_pretrained
once you've added it in the AutoConfig.from_pretrained
already?
@tomaarsen my colleague did some test let me try again :) |
you're right, i tested again, even through the results are identical, without adding tensor([0.2811, 0.3452, 0.8731])
The repository for jinaai/jina-reranker-v1-tiny-en contains custom code which must be executed to correctly load the model. You can inspect the repository content at https://hf.co/jinaai/jina-reranker-v1-tiny-en.
You can avoid this prompt in future by passing the argument `trust_remote_code=True`.
Do you wish to run the custom code? [y/N] y
[0.28105804 0.34524447 0.87314653] after adding it: tensor([0.2811, 0.3452, 0.8731])
[0.28105804 0.34524447 0.87314653] I updated the PR :) thanks! Bo |
Thanks a bunch for this PR! It should be ready. I'll get this released tomorrow or Thursday as v2.7.0.
|
A tiny PR to allow
trust_remote_code
inCrossEncoder
to align withSentenceTransformer
signature.Also a bit cleaning of the code, remove duplicate variables and re-order the docstring.