Gena-LM هي عائلة من النماذج التأسيسية مفتوحة المصدر لتسلسلات الحمض النووي الطويلة.
نماذج GENA-LM هي نماذج لغة مقنعة المحولات المدربين على تسلسل الحمض النووي البشري.
الميزات الرئيسية لنماذج GENA-LM لدينا:
| نموذج | بنيان | ماكس سيكلين ، الرموز (BP) | params | بيانات Tokenizer | بيانات التدريب |
|---|---|---|---|---|---|
| bert-base | بيرت 12L | 512 (4500) | 110 م | T2T الانقسام V1 | T2T الانقسام V1 |
| bert-base-t2t | بيرت 12L | 512 (4500) | 110 م | T2T+1000g SNPs+Multispecies | T2T+1000g SNPs |
| bert-base-lastln-t2t | بيرت 12L | 512 (4500) | 110 م | T2T+1000g SNPs+Multispecies | T2T+1000g SNPs |
| bert-base-t2t-multi | بيرت 12L | 512 (4500) | 110 م | T2T+1000g SNPs+Multispecies | T2T+1000g SNPs+Multispecies |
| Bert-Large-T2T | BERT-24L | 512 (4500) | 336 م | T2T+1000g SNPs+Multispecies | T2T+1000g SNPs |
| Bigbird-base-sparse | Bert-12L ، Ops Sparse Sparse ، حبل | 4096 (36000) | 110 م | T2T الانقسام V1 | T2T الانقسام V1 |
| bigbird-base-sparse-t2t | Bert-12L ، Ops Sparse Sparse ، حبل | 4096 (36000) | 110 م | T2T+1000g SNPs+Multispecies | T2T+1000g SNPs |
| bigbird-base-t2t | Bert-12L ، HF Bigbird | 4096 (36000) | 110 م | T2T+1000g SNPs+Multispecies | T2T+1000g SNPs |
يشير T2T Split V1 إلى النماذج الأولية مع انقسام مجموعة الجينوم البشري T2T غير المسبق. تستخدم النماذج المستندة إلى BERT تطبيع ما قبل الطبقة ويشير LastLN صراحة إلى أن تطبيع الطبقة يتم تطبيقه أيضًا على الطبقة النهائية. يشير الحبل إلى استخدام تضمينات الموضع الدوار بدلاً من التضمينات الموضعية المطلقة التي تشبه بيرت.
بالنسبة إلى نماذجنا الأولى ( gena-lm-bert-base و gena-lm-bigbird-base-sparse ) ، فإننا نحمل الكروموسومات البشرية 22 و Y (CP068256.2 و CP086569 بالنسبة لجميع النماذج الأخرى ، فإننا نحمل الكروموسومات البشرية 7 و 10 (CP068271.2 و CP068268.2) ؛ هذه النماذج لها لاحقة "T2T" في أسمائها. تم استخدام بيانات أخرى للتدريب. تم تدريب النماذج البشرية فقط على مجموعة الجينوم T2T V2 البشرية المعالجة مسبقًا وتكبير SNP 1000 جينوم في ما مجموعه 480 × 10^9 أزواج قاعدة. تم تدريب نماذج Multispecies على بيانات الإنسان فقط وتصنيع البيانات المتعددة في ما مجموعه 1072 × 10^9 أزواج قاعدة.
| نموذج | مهمة | مهمة seq لين | متري | HF اسم فرع |
|---|---|---|---|---|
| gena-lm-bert-base-t2t | المروجين | 300BP | 74.56+-0.36 F1 | Prominers_300_run_1 |
| gena-lm-bert-large-t2t | المروجين | 300BP | 76.44+-0.16 F1 | Prominers_300_run_1 |
| gena-lm-bert-large-t2t | المروجين | 2000bp | 93.70+-0.44 F1 | Prominers_2000_run_1 |
| gena-lm-bert-base-t2t | موقع لصق | 15000BP | 92.63+-0.09 PR AUC | spleai_run_1 |
| gena-lm-bert-large-t2t | موقع لصق | 15000BP | 93.59+-0.11 PR AUC | spleai_run_1 |
للحصول على نموذج تدريب مسبقًا على مهمة المصب ، استبدل model_name و branch_name بقيم من الجدول. يتم حساب متوسط المقاييس في الجدول على عدة أشواط. لذلك ، قد تختلف قيم كل نقطة تفتيش عن تلك المذكورة هنا.
from transformers import AutoTokenizer , AutoModel
tokenizer = AutoTokenizer . from_pretrained ( f'AIRI-Institute/ { model_name } ' )
model = AutoModel . from_pretrained ( f'AIRI-Institute/ { model_name } ' , revision = branch_name , trust_remote_code = True ) from transformers import AutoTokenizer , AutoModel
tokenizer = AutoTokenizer . from_pretrained ( 'AIRI-Institute/gena-lm-bert-base-t2t' )
model = AutoModel . from_pretrained ( 'AIRI-Institute/gena-lm-bert-base-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-base-t2t' )
model = BertForSequenceClassification . from_pretrained ( 'AIRI-Institute/gena-lm-bert-base-t2t' )أو يمكنك فقط تنزيل modeling_bert.py ووضعه بالقرب من الكود.
أو يمكنك الحصول على فئة النموذج من Automodel Huggingface:
from transformers import AutoTokenizer , AutoModel
model = AutoModel . from_pretrained ( 'AIRI-Institute/gena-lm-bert-base-t2t' , trust_remote_code = True )
gena_module_name = model . __class__ . __module__
print ( gena_module_name )
import importlib
# available class names:
# - BertModel, BertForPreTraining, BertForMaskedLM, BertForNextSentencePrediction,
# - BertForSequenceClassification, BertForMultipleChoice, BertForTokenClassification,
# - BertForQuestionAnswering
# check https://huggingface.co/docs/transformers/model_doc/bert
cls = getattr ( importlib . import_module ( gena_module_name ), 'BertForSequenceClassification' )
print ( cls )
model = cls . from_pretrained ( 'AIRI-Institute/gena-lm-bert-base-t2t' , num_labels = 2 ) يستخدم نموذج Gena-LM bigbird-base-t2t تطبيق Huggingface Bigbird. لذلك ، يمكن استخدام الفئات الافتراضية من مكتبة Transformers:
from transformers import AutoTokenizer , BigBirdForSequenceClassification
tokenizer = AutoTokenizer . from_pretrained ( 'AIRI-Institute/gena-lm-bigbird-base-t2t' )
model = BigBirdForSequenceClassification . from_pretrained ( 'AIRI-Institute/gena-lm-bigbird-base-t2t' )تصنيف التسلسل مع محولات الجنا
مجموعة من تضمينات الحمض النووي المتولدة مع Gena LM
استكشف نموذج GENA-LM الذي تم ضبطه على مجموعة بيانات Enformer للتعبير الجيني
@article {GENA_LM,
author = {Veniamin Fishman and Yuri Kuratov and Maxim Petrov and Aleksei Shmelev and Denis Shepelin and Nikolay Chekanov and Olga Kardymon and Mikhail Burtsev},
title = {GENA-LM: A Family of Open-Source Foundational Models for Long DNA Sequences},
elocation-id = {2023.06.12.544594},
year = {2023},
doi = {10.1101/2023.06.12.544594},
publisher = {Cold Spring Harbor Laboratory},
URL = {https://www.biorxiv.org/content/early/2023/06/13/2023.06.12.544594},
eprint = {https://www.biorxiv.org/content/early/2023/06/13/2023.06.12.544594.full.pdf},
journal = {bioRxiv}
}
تشمل المهام المصب لتقييم النموذج التنبؤ بنشاط المروج والمُحسّن ، ومواقع الربط ، وملامح الكروماتين ، وقوة موقع polyadenylation. تحقق من مجلد downstream_tasks للحصول على البرامج النصية للمعالجة المسبقة للبيانات والبيانات التي استخدمناها:
من أجل تنزيل الجينوم البشري ، يرجى تشغيل البرنامج النصي التالي:
./download_data.sh human
للمعالجة المسبقة ، قم بتنفيذ البرنامج النصي التالي:
python src/gena_lm/genome_tools/create_corpus.py --input_file data/ncbi_dataset/data/GCA_009914755.4/GCA_009914755.4_T2T-CHM13v2.0_genomic.fna --output_dir data/processed/human/
بالنسبة للنماذج ذات الاهتمام المتناثر ( gena-lm-bigbird-base-sparse ، ودعم gena-lm-bigbird-base-sparse-t2t ) FP16 و speed-speed.
تثبيت apex https://github.com/nvidia/apex#quick-start
git clone https://github.com/NVIDIA/apex
cd apex
# most recent commits may fail to build
git checkout 2386a912164b0c5cfcd8be7a2b890fbac5607c82
# if pip >= 23.1 (ref: https://pip.pypa.io/en/stable/news/#v23-1) which supports multiple `--config-settings` with the same key...
pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" ./
# otherwise
pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --global-option="--cpp_ext" --global-option="--cuda_ext" ./
هناك حاجة إلى تثبيت Deepspeed للعمل مع إصدارات SPARSEATTENTINE من نماذج اللغة. يدعم الانتباه المتناثر العميق فقط وحدات معالجة الرسومات مع توافق الحساب> = 7 (V100 ، T4 ، A100) ، CUDA 10.1 ، 10.2 ، 11.0 ، أو 11.1 ويتم تشغيله فقط في وضع FP16 (اعتبارًا من Deepspeed 0.6.0).
Pytorch> = 1.7.1 ، <= 1.10.1 عجلات مع CUDA 10.2/11.0/11.1 من pytorch.org يمكن استخدامها. ومع ذلك ، فإن استخدام OPS المتناثر مع عجلات CUDA 11.1 PYTORCH يتطلب تثبيت CUDA 11.3/11.4 على النظام. يمكن أيضًا استخدام OPS المتناثر مع Pytorch == 1.12.1 CUDA 11.3 عجلات ، ولكن تشغيل اختبارات OPS Sparse Sparse SPARSE يتطلب تعديلها أثناء التحقق من إصدار Torch CUDA <= 11.1. شوكة Deepspeed لـ Triton 1.1.1 قام بالفعل بتحديث الاختبارات.
يتطلب Triton 1.0.0 و 1.1.1 Python <= 3.9.
pip install triton==1.0.0
DS_BUILD_SPARSE_ATTN=1 pip install deepspeed==0.6.0 --global-option= " build_ext " --global-option= " -j8 " --no-cacheوالتحقق من التثبيت مع
ds_reportيجلب Triton 1.1.1 بسرعة X2 للعمليات المتناثرة على A100 ، لكن Deep-Spedse (0.6.5) يدعم حاليًا Triton 1.0.0 فقط. يمكن استخدام شوكة Deepspeed مع Triton 1.1.1 في الحالات التي يلزم فيها هذه التسريع:
pip install triton==1.1.1
git clone https://github.com/yurakuratov/DeepSpeed.git
cd DeepSpeed
DS_BUILD_SPARSE_ATTN=1 pip install -e . --global-option= " build_ext " --global-option= " -j8 " --no-cacheوتشغيل اختبارات OPS المتفرقة مع
cd tests/unit
pytest -v test_sparse_attention.pyنحن نستخدم التدريب المدرب و GPU من مستودع LM-experiments-Tools كأساس للنصوص الخاصة بنا. ومع ذلك ، يمكنك استخدام HF Transformers Trainer ، Pytorch Lightning ، أو تسريع و Pytorch مع حلقات تدريب مخصصة بدلاً من ذلك.
قم بتثبيت LM-experiments-tools وفقًا لـ https://github.com/yurakuratov/t5-experiments#install-only-lm_experiments_tools:
git clone https://github.com/yurakuratov/t5-experiments
cd t5-experiments
pip install -e .