ZhiyuanChen commited on
Commit
cb8ffda
1 Parent(s): 84392da

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: rna
3
+ tags:
4
+ - Biology
5
+ - RNA
6
+ license: agpl-3.0
7
+ datasets:
8
+ - multimolecule/rnacentral
9
+ library_name: multimolecule
10
+ pipeline_tag: fill-mask
11
+ mask_token: "<mask>"
12
+ widget:
13
+ - example_title: "PRNP"
14
+ text: "CTG<mask>AAGCGGCCCACGCGGACTGACGGGCGGGGG"
15
+ output:
16
+ - label: "GGC"
17
+ score: 0.09496457129716873
18
+ - label: "GAG"
19
+ score: 0.09480331838130951
20
+ - label: "GAC"
21
+ score: 0.07397700101137161
22
+ - label: "AAG"
23
+ score: 0.07375374436378479
24
+ - label: "GUG"
25
+ score: 0.06565868109464645
26
+ ---
27
+
28
+ # mRNA-FM
29
+
30
+ Pre-trained model on mRNA CoDing Sequence (CDS) using a masked language modeling (MLM) objective.
31
+
32
+ ## Disclaimer
33
+
34
+ This is an UNOFFICIAL implementation of the [Interpretable RNA Foundation Model from Unannotated Data for Highly Accurate RNA Structure and Function Predictions](https://doi.org/10.1101/2022.08.06.503062) by Jiayang Chen, Zhihang Hue, Siqi Sun, et al.
35
+
36
+ The OFFICIAL repository of RNA-FM is at [ml4bio/RNA-FM](https://github.com/ml4bio/RNA-FM).
37
+
38
+ > [!TIP]
39
+ > The MultiMolecule team has confirmed that the provided model and checkpoints are producing the same intermediate representations as the original implementation.
40
+
41
+ **The team releasing RNA-FM did not write this model card for this model so this model card has been written by the MultiMolecule team.**
42
+
43
+ ## Model Details
44
+
45
+ RNA-FM is a [bert](https://huggingface.co/google-bert/bert-base-uncased)-style model pre-trained on a large corpus of non-coding RNA sequences in a self-supervised fashion. This means that the model was trained on the raw nucleotides of RNA sequences only, with an automatic process to generate inputs and labels from those texts. Please refer to the [Training Details](#training-details) section for more information on the training process.
46
+
47
+ ### Variations
48
+
49
+ - **[`multimolecule/rnafm`](https://huggingface.co/multimolecule/rnafm)**: The RNA-FM model pre-trained on non-coding RNA sequences.
50
+ - **[`multimolecule/mrnafm`](https://huggingface.co/multimolecule/mrnafm)**: The RNA-FM model pre-trained on mRNA coding sequences.
51
+
52
+ ### Model Specification
53
+
54
+ <table>
55
+ <thead>
56
+ <tr>
57
+ <th>Variants</th>
58
+ <th>Num Layers</th>
59
+ <th>Hidden Size</th>
60
+ <th>Num Heads</th>
61
+ <th>Intermediate Size</th>
62
+ <th>Num Parameters (M)</th>
63
+ <th>FLOPs (G)</th>
64
+ <th>MACs (G)</th>
65
+ <th>Max Num Tokens</th>
66
+ </tr>
67
+ </thead>
68
+ <tbody>
69
+ <tr>
70
+ <td>RNA-FM</td>
71
+ <td rowspan="2">12</td>
72
+ <td>640</td>
73
+ <td rowspan="2">20</td>
74
+ <td rowspan="2">5120</td>
75
+ <td>99.52</td>
76
+ <td>25.68</td>
77
+ <td>12.83</td>
78
+ <td rowspan="2">1024</td>
79
+ </tr>
80
+ <tr>
81
+ <td>mRNA-FM</td>
82
+ <td>1280</td>
83
+ <td>239.25</td>
84
+ <td>61.43</td>
85
+ <td>30.7</td>
86
+ </tr>
87
+ </tbody>
88
+ </table>
89
+
90
+ ### Links
91
+
92
+ - **Code**: [multimolecule.rnafm](https://github.com/DLS5-Omics/multimolecule/tree/master/multimolecule/models/rnafm)
93
+ - **Data**: [RNAcentral](https://rnacentral.org)
94
+ - **Paper**: [Interpretable RNA Foundation Model from Unannotated Data for Highly Accurate RNA Structure and Function Predictions](https://doi.org/10.1101/2022.08.06.503062)
95
+ - **Developed by**: Jiayang Chen, Zhihang Hu, Siqi Sun, Qingxiong Tan, Yixuan Wang, Qinze Yu, Licheng Zong, Liang Hong, Jin Xiao, Tao Shen, Irwin King, Yu Li
96
+ - **Model type**: [BERT](https://huggingface.co/google-bert/bert-base-uncased) - [ESM](https://huggingface.co/facebook/esm2_t48_15B_UR50D)
97
+ - **Original Repository**: [https://github.com/ml4bio/RNA-FM](https://github.com/ml4bio/RNA-FM)
98
+
99
+ ## Usage
100
+
101
+ The model file depends on the [`multimolecule`](https://multimolecule.danling.org) library. You can install it using pip:
102
+
103
+ ```bash
104
+ pip install multimolecule
105
+ ```
106
+
107
+ ### Direct Use
108
+
109
+ You can use this model directly with a pipeline for masked language modeling:
110
+
111
+ ```python
112
+ >>> import multimolecule # you must import multimolecule to register models
113
+ >>> from transformers import pipeline
114
+ >>> unmasker = pipeline('fill-mask', model='multimolecule/mrnafm')
115
+ >>> unmasker("ctg<mask>aagcggcccacgcggactgacgggcggggg")
116
+
117
+ [{'score': 0.09496457129716873,
118
+ 'token': 67,
119
+ 'token_str': 'GGC',
120
+ 'sequence': 'CUG GGC AAG CGG CCC ACG CGG ACU GAC GGG CGG GGG'},
121
+ {'score': 0.09480331838130951,
122
+ 'token': 58,
123
+ 'token_str': 'GAG',
124
+ 'sequence': 'CUG GAG AAG CGG CCC ACG CGG ACU GAC GGG CGG GGG'},
125
+ {'score': 0.07397700101137161,
126
+ 'token': 57,
127
+ 'token_str': 'GAC',
128
+ 'sequence': 'CUG GAC AAG CGG CCC ACG CGG ACU GAC GGG CGG GGG'},
129
+ {'score': 0.07375374436378479,
130
+ 'token': 8,
131
+ 'token_str': 'AAG',
132
+ 'sequence': 'CUG AAG AAG CGG CCC ACG CGG ACU GAC GGG CGG GGG'},
133
+ {'score': 0.06565868109464645,
134
+ 'token': 73,
135
+ 'token_str': 'GUG',
136
+ 'sequence': 'CUG GUG AAG CGG CCC ACG CGG ACU GAC GGG CGG GGG'}]
137
+ ```
138
+
139
+ ### Downstream Use
140
+
141
+ #### Extract Features
142
+
143
+ Here is how to use this model to get the features of a given sequence in PyTorch:
144
+
145
+ ```python
146
+ from multimolecule import RnaTokenizer, RnaFmModel
147
+
148
+
149
+ tokenizer = RnaTokenizer.from_pretrained('multimolecule/mrnafm')
150
+ model = RnaFmModel.from_pretrained('multimolecule/mrnafm')
151
+
152
+ text = "UAGCUUAUCAGACUGAUGUUGA"
153
+ input = tokenizer(text, return_tensors='pt')
154
+
155
+ output = model(**input)
156
+ ```
157
+
158
+ #### Sequence Classification / Regression
159
+
160
+ **Note**: This model is not fine-tuned for any specific task. You will need to fine-tune the model on a downstream task to use it for sequence classification or regression.
161
+
162
+ Here is how to use this model as backbone to fine-tune for a sequence-level task in PyTorch:
163
+
164
+ ```python
165
+ import torch
166
+ from multimolecule import RnaTokenizer, RnaFmForSequencePrediction
167
+
168
+
169
+ tokenizer = RnaTokenizer.from_pretrained('multimolecule/mrnafm')
170
+ model = RnaFmForSequencePrediction.from_pretrained('multimolecule/mrnafm')
171
+
172
+ text = "UAGCUUAUCAGACUGAUGUUGA"
173
+ input = tokenizer(text, return_tensors='pt')
174
+ label = torch.tensor([1])
175
+
176
+ output = model(**input, labels=label)
177
+ ```
178
+
179
+ #### Nucleotide Classification / Regression
180
+
181
+ **Note**: This model is not fine-tuned for any specific task. You will need to fine-tune the model on a downstream task to use it for nucleotide classification or regression.
182
+
183
+ Here is how to use this model as backbone to fine-tune for a nucleotide-level task in PyTorch:
184
+
185
+ ```python
186
+ import torch
187
+ from multimolecule import RnaTokenizer, RnaFmForNucleotidePrediction
188
+
189
+
190
+ tokenizer = RnaTokenizer.from_pretrained('multimolecule/mrnafm')
191
+ model = RnaFmForNucleotidePrediction.from_pretrained('multimolecule/mrnafm')
192
+
193
+ text = "UAGCUUAUCAGACUGAUGUUGA"
194
+ input = tokenizer(text, return_tensors='pt')
195
+ label = torch.randint(2, (len(text), ))
196
+
197
+ output = model(**input, labels=label)
198
+ ```
199
+
200
+ #### Contact Classification / Regression
201
+
202
+ **Note**: This model is not fine-tuned for any specific task. You will need to fine-tune the model on a downstream task to use it for contact classification or regression.
203
+
204
+ Here is how to use this model as backbone to fine-tune for a contact-level task in PyTorch:
205
+
206
+ ```python
207
+ import torch
208
+ from multimolecule import RnaTokenizer, RnaFmForContactPrediction
209
+
210
+
211
+ tokenizer = RnaTokenizer.from_pretrained('multimolecule/mrnafm')
212
+ model = RnaFmForContactPrediction.from_pretrained('multimolecule/mrnafm')
213
+
214
+ text = "UAGCUUAUCAGACUGAUGUUGA"
215
+ input = tokenizer(text, return_tensors='pt')
216
+ label = torch.randint(2, (len(text), len(text)))
217
+
218
+ output = model(**input, labels=label)
219
+ ```
220
+
221
+ ## Training Details
222
+
223
+ RNA-FM used Masked Language Modeling (MLM) as the pre-training objective: taking a sequence, the model randomly masks 15% of the tokens in the input then runs the entire masked sentence through the model and has to predict the masked tokens. This is comparable to the Cloze task in language modeling.
224
+
225
+ ### Training Data
226
+
227
+ The RNA-FM model was pre-trained on [RNAcentral](https://multimolecule.danling.org/datasets/rnacentral/).
228
+ RNAcentral is a free, public resource that offers integrated access to a comprehensive and up-to-date set of non-coding RNA sequences provided by a collaborating group of [Expert Databases](https://rnacentral.org/expert-databases) representing a broad range of organisms and RNA types.
229
+
230
+ RNA-FM applied [CD-HIT (CD-HIT-EST)](https://sites.google.com/view/cd-hit) with a cut-off at 100% sequence identity to remove redundancy from the RNAcentral. The final dataset contains 23.7 million non-redundant RNA sequences.
231
+
232
+ RNA-FM preprocessed all tokens by replacing "U"s with "T"s.
233
+
234
+ Note that during model conversions, "T" is replaced with "U". [`RnaTokenizer`][multimolecule.RnaTokenizer] will convert "T"s to "U"s for you, you may disable this behaviour by passing `replace_T_with_U=False`.
235
+
236
+ ### Training Procedure
237
+
238
+ #### Preprocessing
239
+
240
+ RNA-FM used masked language modeling (MLM) as the pre-training objective. The masking procedure is similar to the one used in BERT:
241
+
242
+ - 15% of the tokens are masked.
243
+ - In 80% of the cases, the masked tokens are replaced by `<mask>`.
244
+ - In 10% of the cases, the masked tokens are replaced by a random token (different) from the one they replace.
245
+ - In the 10% remaining cases, the masked tokens are left as is.
246
+
247
+ #### PreTraining
248
+
249
+ The model was trained on 8 NVIDIA A100 GPUs with 80GiB memories.
250
+
251
+ - Learning rate: 1e-4
252
+ - Weight decay: 0.01
253
+ - Learning rate scheduler: inverse square root
254
+ - Learning rate warm-up: 10,000 steps
255
+
256
+ ## Citation
257
+
258
+ **BibTeX**:
259
+
260
+ ```bibtex
261
+ @article{chen2022interpretable,
262
+ title={Interpretable rna foundation model from unannotated data for highly accurate rna structure and function predictions},
263
+ author={Chen, Jiayang and Hu, Zhihang and Sun, Siqi and Tan, Qingxiong and Wang, Yixuan and Yu, Qinze and Zong, Licheng and Hong, Liang and Xiao, Jin and King, Irwin and others},
264
+ journal={arXiv preprint arXiv:2204.00300},
265
+ year={2022}
266
+ }
267
+ ```
268
+
269
+ ## Contact
270
+
271
+ Please use GitHub issues of [MultiMolecule](https://github.com/DLS5-Omics/multimolecule/issues) for any questions or comments on the model card.
272
+
273
+ Please contact the authors of the [RNA-FM paper](https://doi.org/10.1101/2022.08.06.503062) for questions or comments on the paper/model.
274
+
275
+ ## License
276
+
277
+ This model is licensed under the [AGPL-3.0 License](https://www.gnu.org/licenses/agpl-3.0.html).
278
+
279
+ ```spdx
280
+ SPDX-License-Identifier: AGPL-3.0-or-later
281
+ ```
README.mrnafm.md ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: rna
3
+ tags:
4
+ - Biology
5
+ - RNA
6
+ license: agpl-3.0
7
+ datasets:
8
+ - multimolecule/rnacentral
9
+ library_name: multimolecule
10
+ pipeline_tag: fill-mask
11
+ mask_token: "<mask>"
12
+ widget:
13
+ - example_title: "PRNP"
14
+ text: "CTG<mask>AAGCGGCCCACGCGGACTGACGGGCGGGGG"
15
+ output:
16
+ - label: "GGC"
17
+ score: 0.09496457129716873
18
+ - label: "GAG"
19
+ score: 0.09480331838130951
20
+ - label: "GAC"
21
+ score: 0.07397700101137161
22
+ - label: "AAG"
23
+ score: 0.07375374436378479
24
+ - label: "GUG"
25
+ score: 0.06565868109464645
26
+ ---
27
+
28
+ # mRNA-FM
29
+
30
+ Pre-trained model on mRNA CoDing Sequence (CDS) using a masked language modeling (MLM) objective.
31
+
32
+ ## Disclaimer
33
+
34
+ This is an UNOFFICIAL implementation of the [Interpretable RNA Foundation Model from Unannotated Data for Highly Accurate RNA Structure and Function Predictions](https://doi.org/10.1101/2022.08.06.503062) by Jiayang Chen, Zhihang Hue, Siqi Sun, et al.
35
+
36
+ The OFFICIAL repository of RNA-FM is at [ml4bio/RNA-FM](https://github.com/ml4bio/RNA-FM).
37
+
38
+ > [!TIP]
39
+ > The MultiMolecule team has confirmed that the provided model and checkpoints are producing the same intermediate representations as the original implementation.
40
+
41
+ **The team releasing RNA-FM did not write this model card for this model so this model card has been written by the MultiMolecule team.**
42
+
43
+ ## Model Details
44
+
45
+ RNA-FM is a [bert](https://huggingface.co/google-bert/bert-base-uncased)-style model pre-trained on a large corpus of non-coding RNA sequences in a self-supervised fashion. This means that the model was trained on the raw nucleotides of RNA sequences only, with an automatic process to generate inputs and labels from those texts. Please refer to the [Training Details](#training-details) section for more information on the training process.
46
+
47
+ ### Variations
48
+
49
+ - **[`multimolecule/rnafm`](https://huggingface.co/multimolecule/rnafm)**: The RNA-FM model pre-trained on non-coding RNA sequences.
50
+ - **[`multimolecule/mrnafm`](https://huggingface.co/multimolecule/mrnafm)**: The RNA-FM model pre-trained on mRNA coding sequences.
51
+
52
+ ### Model Specification
53
+
54
+ <table>
55
+ <thead>
56
+ <tr>
57
+ <th>Variants</th>
58
+ <th>Num Layers</th>
59
+ <th>Hidden Size</th>
60
+ <th>Num Heads</th>
61
+ <th>Intermediate Size</th>
62
+ <th>Num Parameters (M)</th>
63
+ <th>FLOPs (G)</th>
64
+ <th>MACs (G)</th>
65
+ <th>Max Num Tokens</th>
66
+ </tr>
67
+ </thead>
68
+ <tbody>
69
+ <tr>
70
+ <td>RNA-FM</td>
71
+ <td rowspan="2">12</td>
72
+ <td>640</td>
73
+ <td rowspan="2">20</td>
74
+ <td rowspan="2">5120</td>
75
+ <td>99.52</td>
76
+ <td>25.68</td>
77
+ <td>12.83</td>
78
+ <td rowspan="2">1024</td>
79
+ </tr>
80
+ <tr>
81
+ <td>mRNA-FM</td>
82
+ <td>1280</td>
83
+ <td>239.25</td>
84
+ <td>61.43</td>
85
+ <td>30.7</td>
86
+ </tr>
87
+ </tbody>
88
+ </table>
89
+
90
+ ### Links
91
+
92
+ - **Code**: [multimolecule.rnafm](https://github.com/DLS5-Omics/multimolecule/tree/master/multimolecule/models/rnafm)
93
+ - **Data**: [RNAcentral](https://rnacentral.org)
94
+ - **Paper**: [Interpretable RNA Foundation Model from Unannotated Data for Highly Accurate RNA Structure and Function Predictions](https://doi.org/10.1101/2022.08.06.503062)
95
+ - **Developed by**: Jiayang Chen, Zhihang Hu, Siqi Sun, Qingxiong Tan, Yixuan Wang, Qinze Yu, Licheng Zong, Liang Hong, Jin Xiao, Tao Shen, Irwin King, Yu Li
96
+ - **Model type**: [BERT](https://huggingface.co/google-bert/bert-base-uncased) - [ESM](https://huggingface.co/facebook/esm2_t48_15B_UR50D)
97
+ - **Original Repository**: [https://github.com/ml4bio/RNA-FM](https://github.com/ml4bio/RNA-FM)
98
+
99
+ ## Usage
100
+
101
+ The model file depends on the [`multimolecule`](https://multimolecule.danling.org) library. You can install it using pip:
102
+
103
+ ```bash
104
+ pip install multimolecule
105
+ ```
106
+
107
+ ### Direct Use
108
+
109
+ You can use this model directly with a pipeline for masked language modeling:
110
+
111
+ ```python
112
+ >>> import multimolecule # you must import multimolecule to register models
113
+ >>> from transformers import pipeline
114
+ >>> unmasker = pipeline('fill-mask', model='multimolecule/mrnafm')
115
+ >>> unmasker("ctg<mask>aagcggcccacgcggactgacgggcggggg")
116
+
117
+ [{'score': 0.09496457129716873,
118
+ 'token': 67,
119
+ 'token_str': 'GGC',
120
+ 'sequence': 'CUG GGC AAG CGG CCC ACG CGG ACU GAC GGG CGG GGG'},
121
+ {'score': 0.09480331838130951,
122
+ 'token': 58,
123
+ 'token_str': 'GAG',
124
+ 'sequence': 'CUG GAG AAG CGG CCC ACG CGG ACU GAC GGG CGG GGG'},
125
+ {'score': 0.07397700101137161,
126
+ 'token': 57,
127
+ 'token_str': 'GAC',
128
+ 'sequence': 'CUG GAC AAG CGG CCC ACG CGG ACU GAC GGG CGG GGG'},
129
+ {'score': 0.07375374436378479,
130
+ 'token': 8,
131
+ 'token_str': 'AAG',
132
+ 'sequence': 'CUG AAG AAG CGG CCC ACG CGG ACU GAC GGG CGG GGG'},
133
+ {'score': 0.06565868109464645,
134
+ 'token': 73,
135
+ 'token_str': 'GUG',
136
+ 'sequence': 'CUG GUG AAG CGG CCC ACG CGG ACU GAC GGG CGG GGG'}]
137
+ ```
138
+
139
+ ### Downstream Use
140
+
141
+ #### Extract Features
142
+
143
+ Here is how to use this model to get the features of a given sequence in PyTorch:
144
+
145
+ ```python
146
+ from multimolecule import RnaTokenizer, RnaFmModel
147
+
148
+
149
+ tokenizer = RnaTokenizer.from_pretrained('multimolecule/mrnafm')
150
+ model = RnaFmModel.from_pretrained('multimolecule/mrnafm')
151
+
152
+ text = "UAGCUUAUCAGACUGAUGUUGA"
153
+ input = tokenizer(text, return_tensors='pt')
154
+
155
+ output = model(**input)
156
+ ```
157
+
158
+ #### Sequence Classification / Regression
159
+
160
+ **Note**: This model is not fine-tuned for any specific task. You will need to fine-tune the model on a downstream task to use it for sequence classification or regression.
161
+
162
+ Here is how to use this model as backbone to fine-tune for a sequence-level task in PyTorch:
163
+
164
+ ```python
165
+ import torch
166
+ from multimolecule import RnaTokenizer, RnaFmForSequencePrediction
167
+
168
+
169
+ tokenizer = RnaTokenizer.from_pretrained('multimolecule/mrnafm')
170
+ model = RnaFmForSequencePrediction.from_pretrained('multimolecule/mrnafm')
171
+
172
+ text = "UAGCUUAUCAGACUGAUGUUGA"
173
+ input = tokenizer(text, return_tensors='pt')
174
+ label = torch.tensor([1])
175
+
176
+ output = model(**input, labels=label)
177
+ ```
178
+
179
+ #### Nucleotide Classification / Regression
180
+
181
+ **Note**: This model is not fine-tuned for any specific task. You will need to fine-tune the model on a downstream task to use it for nucleotide classification or regression.
182
+
183
+ Here is how to use this model as backbone to fine-tune for a nucleotide-level task in PyTorch:
184
+
185
+ ```python
186
+ import torch
187
+ from multimolecule import RnaTokenizer, RnaFmForNucleotidePrediction
188
+
189
+
190
+ tokenizer = RnaTokenizer.from_pretrained('multimolecule/mrnafm')
191
+ model = RnaFmForNucleotidePrediction.from_pretrained('multimolecule/mrnafm')
192
+
193
+ text = "UAGCUUAUCAGACUGAUGUUGA"
194
+ input = tokenizer(text, return_tensors='pt')
195
+ label = torch.randint(2, (len(text), ))
196
+
197
+ output = model(**input, labels=label)
198
+ ```
199
+
200
+ #### Contact Classification / Regression
201
+
202
+ **Note**: This model is not fine-tuned for any specific task. You will need to fine-tune the model on a downstream task to use it for contact classification or regression.
203
+
204
+ Here is how to use this model as backbone to fine-tune for a contact-level task in PyTorch:
205
+
206
+ ```python
207
+ import torch
208
+ from multimolecule import RnaTokenizer, RnaFmForContactPrediction
209
+
210
+
211
+ tokenizer = RnaTokenizer.from_pretrained('multimolecule/mrnafm')
212
+ model = RnaFmForContactPrediction.from_pretrained('multimolecule/mrnafm')
213
+
214
+ text = "UAGCUUAUCAGACUGAUGUUGA"
215
+ input = tokenizer(text, return_tensors='pt')
216
+ label = torch.randint(2, (len(text), len(text)))
217
+
218
+ output = model(**input, labels=label)
219
+ ```
220
+
221
+ ## Training Details
222
+
223
+ RNA-FM used Masked Language Modeling (MLM) as the pre-training objective: taking a sequence, the model randomly masks 15% of the tokens in the input then runs the entire masked sentence through the model and has to predict the masked tokens. This is comparable to the Cloze task in language modeling.
224
+
225
+ ### Training Data
226
+
227
+ The RNA-FM model was pre-trained on [RNAcentral](https://multimolecule.danling.org/datasets/rnacentral/).
228
+ RNAcentral is a free, public resource that offers integrated access to a comprehensive and up-to-date set of non-coding RNA sequences provided by a collaborating group of [Expert Databases](https://rnacentral.org/expert-databases) representing a broad range of organisms and RNA types.
229
+
230
+ RNA-FM applied [CD-HIT (CD-HIT-EST)](https://sites.google.com/view/cd-hit) with a cut-off at 100% sequence identity to remove redundancy from the RNAcentral. The final dataset contains 23.7 million non-redundant RNA sequences.
231
+
232
+ RNA-FM preprocessed all tokens by replacing "U"s with "T"s.
233
+
234
+ Note that during model conversions, "T" is replaced with "U". [`RnaTokenizer`][multimolecule.RnaTokenizer] will convert "T"s to "U"s for you, you may disable this behaviour by passing `replace_T_with_U=False`.
235
+
236
+ ### Training Procedure
237
+
238
+ #### Preprocessing
239
+
240
+ RNA-FM used masked language modeling (MLM) as the pre-training objective. The masking procedure is similar to the one used in BERT:
241
+
242
+ - 15% of the tokens are masked.
243
+ - In 80% of the cases, the masked tokens are replaced by `<mask>`.
244
+ - In 10% of the cases, the masked tokens are replaced by a random token (different) from the one they replace.
245
+ - In the 10% remaining cases, the masked tokens are left as is.
246
+
247
+ #### PreTraining
248
+
249
+ The model was trained on 8 NVIDIA A100 GPUs with 80GiB memories.
250
+
251
+ - Learning rate: 1e-4
252
+ - Weight decay: 0.01
253
+ - Learning rate scheduler: inverse square root
254
+ - Learning rate warm-up: 10,000 steps
255
+
256
+ ## Citation
257
+
258
+ **BibTeX**:
259
+
260
+ ```bibtex
261
+ @article{chen2022interpretable,
262
+ title={Interpretable rna foundation model from unannotated data for highly accurate rna structure and function predictions},
263
+ author={Chen, Jiayang and Hu, Zhihang and Sun, Siqi and Tan, Qingxiong and Wang, Yixuan and Yu, Qinze and Zong, Licheng and Hong, Liang and Xiao, Jin and King, Irwin and others},
264
+ journal={arXiv preprint arXiv:2204.00300},
265
+ year={2022}
266
+ }
267
+ ```
268
+
269
+ ## Contact
270
+
271
+ Please use GitHub issues of [MultiMolecule](https://github.com/DLS5-Omics/multimolecule/issues) for any questions or comments on the model card.
272
+
273
+ Please contact the authors of the [RNA-FM paper](https://doi.org/10.1101/2022.08.06.503062) for questions or comments on the paper/model.
274
+
275
+ ## License
276
+
277
+ This model is licensed under the [AGPL-3.0 License](https://www.gnu.org/licenses/agpl-3.0.html).
278
+
279
+ ```spdx
280
+ SPDX-License-Identifier: AGPL-3.0-or-later
281
+ ```
config.json ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "RnaFmForPreTraining"
4
+ ],
5
+ "attention_dropout": 0.1,
6
+ "bos_token_id": 1,
7
+ "codon": false,
8
+ "emb_layer_norm_before": false,
9
+ "eos_token_id": 2,
10
+ "head": {
11
+ "act": null,
12
+ "bias": true,
13
+ "dropout": 0.0,
14
+ "hidden_size": 1280,
15
+ "layer_norm_eps": 1e-12,
16
+ "num_labels": 1,
17
+ "output_name": null,
18
+ "problem_type": null,
19
+ "transform": null,
20
+ "transform_act": "gelu"
21
+ },
22
+ "hidden_act": "gelu",
23
+ "hidden_dropout": 0.1,
24
+ "hidden_size": 1280,
25
+ "id2label": {
26
+ "0": "LABEL_0"
27
+ },
28
+ "initializer_range": 0.02,
29
+ "intermediate_size": 5120,
30
+ "label2id": {
31
+ "LABEL_0": 0
32
+ },
33
+ "layer_norm_eps": 1e-12,
34
+ "lm_head": {
35
+ "act": null,
36
+ "bias": true,
37
+ "dropout": 0.0,
38
+ "hidden_size": 1280,
39
+ "layer_norm_eps": 1e-12,
40
+ "output_name": null,
41
+ "transform": "nonlinear",
42
+ "transform_act": "gelu"
43
+ },
44
+ "mask_token_id": 4,
45
+ "max_position_embeddings": 1026,
46
+ "model_type": "rnafm",
47
+ "null_token_id": 5,
48
+ "num_attention_heads": 20,
49
+ "num_hidden_layers": 12,
50
+ "pad_token_id": 0,
51
+ "position_embedding_type": "absolute",
52
+ "token_dropout": false,
53
+ "torch_dtype": "float32",
54
+ "transformers_version": "4.44.0",
55
+ "unk_token_id": 3,
56
+ "use_cache": true,
57
+ "vocab_size": 131
58
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b5d7ce63dd6d8ac87aff7b481450e2dd583312975ba926233b4aeaa5c4172f3
3
+ size 964287496
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6ded470f2545e3ff6e1a23a0e051d53bdf9416244842aba5245f0c8280bb73c7
3
+ size 964332182
special_tokens_map.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<null>"
4
+ ],
5
+ "bos_token": "<cls>",
6
+ "cls_token": "<cls>",
7
+ "eos_token": "<eos>",
8
+ "mask_token": "<mask>",
9
+ "pad_token": "<pad>",
10
+ "sep_token": "<eos>",
11
+ "unk_token": "<unk>"
12
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<pad>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<cls>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "<eos>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "<unk>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "4": {
36
+ "content": "<mask>",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ },
43
+ "5": {
44
+ "content": "<null>",
45
+ "lstrip": false,
46
+ "normalized": false,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": true
50
+ }
51
+ },
52
+ "additional_special_tokens": [
53
+ "<null>"
54
+ ],
55
+ "bos_token": "<cls>",
56
+ "clean_up_tokenization_spaces": true,
57
+ "cls_token": "<cls>",
58
+ "codon": true,
59
+ "eos_token": "<eos>",
60
+ "mask_token": "<mask>",
61
+ "model_max_length": 1024,
62
+ "nmers": 3,
63
+ "pad_token": "<pad>",
64
+ "replace_T_with_U": true,
65
+ "sep_token": "<eos>",
66
+ "tokenizer_class": "RnaTokenizer",
67
+ "unk_token": "<unk>"
68
+ }
vocab.txt ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <pad>
2
+ <cls>
3
+ <eos>
4
+ <unk>
5
+ <mask>
6
+ <null>
7
+ AAA
8
+ AAC
9
+ AAG
10
+ AAU
11
+ AAN
12
+ ACA
13
+ ACC
14
+ ACG
15
+ ACU
16
+ ACN
17
+ AGA
18
+ AGC
19
+ AGG
20
+ AGU
21
+ AGN
22
+ AUA
23
+ AUC
24
+ AUG
25
+ AUU
26
+ AUN
27
+ ANA
28
+ ANC
29
+ ANG
30
+ ANU
31
+ ANN
32
+ CAA
33
+ CAC
34
+ CAG
35
+ CAU
36
+ CAN
37
+ CCA
38
+ CCC
39
+ CCG
40
+ CCU
41
+ CCN
42
+ CGA
43
+ CGC
44
+ CGG
45
+ CGU
46
+ CGN
47
+ CUA
48
+ CUC
49
+ CUG
50
+ CUU
51
+ CUN
52
+ CNA
53
+ CNC
54
+ CNG
55
+ CNU
56
+ CNN
57
+ GAA
58
+ GAC
59
+ GAG
60
+ GAU
61
+ GAN
62
+ GCA
63
+ GCC
64
+ GCG
65
+ GCU
66
+ GCN
67
+ GGA
68
+ GGC
69
+ GGG
70
+ GGU
71
+ GGN
72
+ GUA
73
+ GUC
74
+ GUG
75
+ GUU
76
+ GUN
77
+ GNA
78
+ GNC
79
+ GNG
80
+ GNU
81
+ GNN
82
+ UAA
83
+ UAC
84
+ UAG
85
+ UAU
86
+ UAN
87
+ UCA
88
+ UCC
89
+ UCG
90
+ UCU
91
+ UCN
92
+ UGA
93
+ UGC
94
+ UGG
95
+ UGU
96
+ UGN
97
+ UUA
98
+ UUC
99
+ UUG
100
+ UUU
101
+ UUN
102
+ UNA
103
+ UNC
104
+ UNG
105
+ UNU
106
+ UNN
107
+ NAA
108
+ NAC
109
+ NAG
110
+ NAU
111
+ NAN
112
+ NCA
113
+ NCC
114
+ NCG
115
+ NCU
116
+ NCN
117
+ NGA
118
+ NGC
119
+ NGG
120
+ NGU
121
+ NGN
122
+ NUA
123
+ NUC
124
+ NUG
125
+ NUU
126
+ NUN
127
+ NNA
128
+ NNC
129
+ NNG
130
+ NNU
131
+ NNN