yurakuratov commited on
Commit
7192f11
1 Parent(s): da975ed

update readme

Browse files
Files changed (1) hide show
  1. README.md +72 -30
README.md CHANGED
@@ -4,52 +4,94 @@ tags:
4
  - human_genome
5
  ---
6
 
7
- # WARNING
8
 
9
- This readme should be changed according to current model. Num steps: 800000
10
 
11
- # GENA-LM
12
 
13
- GENA-LM is a transformer masked language model trained on human DNA sequence.
14
 
15
- Differences between GENA-LM and DNABERT:
16
  - BPE tokenization instead of k-mers;
17
- - input sequence size is about 3000 nucleotides (512 BPE tokens) compared to 510 nucleotides of DNABERT
18
  - pre-training on T2T vs. GRCh38.p13 human genome assembly.
19
 
20
  Source code and data: https://github.com/AIRI-Institute/GENA_LM
21
 
22
- ## Examples
23
- ### How to load the model to fine-tune it on classification task
24
- ```python
25
- from src.gena_lm.modeling_bert import BertForSequenceClassification
26
- from transformers import AutoTokenizer
27
 
28
- tokenizer = AutoTokenizer.from_pretrained('AIRI-Institute/gena-lm-bert-base')
29
- model = BertForSequenceClassification.from_pretrained('AIRI-Institute/gena-lm-bert-base')
 
 
 
 
 
 
 
 
 
 
30
  ```
31
 
32
- ## Model description
33
- GENA-LM model is trained in a masked language model (MLM) fashion, following the methods proposed in the BigBird paper by masking 85% of tokens. Model config for `gena-lm-bert-base` is similar to the bert-base:
 
 
 
 
 
34
 
35
- - 512 Maximum sequence length
36
- - 12 Layers, 12 Attention heads
37
- - 768 Hidden size
38
- - 32k Vocabulary size
39
 
40
- We pre-trained `gena-lm-bert-base` using the latest T2T human genome assembly (https://www.ncbi.nlm.nih.gov/assembly/GCA_009914755.3/). Pre-training was performed for 500,000 iterations with the same parameters as in BigBird, except sequence length was equal to 512 tokens and we used pre-layer normalization in Transformer.
 
 
41
 
42
- ## Downstream tasks
43
- Currently, gena-lm-bert-base model has been finetuned and tested on promoter prediction task. Its' performance is comparable to previous SOTA results. We plan to fine-tune and make available models for other downstream tasks in the near future.
 
44
 
45
- ### Fine-tuning GENA-LM on our data and scoring
46
- After fine-tuning gena-lm-bert-base on promoter prediction dataset, following results were achieved:
47
 
48
- | model | seq_len (bp) | F1 |
49
- |--------------------------|--------------|-------|
50
- | DeePromoter | 300 | 95.60 |
51
- | GENA-LM bert-base (ours) | 2000 | 95.72 |
52
- | BigBird | 16000 | 99.90 |
 
 
53
 
54
- We can conclude that our model achieves comparable performance to the previously published results for promoter prediction task.
 
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  - human_genome
5
  ---
6
 
7
+ # GENA-LM (gena-lm-bigbird-base-sparse-t2t)
8
 
9
+ GENA-LM is a Family of Open-Source Foundational Models for Long DNA Sequences.
10
 
11
+ GENA-LM models are transformer masked language models trained on human DNA sequence.
12
 
13
+ `gena-lm-bigbird-base-sparse-t2t` follows the BigBird architecture and uses sparse attention from DeepSpeed.
14
 
15
+ Differences between GENA-LM (`gena-lm-bigbird-base-sparse-t2t`) and DNABERT:
16
  - BPE tokenization instead of k-mers;
17
+ - input sequence size is about 36000 nucleotides (4096 BPE tokens) compared to 512 nucleotides of DNABERT;
18
  - pre-training on T2T vs. GRCh38.p13 human genome assembly.
19
 
20
  Source code and data: https://github.com/AIRI-Institute/GENA_LM
21
 
22
+ Paper: https://www.biorxiv.org/content/10.1101/2023.06.12.544594v1
 
 
 
 
23
 
24
+ ## Installation
25
+ `gena-lm-bigbird-base-sparse-t2t` sparse ops require DeepSpeed.
26
+
27
+ ### DeepSpeed
28
+ DeepSpeed installation is needed to work with SparseAttention versions of language models. DeepSpeed Sparse attention supports only GPUs with compute compatibility >= 7 (V100, T4, A100).
29
+ ```bash
30
+ pip install triton==1.0.0
31
+ DS_BUILD_SPARSE_ATTN=1 pip install deepspeed==0.6.0 --global-option="build_ext" --global-option="-j8" --no-cache
32
+ ```
33
+ and check installation with
34
+ ```bash
35
+ ds_report
36
  ```
37
 
38
+ ### APEX for FP16
39
+ Install APEX https://github.com/NVIDIA/apex#quick-start
40
+ ```
41
+ git clone https://github.com/NVIDIA/apex
42
+ cd apex
43
+ pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
44
+ ```
45
 
46
+ ## Examples
 
 
 
47
 
48
+ ### Load pre-trained model
49
+ ```python
50
+ from transformers import AutoTokenizer, BigBirdForMaskedLM
51
 
52
+ tokenizer = AutoTokenizer.from_pretrained('AIRI-Institute/gena-lm-bigbird-base-sparse-t2t')
53
+ model = BigBirdForMaskedLM.from_pretrained('AIRI-Institute/gena-lm-bigbird-base-sparse-t2t')
54
+ ```
55
 
 
 
56
 
57
+ ### How to load the model to fine-tune it on classification task
58
+ ```python
59
+ from transformers import AutoTokenizer, BigBirdForSequenceClassification
60
+
61
+ tokenizer = AutoTokenizer.from_pretrained('AIRI-Institute/gena-lm-bigbird-base-sparse-t2t')
62
+ model = BigBirdForSequenceClassification.from_pretrained('AIRI-Institute/gena-lm-bigbird-base-sparse-t2t')
63
+ ```
64
 
65
+ ## Model description
66
+ GENA-LM (`gena-lm-bigbird-base-sparse-t2t`) model is trained in a masked language model (MLM) fashion, following the methods proposed in the BigBird paper by masking 15% of tokens. Model config for `gena-lm-bigbird-base-sparse-t2t` is similar to the `google/bigbird-roberta-base`:
67
 
68
+ - 4096 Maximum sequence length
69
+ - 12 Layers, 12 Attention heads
70
+ - 768 Hidden size
71
+ - sparse config:
72
+ - block size: 64
73
+ - random blocks: 3
74
+ - global blocks: 2
75
+ - sliding window blocks: 3
76
+ - Rotary positional embeddings
77
+ - 32k Vocabulary size, tokenizer trained on DNA data.
78
+
79
+ We pre-trained `gena-lm-bigbird-base-sparse-t2t` using the latest T2T human genome assembly (https://www.ncbi.nlm.nih.gov/assembly/GCA_009914755.3/). The data was augmented by sampling mutations from 1000-genome SNPs (gnomAD dataset). Pre-training was performed for 800,000 iterations with batch size 256. We modified Transformer with [Pre-Layer normalization](https://arxiv.org/abs/2002.04745).
80
+
81
+ ## Evaluation
82
+ For evaluation results, see our paper: https://www.biorxiv.org/content/10.1101/2023.06.12.544594v1
83
+
84
+ ## Citation
85
+ ```bibtex
86
+ @article{GENA_LM,
87
+ author = {Veniamin Fishman and Yuri Kuratov and Maxim Petrov and Aleksei Shmelev and Denis Shepelin and Nikolay Chekanov and Olga Kardymon and Mikhail Burtsev},
88
+ title = {GENA-LM: A Family of Open-Source Foundational Models for Long DNA Sequences},
89
+ elocation-id = {2023.06.12.544594},
90
+ year = {2023},
91
+ doi = {10.1101/2023.06.12.544594},
92
+ publisher = {Cold Spring Harbor Laboratory},
93
+ URL = {https://www.biorxiv.org/content/early/2023/06/13/2023.06.12.544594},
94
+ eprint = {https://www.biorxiv.org/content/early/2023/06/13/2023.06.12.544594.full.pdf},
95
+ journal = {bioRxiv}
96
+ }
97
+ ```