Skip to content
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

Adding push_to_hub to CrossEncoder #2524

Merged
merged 4 commits into from
Apr 3, 2024
Merged

Adding push_to_hub to CrossEncoder #2524

merged 4 commits into from
Apr 3, 2024

Conversation

imvladikon
Copy link
Contributor

Hi,
I've noticed that many new cool features have recently been added, so first of all, thank you for your work!

Description

The great CrossEncoder class currently lacks support for auto-uploading to huggingface through the push_to_hub function(although it's achievable using the transformers models API directly)
This PR adds inheritance from PushToHubMixin, which is the standard mechanism for performing push_to_hub in the Transformers library.

As a result, it's possible to do it:

from sentence_transformers import CrossEncoder

model = CrossEncoder("./mpnet-base-nli-matryoshka")
repo_id = "imvladikon/mpnet-base-nli-matryoshka"
model.push_to_hub(repo_id)

The resulting repo is here: https://huggingface.co/imvladikon/mpnet-base-nli-matryoshka where the README.md is generated automatically (which is the behavior that we have in the transformers library)

@tomaarsen
Copy link
Collaborator

Thanks a bunch for setting this up! I expanded it a bit, e.g. making some of the kwargs explicit to help with IDE auto-suggestions and by always setting the cross-encoder tag on the generated README (although the README is still quite empty).

  • Tom Aarsen

@tomaarsen tomaarsen merged commit 0253363 into UKPLab:master Apr 3, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants