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

Add support for RoFormer models #464

Merged
merged 7 commits into from
Dec 26, 2023
Merged

Add support for RoFormer models #464

merged 7 commits into from
Dec 26, 2023

Conversation

xenova
Copy link
Collaborator

@xenova xenova commented Dec 20, 2023

Example usage:

import { pipeline } from '@xenova/transformers';

const pipe = await pipeline('fill-mask', 'Xenova/antiberta2');

const output = await pipe('Ḣ Q V Q ... C A [MASK] D ... T V S S');
console.log(output);
See output
[
  {
    score: 0.48774364590644836,
    token: 19,
    token_str: 'R',
    sequence: 'Ḣ Q V Q C A R D T V S S'
  },
  {
    score: 0.2768442928791046,
    token: 18,
    token_str: 'Q',
    sequence: 'Ḣ Q V Q C A Q D T V S S'
  },
  {
    score: 0.0890476182103157,
    token: 13,
    token_str: 'K',
    sequence: 'Ḣ Q V Q C A K D T V S S'
  },
  {
    score: 0.05106702819466591,
    token: 14,
    token_str: 'L',
    sequence: 'Ḣ Q V Q C A L D T V S S'
  },
  {
    score: 0.021606773138046265,
    token: 8,
    token_str: 'E',
    sequence: 'Ḣ Q V Q C A E D T V S S'
  }
]

Also, as expected, the (unquantized) JS version produces the exact same results as the python library. Example code can be found in the alchemab/antiberta2 model card.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@xenova xenova merged commit c91248c into main Dec 26, 2023
4 checks passed
@xenova xenova deleted the add-roformer branch December 26, 2023 13:49
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