lgq12697 commited on
Commit
708766e
1 Parent(s): 6c89371

Upload 6 files

Browse files
Files changed (6) hide show
  1. README.md +56 -0
  2. config.json +47 -0
  3. model.safetensors +3 -0
  4. special_tokens_map.json +37 -0
  5. tokenizer_config.json +52 -0
  6. vocab.txt +11 -0
README.md CHANGED
@@ -1,3 +1,59 @@
1
  ---
2
  license: cc-by-nc-sa-4.0
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: cc-by-nc-sa-4.0
3
+ widget:
4
+ - text: AGTCCAGTGGACGACCAGCCACGGCTCCGGTCTGTAGAACCATCGCGGAAACGGCTCGCAAAACTCTAAACAGCGCAAACGATGCGCGCGCCGAAGCAACCCGGCTCTACTTATAAAAACGTCCAACGGTGAGCACCGAGCAGCTACTACTCGTACTCCCCCCACCGATC
5
+ tags:
6
+ - DNA
7
+ - biology
8
+ - genomics
9
  ---
10
+ # Plant foundation DNA large language models
11
+
12
+ The plant DNA large language models (LLMs) contain a series of foundation models based on different model architectures, which are pre-trained on various plant reference genomes.
13
+ All the models have a comparable model size between 90 MB and 150 MB, BPE tokenizer is used for tokenization and 8000 tokens are included in the vocabulary.
14
+
15
+
16
+ **Developed by:** zhangtaolab
17
+
18
+ ### Model Sources
19
+
20
+ - **Repository:** [Plant DNA LLMs](https://github.com/zhangtaolab/plant_DNA_LLMs)
21
+ - **Manuscript:** [Versatile applications of foundation DNA language models in plant genomes]()
22
+
23
+ ### Architecture
24
+
25
+ The model is trained based on the OpenAI GPT-2 model with modified tokenizer specific for DNA sequence.
26
+
27
+ This model is fine-tuned for predicting promoter strength in tobacco leaves system.
28
+
29
+ ### How to use
30
+
31
+ Install the runtime library first:
32
+ ```bash
33
+ pip install transformers
34
+ ```
35
+
36
+ Here is a simple code for inference:
37
+ ```python
38
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
39
+ model_name = 'plant-dnagpt-singlebase-promoter_strength_leaf'
40
+ # load model and tokenizer
41
+ model = AutoModelForSequenceClassification.from_pretrained(f'zhangtaolab/{model_name}', trust_remote_code=True)
42
+ tokenizer = AutoTokenizer.from_pretrained(f'zhangtaolab/{model_name}', trust_remote_code=True)
43
+ # inference
44
+ sequences = ['TACTCTAATCGTATCAGCTGCACTTGCGTACAGGCTACCGGCGTCCTCAGCCACGTAAGAAAAGGCCCAATAAAGGCCCAACTACAACCAGCGGATATATATACTGGAGCCTGGCGAGATCACCCTAACCCCTCACACTCCCATCCAGCCGCCACCAGGTGCAGAGTGTT',
45
+ 'ATTTCAAAACTAGTTTTCTATAAACGAAAACTTATATTTATTCCGCTTGTTCCGTTTGATCTGCTGATTCGACACCGTTTTAACGTATTTTAAGTAAGTATCAGAAATATTAATGTGAAGATAAAAGAAAATAGAGTAAATGTAAAGGAAAATGCATAAGATTTTGTTGA']
46
+ pipe = pipeline('text-classification', model=model, tokenizer=tokenizer,
47
+ trust_remote_code=True, function_to_apply="none")
48
+ results = pipe(sequences)
49
+ print(results)
50
+ ```
51
+
52
+
53
+ ### Training data
54
+ We use GPT2ForSequenceClassification to fine-tune the model.
55
+ Detailed training procedure can be found in our manuscript.
56
+
57
+
58
+ #### Hardware
59
+ Model was trained on a NVIDIA GTX1080Ti GPU (11 GB).
config.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "Plant_DNAGPT_singlebase_promoter_strength_leaf",
3
+ "activation_function": "gelu_new",
4
+ "architectures": [
5
+ "GPT2ForSequenceClassification"
6
+ ],
7
+ "attn_pdrop": 0.1,
8
+ "bos_token_id": 10,
9
+ "embd_pdrop": 0.1,
10
+ "eos_token_id": 9,
11
+ "id2label": {
12
+ "0": "Promoter strength in tobacco leaves"
13
+ },
14
+ "initializer_range": 0.02,
15
+ "label2id": {
16
+ "Promoter strength in tobacco leaves": 0
17
+ },
18
+ "layer_norm_epsilon": 1e-05,
19
+ "model_type": "gpt2",
20
+ "n_ctx": 512,
21
+ "n_embd": 768,
22
+ "n_head": 12,
23
+ "n_inner": null,
24
+ "n_layer": 12,
25
+ "n_positions": 1024,
26
+ "pad_token_id": 1,
27
+ "problem_type": "regression",
28
+ "reorder_and_upcast_attn": false,
29
+ "resid_pdrop": 0.1,
30
+ "scale_attn_by_inverse_layer_idx": false,
31
+ "scale_attn_weights": true,
32
+ "summary_activation": null,
33
+ "summary_first_dropout": 0.1,
34
+ "summary_proj_to_labels": true,
35
+ "summary_type": "cls_index",
36
+ "summary_use_proj": true,
37
+ "task_specific_params": {
38
+ "text-generation": {
39
+ "do_sample": true,
40
+ "max_length": 50
41
+ }
42
+ },
43
+ "torch_dtype": "float32",
44
+ "transformers_version": "4.42.2",
45
+ "use_cache": true,
46
+ "vocab_size": 11
47
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c6ea76c8415e54e9a54f3255eaf0ecbc4045dc3f1272a202d73703f3b2740f15
3
+ size 343421640
special_tokens_map.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": {
3
+ "content": "<cls>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<eos>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "mask_token": {
17
+ "content": "<mask>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "pad_token": {
24
+ "content": "<pad>",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "unk_token": {
31
+ "content": "<unk>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ }
37
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<unk>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<pad>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "<mask>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "<cls>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "9": {
36
+ "content": "<eos>",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "clean_up_tokenization_spaces": true,
45
+ "cls_token": "<cls>",
46
+ "eos_token": "<eos>",
47
+ "mask_token": "<mask>",
48
+ "model_max_length": 512,
49
+ "pad_token": "<pad>",
50
+ "tokenizer_class": "EsmTokenizer",
51
+ "unk_token": "<unk>"
52
+ }
vocab.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <unk>
2
+ <pad>
3
+ <mask>
4
+ <cls>
5
+ A
6
+ T
7
+ C
8
+ G
9
+ N
10
+ <eos>
11
+ <bos>