Skip to content

Include ModernBert as an encoder model#308

Open
katjakon wants to merge 2 commits intoamzn:mainlinefrom
katjakon:modernbert-encoder
Open

Include ModernBert as an encoder model#308
katjakon wants to merge 2 commits intoamzn:mainlinefrom
katjakon:modernbert-encoder

Conversation

@katjakon
Copy link
Copy Markdown

@katjakon katjakon commented May 6, 2025

This PR makes ModernBert available as an encoder model for X-Transformer.

Issue #, if available:
Issue #307 mentions expanding pecos so that additional Transformer encoder models such as ModernBert can be used.

Description of changes:

  • ModernBert requires an updated version of the transformers library (tested with version 4.51.3). As a consequence, the optimizer AdamW from pytorch should be used because AdamW is not available in current versions of transformers
  • I add the class ModernBertForXMC in the file pecos/xmc/xtransformer/network.py and add it as a possible encoder class to ENCODER_CLASSES

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@katjakon katjakon marked this pull request as ready for review May 6, 2025 10:54
@mfakaehler
Copy link
Copy Markdown

This relates to issue #311

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