这是您可以找到现代伯特的存储库,这是我们通过架构变化和扩展将BERT带入现代性的实验。
该存储库明显引入了Flexbert,我们用于编码器构建块的模块化方法,并在很大程度上依赖.YAML配置文件来构建模型。该代码库建立在Mosaicbert,特别是未经合并的叉子,在其Apache 2.0许可证的条款下引起了Flash Poasine 2。我们感谢Mosaicml开始现代化编码器的工作!
此读数是很有准的,但仍在建设中。在新的一年中,它将通过更高的可重复性和文档来改善,因为在现代伯特(Modernbert)的夏季发行后,我们会为更多的编码器提供准备。目前,我们主要期待看到人们与人建立的关系?模型检查点)。
有关此存储库带来的更多详细信息,我们建议阅读我们的发行博客文章以获取高级概述,以及我们的ARXIV预印本,以获取更多技术细节。
此存储库中使用的所有代码都是用于训练和胶水评估的实验的一部分的代码,没有任何秘密培训酱。
这是现代伯特的研究存储库,专注于培训和评估。如果您正在寻找旨在与任何通用管道集成的拥抱面版
Modernbert是Answer.ai,Lighon和朋友之间的合作。
我们已经充分记录了用于训练现代伯特的环境,该环境可以安装在配备以下命令的GPU机器上:
conda env create -f environment.yaml
# if the conda environment errors out set channel priority to flexible:
# conda config --set channel_priority flexible
conda activate bert24
# if using H100s clone and build flash attention 3
# git clone https://github.com/Dao-AILab/flash-attention.git
# cd flash-attention/hopper
# python setup.py install
# install flash attention 2 (model uses FA3+FA2 or just FA2 if FA3 isn't supported)
pip install " flash_attn==2.6.3 " --no-build-isolation
# or download a precompiled wheel from https://github.com/Dao-AILab/flash-attention/releases/tag/v2.6.3
# or limit the number of parallel compilation jobs
# MAX_JOBS=8 pip install "flash_attn==2.6.3" --no-build-isolation 训练大量利用作曲家框架。所有培训均通过YAML文件配置,您可以在yamls文件夹中找到示例。我们强烈鼓励您查看其中一个示例YAML,例如yamls/main/flex-bert-rope-base.yaml ,以探索配置选项。
可以通过为其提供检查点和培训配置来使用via run_evals.py进行训练的现代伯特模型的胶水评估。为了评估非现代模型,您应该将glue.py与略有不同的训练YAML一起使用,您可以在yamls/finetuning文件夹中找到示例。
这些examples子文件夹包含用于训练检索模型的脚本,这是基于句子变形金刚的密集模型和通过佩莱特库的Colbert模型:
examples/train_pylate.py :用层培训现代基于贝尔伯特的现代Colbert模型的样板代码。examples/train_st.py :使用句子变压器训练基于现代伯特的密集检索模型的样板代码。examples/evaluate_pylate.py :评估基于现代伯特的Colbert模型的样板代码。examples/evaluate_st.py :用句子变压器评估基于现代伯特的密集检索模型的样板代码。 如果您在工作中使用Modernbert,无论是发布的模型,中间检查站(发布待定)还是此培训存储库,请引用:
@misc { modernbert ,
title = { Smarter, Better, Faster, Longer: A Modern Bidirectional Encoder for Fast, Memory Efficient, and Long Context Finetuning and Inference } ,
author = { Benjamin Warner and Antoine Chaffin and Benjamin Clavié and Orion Weller and Oskar Hallström and Said Taghadouini and Alexis Gallagher and Raja Biswas and Faisal Ladhak and Tom Aarsen and Nathan Cooper and Griffin Adams and Jeremy Howard and Iacopo Poli } ,
year = { 2024 } ,
eprint = { 2412.13663 } ,
archivePrefix = { arXiv } ,
primaryClass = { cs.CL } ,
url = { https://arxiv.org/abs/2412.13663 } ,
}