🚀 GENA-LM (gena-lm-bert-large-t2t)
GENA-LM是一系列用於長DNA序列的開源基礎模型。這些模型基於Transformer架構,在人類DNA序列上進行訓練,能夠為DNA序列分析提供強大的支持。
項目鏈接
🚀 快速開始
模型差異
GENA-LM (gena-lm-bert-large-t2t
) 與DNABERT的主要區別如下:
- 使用BPE分詞,而非k-mers;
- 輸入序列大小約為4500個核苷酸(512個BPE標記),而DNABERT為512個核苷酸;
- 在T2T人類基因組組裝上進行預訓練,而不是GRCh38.p13。
下游任務微調模型
本倉庫還包含在下游任務上進行微調的模型:
以及在我們的 GENA-Web 基因組序列註釋網絡工具中使用的模型:
💻 使用示例
基礎用法
如何加載用於掩碼語言建模的預訓練模型
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained('AIRI-Institute/gena-lm-bert-large-t2t')
model = AutoModel.from_pretrained('AIRI-Institute/gena-lm-bert-large-t2t', trust_remote_code=True)
高級用法
如何加載預訓練模型以在分類任務上進行微調
方法一:從GENA-LM倉庫獲取模型類
git clone https://github.com/AIRI-Institute/GENA_LM.git
from GENA_LM.src.gena_lm.modeling_bert import BertForSequenceClassification
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained('AIRI-Institute/gena-lm-bert-large-t2t')
model = BertForSequenceClassification.from_pretrained('AIRI-Institute/gena-lm-bert-large-t2t')
或者,你可以直接下載 modeling_bert.py 並將其放在你的代碼附近。
方法二:從HuggingFace AutoModel獲取模型類
from transformers import AutoTokenizer, AutoModel
model = AutoModel.from_pretrained('AIRI-Institute/gena-lm-bert-large-t2t', trust_remote_code=True)
gena_module_name = model.__class__.__module__
print(gena_module_name)
import importlib
cls = getattr(importlib.import_module(gena_module_name), 'BertForSequenceClassification')
print(cls)
model = cls.from_pretrained('AIRI-Institute/gena-lm-bert-large-t2t', num_labels=2)
📚 詳細文檔
模型描述
GENA-LM (gena-lm-bert-large-t2t
) 模型以掩碼語言模型(MLM)的方式進行訓練,遵循BigBird論文中提出的方法,對15%的標記進行掩碼。gena-lm-bert-large-t2t
的模型配置與 bert-large-uncased
類似:
- 最大序列長度:512
- 層數:24
- 注意力頭數:16
- 隱藏層大小:1024
- 詞彙表大小:32k
我們使用最新的T2T人類基因組組裝(https://www.ncbi.nlm.nih.gov/assembly/GCA_009914755.3/)對 gena-lm-bert-large-t2t
進行預訓練。數據通過從1000個基因組SNP(gnomAD數據集)中採樣突變進行增強。預訓練進行了1750000次迭代,批次大小為256,序列長度為512個標記。我們使用 Pre-Layer normalization 對Transformer進行了修改。
評估
有關評估結果,請參閱我們的論文:https://academic.oup.com/nar/article/53/2/gkae1310/7954523
📄 許可證
引用
@article{GENA_LM,
author = {Fishman, Veniamin and Kuratov, Yuri and Shmelev, Aleksei and Petrov, Maxim and Penzar, Dmitry and Shepelin, Denis and Chekanov, Nikolay and Kardymon, Olga and Burtsev, Mikhail},
title = {GENA-LM: a family of open-source foundational DNA language models for long sequences},
journal = {Nucleic Acids Research},
volume = {53},
number = {2},
pages = {gkae1310},
year = {2025},
month = {01},
issn = {0305-1048},
doi = {10.1093/nar/gkae1310},
url = {https://doi.org/10.1093/nar/gkae1310},
eprint = {https://academic.oup.com/nar/article-pdf/53/2/gkae1310/61443229/gkae1310.pdf},
}