Yura Kuratov commited on
Commit
4630482
1 Parent(s): 98fde71

add dnalm-bert-base model

Browse files
README.md ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DNALM
2
+
3
+ DNALM is a transformer masked language model trained on human DNA sequence.
4
+
5
+ Differences between DNALM and DNABERT:
6
+ - BPE tokenization instead of k-mers;
7
+ - input sequence size is about 3000 nucleotides (512 BPE tokens) compared to 510 nucleotides of DNABERT
8
+ - pre-training on T2T vs. GRCh38.p13 human genome assembly.
9
+
10
+ Source code and data: https://github.com/AIRI-Institute/dna-lm
11
+
12
+ ## Examples
13
+ ### How to load the model to fine-tune it on classification task
14
+ ```python
15
+ from src.dnalm.modeling_bert import BertForSequenceClassification
16
+ from transformers import AutoTokenizer
17
+
18
+ tokenizer = AutoTokenizer.from_pretrained('AIRI-Institute/dnalm-bert-base')
19
+ model = BertForSequenceClassification.from_pretrained('AIRI-Institute/dnalm-bert-base')
20
+ ```
21
+
22
+ ## Model description
23
+ DNALM 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 `dnalm-bert-base` is similar to the bert-base:
24
+
25
+ - 512 Maximum sequence length
26
+ - 12 Layers, 12 Attention heads
27
+ - 768 Hidden size
28
+ - 32k Vocabulary size
29
+
30
+ We pre-trained dnalm-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.
31
+
32
+ ## Downstream tasks
33
+ Currently, dnalm-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.
34
+
35
+ ### Fine-tuning DNALM on our data and scoring
36
+ After fine-tuning dnalm-bert-base on promoter prediction dataset, following results were achieved:
37
+
38
+ | model | seq_len (bp) | F1 |
39
+ |------------------------|--------------|-------|
40
+ | DeePromoter | 300 | 95.60 |
41
+ | DNALM bert_base (ours) | 2000 | 95.72 |
42
+ | BigBird | 16000 | 99.90 |
43
+
44
+ We can conclude that our model achieves comparable performance to the previously published results for promoter prediction task.
config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BertForPretraining"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "gradient_checkpointing": false,
7
+ "hidden_act": "gelu",
8
+ "hidden_dropout_prob": 0.1,
9
+ "hidden_size": 768,
10
+ "initializer_range": 0.02,
11
+ "intermediate_size": 3072,
12
+ "layer_norm_eps": 1e-12,
13
+ "max_position_embeddings": 512,
14
+ "model_type": "bert",
15
+ "num_attention_heads": 12,
16
+ "num_hidden_layers": 12,
17
+ "pad_token_id": 3,
18
+ "pre_layer_norm": true,
19
+ "position_embedding_type": "absolute",
20
+ "transformers_version": "4.6.0.dev0",
21
+ "type_vocab_size": 2,
22
+ "use_cache": true,
23
+ "vocab_size": 32000
24
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4310578f475a716f6343c7da90fba6230f2c917e80444726a481a611c1faf054
3
+ size 543494664
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"tokenizer_class": "PreTrainedTokenizerFast"}