ZhiyuanChen commited on
Commit
cfa554f
1 Parent(s): afe9626

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,312 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: rna
3
+ tags:
4
+ - Biology
5
+ - RNA
6
+ license: agpl-3.0
7
+ datasets:
8
+ - multimolecule/ensembl-genome-browser
9
+ library_name: multimolecule
10
+ pipeline_tag: fill-mask
11
+ mask_token: "<mask>"
12
+ widget:
13
+ - example_title: "microRNA-21"
14
+ text: "UAGC<mask>UAUCAGACUGAUGUUGA"
15
+ output:
16
+ - label: "I"
17
+ score: 0.07525687664747238
18
+ - label: "A"
19
+ score: 0.07319962233304977
20
+ - label: "*"
21
+ score: 0.07106836140155792
22
+ - label: "N"
23
+ score: 0.06967106461524963
24
+ - label: "W"
25
+ score: 0.06574146449565887
26
+ ---
27
+
28
+ # UTR-LM
29
+
30
+ Pre-trained model on 5’ untranslated region (5’UTR) using masked language modeling (MLM), Secondary Structure (SS), and Minimum Free Energy (MFE) objectives.
31
+
32
+ ## Statement
33
+
34
+ _A 5’ UTR Language Model for Decoding Untranslated Regions of mRNA and Function Predictions_ is published in [Nature Machine Intelligence](https://doi.org/10.1038/s42256-024-00823-9), which is a Closed Access / Author-Fee journal.
35
+
36
+ > Machine learning has been at the forefront of the movement for free and open access to research.
37
+ >
38
+ > We see no role for closed access or author-fee publication in the future of machine learning research and believe the adoption of these journals as an outlet of record for the machine learning community would be a retrograde step.
39
+
40
+ The MultiMolecule team is committed to the principles of open access and open science.
41
+
42
+ We do NOT endorse the publication of manuscripts in Closed Access / Author-Fee journals and encourage the community to support Open Access journals.
43
+
44
+ Please consider signing the [Statement on Nature Machine Intelligence](https://openaccess.engineering.oregonstate.edu).
45
+
46
+ ## Disclaimer
47
+
48
+ This is an UNOFFICIAL implementation of the [A 5’ UTR Language Model for Decoding Untranslated Regions of mRNA and Function Predictions](https://doi.org/10.1101/2023.10.11.561938) by Yanyi Chu, Dan Yu, et al.
49
+
50
+ The OFFICIAL repository of UTR-LM is at [a96123155/UTR-LM](https://github.com/a96123155/UTR-LM).
51
+
52
+ !!! Danger "Reproducibility"
53
+
54
+ The MultiMolecule team is unable to confirm that the provided model and checkpoints are producing the same intermediate representations as the original implementation.
55
+ This is because
56
+
57
+ The proposed method is published in a Closed Access / Author-Fee journal.
58
+
59
+ **The team releasing UTR-LM did not write this model card for this model so this model card has been written by the MultiMolecule team.**
60
+
61
+ ## Model Details
62
+
63
+ UTR-LM is a [bert](https://huggingface.co/google-bert/bert-base-uncased)-style model pre-trained on a large corpus of 5’ untranslated regions (5’UTRs) 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.
64
+
65
+ ### Variations
66
+
67
+ - **[`multimolecule/utrlm.te_el`](https://huggingface.co/multimolecule/utrlm.te_el)**: The UTR-LM model for Translation Efficiency of transcripts and mRNA Expression Level.
68
+ - **[`multimolecule/utrlm.mrl`](https://huggingface.co/multimolecule/utrlm.mrl)**: The UTR-LM model for Mean Ribosome Loading.
69
+
70
+ ### Model Specification
71
+
72
+ <table>
73
+ <thead>
74
+ <tr>
75
+ <th>Variants</th>
76
+ <th>Num Layers</th>
77
+ <th>Hidden Size</th>
78
+ <th>Num Heads</th>
79
+ <th>Intermediate Size</th>
80
+ <th>Num Parameters (M)</th>
81
+ <th>FLOPs (G)</th>
82
+ <th>MACs (G)</th>
83
+ <th>Max Num Tokens</th>
84
+ </tr>
85
+ </thead>
86
+ <tbody>
87
+ <tr>
88
+ <td>UTR-LM MRL</td>
89
+ <td rowspan="2">6</td>
90
+ <td rowspan="2">128</td>
91
+ <td rowspan="2">16</td>
92
+ <td rowspan="2">512</td>
93
+ <td rowspan="2">1.21</td>
94
+ <td rowspan="2">0.35</td>
95
+ <td rowspan="2">0.18</td>
96
+ <td rowspan="2">1022</td>
97
+ </tr>
98
+ <tr>
99
+ <td>UTR-LM TE_EL</td>
100
+ </tr>
101
+ </tbody>
102
+ </table>
103
+
104
+ ### Links
105
+
106
+ - **Code**: [multimolecule.utrlm](https://github.com/DLS5-Omics/multimolecule/tree/master/multimolecule/models/utrlm)
107
+ - **Data**:
108
+ - [Ensembl Genome Browser](https://ensembl.org)
109
+ - [Human 5′ UTR design and variant effect prediction from a massively parallel translation assay](https://doi.org/10.1038/s41587-019-0164-5)
110
+ - [High-Throughput 5’ UTR Engineering for Enhanced Protein Production in Non-Viral Gene Therapies](https://doi.org/10.1101/2021.10.14.464013)
111
+ - **Paper**: [A 5’ UTR Language Model for Decoding Untranslated Regions of mRNA and Function Predictions](http://doi.org/10.1038/s41467-021-24436-7)
112
+ - **Developed by**: Yanyi Chu, Dan Yu, Yupeng Li, Kaixuan Huang, Yue Shen, Le Cong, Jason Zhang, Mengdi Wang
113
+ - **Model type**: [BERT](https://huggingface.co/google-bert/bert-base-uncased) - [ESM](https://huggingface.co/facebook/esm2_t48_15B_UR50D)
114
+ - **Original Repository**: [https://github.com/a96123155/UTR-LM](https://github.com/a96123155/UTR-LM)
115
+
116
+ ## Usage
117
+
118
+ The model file depends on the [`multimolecule`](https://multimolecule.danling.org) library. You can install it using pip:
119
+
120
+ ```bash
121
+ pip install multimolecule
122
+ ```
123
+
124
+ ### Direct Use
125
+
126
+ You can use this model directly with a pipeline for masked language modeling:
127
+
128
+ ```python
129
+ >>> import multimolecule # you must import multimolecule to register models
130
+ >>> from transformers import pipeline
131
+ >>> unmasker = pipeline('fill-mask', model='multimolecule/utrlm.te_el')
132
+ >>> unmasker("uagc<mask>uaucagacugauguuga")
133
+
134
+ [{'score': 0.07525687664747238,
135
+ 'token': 11,
136
+ 'token_str': 'I',
137
+ 'sequence': 'U A G C I U A U C A G A C U G A U G U U G A'},
138
+ {'score': 0.07319962233304977,
139
+ 'token': 6,
140
+ 'token_str': 'A',
141
+ 'sequence': 'U A G C A U A U C A G A C U G A U G U U G A'},
142
+ {'score': 0.07106836140155792,
143
+ 'token': 24,
144
+ 'token_str': '*',
145
+ 'sequence': 'U A G C * U A U C A G A C U G A U G U U G A'},
146
+ {'score': 0.06967106461524963,
147
+ 'token': 10,
148
+ 'token_str': 'N',
149
+ 'sequence': 'U A G C N U A U C A G A C U G A U G U U G A'},
150
+ {'score': 0.06574146449565887,
151
+ 'token': 19,
152
+ 'token_str': 'W',
153
+ 'sequence': 'U A G C W U A U C A G A C U G A U G U U G A'}]
154
+ ```
155
+
156
+ ### Downstream Use
157
+
158
+ #### Extract Features
159
+
160
+ Here is how to use this model to get the features of a given sequence in PyTorch:
161
+
162
+ ```python
163
+ from multimolecule import RnaTokenizer, UtrLmModel
164
+
165
+
166
+ tokenizer = RnaTokenizer.from_pretrained('multimolecule/utrlm.te_el')
167
+ model = UtrLmModel.from_pretrained('multimolecule/utrlm.te_el')
168
+
169
+ text = "UAGCUUAUCAGACUGAUGUUGA"
170
+ input = tokenizer(text, return_tensors='pt')
171
+
172
+ output = model(**input)
173
+ ```
174
+
175
+ #### Sequence Classification / Regression
176
+
177
+ **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.
178
+
179
+ Here is how to use this model as backbone to fine-tune for a sequence-level task in PyTorch:
180
+
181
+ ```python
182
+ import torch
183
+ from multimolecule import RnaTokenizer, UtrLmForSequencePrediction
184
+
185
+
186
+ tokenizer = RnaTokenizer.from_pretrained('multimolecule/utrlm.te_el')
187
+ model = UtrLmForSequencePrediction.from_pretrained('multimolecule/utrlm.te_el')
188
+
189
+ text = "UAGCUUAUCAGACUGAUGUUGA"
190
+ input = tokenizer(text, return_tensors='pt')
191
+ label = torch.tensor([1])
192
+
193
+ output = model(**input, labels=label)
194
+ ```
195
+
196
+ #### Nucleotide Classification / Regression
197
+
198
+ **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.
199
+
200
+ Here is how to use this model as backbone to fine-tune for a nucleotide-level task in PyTorch:
201
+
202
+ ```python
203
+ import torch
204
+ from multimolecule import RnaTokenizer, UtrLmForNucleotidePrediction
205
+
206
+
207
+ tokenizer = RnaTokenizer.from_pretrained('multimolecule/utrlm.te_el')
208
+ model = UtrLmForNucleotidePrediction.from_pretrained('multimolecule/utrlm.te_el')
209
+
210
+ text = "UAGCUUAUCAGACUGAUGUUGA"
211
+ input = tokenizer(text, return_tensors='pt')
212
+ label = torch.randint(2, (len(text), ))
213
+
214
+ output = model(**input, labels=label)
215
+ ```
216
+
217
+ #### Contact Classification / Regression
218
+
219
+ **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.
220
+
221
+ Here is how to use this model as backbone to fine-tune for a contact-level task in PyTorch:
222
+
223
+ ```python
224
+ import torch
225
+ from multimolecule import RnaTokenizer, UtrLmForContactPrediction
226
+
227
+
228
+ tokenizer = RnaTokenizer.from_pretrained('multimolecule/utrlm')
229
+ model = UtrLmForContactPrediction.from_pretrained('multimolecule/utrlm')
230
+
231
+ text = "UAGCUUAUCAGACUGAUGUUGA"
232
+ input = tokenizer(text, return_tensors='pt')
233
+ label = torch.randint(2, (len(text), len(text)))
234
+
235
+ output = model(**input, labels=label)
236
+ ```
237
+
238
+ ## Training Details
239
+
240
+ UTR-LM used a mixed training strategy with one self-supervised task and two supervised tasks, where the labels of both supervised tasks are calculated using [ViennaRNA](https://viennarna.readthedocs.io).
241
+
242
+ 1. **Masked Language Modeling (MLM)**: 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.
243
+ 2. **Secondary Structure (SS)**: predicting the secondary structure of the `<mask>` token in the MLM task.
244
+ 3. **Minimum Free Energy (MFE)**: predicting the minimum free energy of the 5’ UTR sequence.
245
+
246
+ ### Training Data
247
+
248
+ The UTR-LM model was pre-trained on 5’ UTR sequences from three sources:
249
+
250
+ - **[Ensembl Genome Browser](https://ensembl.org)**: Ensembl is a genome browser for vertebrate genomes that supports research in comparative genomics, evolution, sequence variation and transcriptional regulation. UTR-LM used 5’ UTR sequences from 5 species: human, rat, mouse, chicken, and zebrafish, since these species have high-quality and manual gene annotations.
251
+ - **[Human 5′ UTR design and variant effect prediction from a massively parallel translation assay](https://doi.org/10.1038/s41587-019-0164-5)**: Sample et al. proposed 8 distinct 5' UTR libraries, each containing random 50 nucleotide sequences, to evaluate translation rules using mean ribosome loading (MRL) measurements.
252
+ - **[High-Throughput 5’ UTR Engineering for Enhanced Protein Production in Non-Viral Gene Therapies](https://doi.org/10.1038/s41467-021-24436-7)**: Cao et al. analyzed endogenous human 5’ UTRs, including data from 3 distinct cell lines/tissues: human embryonic kidney 293T (HEK), human prostate cancer cell (PC3), and human muscle tissue (Muscle).
253
+
254
+ UTR-LM preprocessed the 5’ UTR sequences in a 4-step pipeline:
255
+
256
+ 1. removed all coding sequence (CDS) and non-5' UTR fragments from the raw sequences.
257
+ 2. identified and removed duplicate sequences
258
+ 3. truncated the sequences to fit within a range of 30 to 1022 bp
259
+ 4. filtered out incorrect and low-quality sequences
260
+
261
+ Note [`RnaTokenizer`][multimolecule.RnaTokenizer] will convert "T"s to "U"s for you, you may disable this behaviour by passing `replace_T_with_U=False`.
262
+
263
+ ### Training Procedure
264
+
265
+ #### Preprocessing
266
+
267
+ UTR-LM used masked language modeling (MLM) as one of the pre-training objectives. The masking procedure is similar to the one used in BERT:
268
+
269
+ - 15% of the tokens are masked.
270
+ - In 80% of the cases, the masked tokens are replaced by `<mask>`.
271
+ - In 10% of the cases, the masked tokens are replaced by a random token (different) from the one they replace.
272
+ - In the 10% remaining cases, the masked tokens are left as is.
273
+
274
+ #### PreTraining
275
+
276
+ The model was trained on two clusters:
277
+
278
+ 1. 4 NVIDIA V100 GPUs with 16GiB memories.
279
+ 2. 4 NVIDIA P100 GPUs with 32GiB memories.
280
+
281
+ ## Citation
282
+
283
+ **BibTeX**:
284
+
285
+ ```bibtex
286
+ @article {chu2023a,
287
+ author = {Chu, Yanyi and Yu, Dan and Li, Yupeng and Huang, Kaixuan and Shen, Yue and Cong, Le and Zhang, Jason and Wang, Mengdi},
288
+ title = {A 5{\textquoteright} UTR Language Model for Decoding Untranslated Regions of mRNA and Function Predictions},
289
+ elocation-id = {2023.10.11.561938},
290
+ year = {2023},
291
+ doi = {10.1101/2023.10.11.561938},
292
+ publisher = {Cold Spring Harbor Laboratory},
293
+ abstract = {The 5{\textquoteright} UTR, a regulatory region at the beginning of an mRNA molecule, plays a crucial role in regulating the translation process and impacts the protein expression level. Language models have showcased their effectiveness in decoding the functions of protein and genome sequences. Here, we introduced a language model for 5{\textquoteright} UTR, which we refer to as the UTR-LM. The UTR-LM is pre-trained on endogenous 5{\textquoteright} UTRs from multiple species and is further augmented with supervised information including secondary structure and minimum free energy. We fine-tuned the UTR-LM in a variety of downstream tasks. The model outperformed the best-known benchmark by up to 42\% for predicting the Mean Ribosome Loading, and by up to 60\% for predicting the Translation Efficiency and the mRNA Expression Level. The model also applies to identifying unannotated Internal Ribosome Entry Sites within the untranslated region and improves the AUPR from 0.37 to 0.52 compared to the best baseline. Further, we designed a library of 211 novel 5{\textquoteright} UTRs with high predicted values of translation efficiency and evaluated them via a wet-lab assay. Experiment results confirmed that our top designs achieved a 32.5\% increase in protein production level relative to well-established 5{\textquoteright} UTR optimized for therapeutics.Competing Interest StatementThe authors have declared no competing interest.},
294
+ URL = {https://www.biorxiv.org/content/early/2023/10/14/2023.10.11.561938},
295
+ eprint = {https://www.biorxiv.org/content/early/2023/10/14/2023.10.11.561938.full.pdf},
296
+ journal = {bioRxiv}
297
+ }
298
+ ```
299
+
300
+ ## Contact
301
+
302
+ Please use GitHub issues of [MultiMolecule](https://github.com/DLS5-Omics/multimolecule/issues) for any questions or comments on the model card.
303
+
304
+ Please contact the authors of the [UTR-LM paper](https://doi.org/10.1101/2023.10.11.561938) for questions or comments on the paper/model.
305
+
306
+ ## License
307
+
308
+ This model is licensed under the [AGPL-3.0 License](https://www.gnu.org/licenses/agpl-3.0.html).
309
+
310
+ ```spdx
311
+ SPDX-License-Identifier: AGPL-3.0-or-later
312
+ ```
config.json ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "UtrLmForPreTraining"
4
+ ],
5
+ "attention_dropout": 0.1,
6
+ "bos_token_id": 1,
7
+ "emb_layer_norm_before": false,
8
+ "eos_token_id": 2,
9
+ "head": {
10
+ "act": null,
11
+ "bias": true,
12
+ "dropout": 0.0,
13
+ "hidden_size": 128,
14
+ "layer_norm_eps": 1e-12,
15
+ "num_labels": 1,
16
+ "output_name": null,
17
+ "problem_type": null,
18
+ "transform": null,
19
+ "transform_act": "gelu"
20
+ },
21
+ "hidden_act": "gelu",
22
+ "hidden_dropout": 0.1,
23
+ "hidden_size": 128,
24
+ "id2label": {
25
+ "0": "LABEL_0"
26
+ },
27
+ "initializer_range": 0.02,
28
+ "intermediate_size": 512,
29
+ "label2id": {
30
+ "LABEL_0": 0
31
+ },
32
+ "layer_norm_eps": 1e-12,
33
+ "lm_head": {
34
+ "act": null,
35
+ "bias": true,
36
+ "dropout": 0.0,
37
+ "hidden_size": 128,
38
+ "layer_norm_eps": 1e-12,
39
+ "output_name": null,
40
+ "transform": "nonlinear",
41
+ "transform_act": "gelu"
42
+ },
43
+ "mask_token_id": 4,
44
+ "max_position_embeddings": 1026,
45
+ "mfe_head": {
46
+ "act": null,
47
+ "bias": true,
48
+ "dropout": 0.0,
49
+ "hidden_size": 128,
50
+ "layer_norm_eps": 1e-12,
51
+ "num_labels": 1,
52
+ "output_name": null,
53
+ "problem_type": null,
54
+ "transform": null,
55
+ "transform_act": "gelu"
56
+ },
57
+ "model_type": "utrlm",
58
+ "null_token_id": 5,
59
+ "num_attention_heads": 16,
60
+ "num_hidden_layers": 6,
61
+ "pad_token_id": 0,
62
+ "position_embedding_type": "rotary",
63
+ "ss_head": null,
64
+ "token_dropout": false,
65
+ "torch_dtype": "float32",
66
+ "transformers_version": "4.41.2",
67
+ "unk_token_id": 3,
68
+ "use_cache": true,
69
+ "vocab_size": 26
70
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:405e6388742ffd9bc699d496e300fe9eaccecfe95cab0333a47a983e491c6c38
3
+ size 4934888
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e905345a4b78c13edbdc767c738e181d50582ed08809cb083873747f6f79b165
3
+ size 4960618
special_tokens_map.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "pad_token": {
3
+ "content": "<pad>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "<cls>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "<eos>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "unk_token": {
24
+ "content": "<unk>",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "mask_token": {
31
+ "content": "<mask>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "null_token": {
38
+ "content": "<null>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ }
44
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "tokenizer_class": "RnaTokenizer",
3
+ "clean_up_tokenization_spaces": true
4
+ }