這是您可以找到現代伯特的存儲庫,這是我們通過架構變化和擴展將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 } ,
}