Update README.md
Browse files
README.md
CHANGED
@@ -1,66 +1,67 @@
|
|
1 |
-
---
|
2 |
-
license: cc-by-nc-sa-4.0
|
3 |
-
tags:
|
4 |
-
- Helical
|
5 |
-
-
|
6 |
-
-
|
7 |
-
-
|
8 |
-
-
|
9 |
-
-
|
10 |
-
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
import
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
embeddings
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
import
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
outputs
|
66 |
-
|
|
|
|
1 |
+
---
|
2 |
+
license: cc-by-nc-sa-4.0
|
3 |
+
tags:
|
4 |
+
- Helical
|
5 |
+
- rna
|
6 |
+
- mrna
|
7 |
+
- biology
|
8 |
+
- transformers
|
9 |
+
- mamba2
|
10 |
+
- sequence
|
11 |
+
- genomics
|
12 |
+
library_name: transformers
|
13 |
+
---
|
14 |
+
# Mamba2-mRNA
|
15 |
+
Mamba2-mRNA is a state-space model built on the Mamba2 architecture, trained at single-nucleotide resolution. This innovative model offers several advantages, including faster processing speeds compared to traditional transformer models, efficient handling of long sequences, and reduced memory requirements. Its state-space approach enables better modeling of biological sequences by capturing both local and long-range dependencies in mRNA data. The single-nucleotide resolution allows for precise prediction and analysis of genetic elements.
|
16 |
+
|
17 |
+
# Helical<a name="helical"></a>
|
18 |
+
|
19 |
+
#### Install the package
|
20 |
+
|
21 |
+
Run the following to install the [Helical](https://github.com/helicalAI/helical) package via pip:
|
22 |
+
```console
|
23 |
+
pip install --upgrade helical
|
24 |
+
```
|
25 |
+
|
26 |
+
#### Generate Embeddings
|
27 |
+
```python
|
28 |
+
from helical import Mamba2mRNA, Mamba2mRNAConfig
|
29 |
+
import torch
|
30 |
+
|
31 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
32 |
+
|
33 |
+
input_sequences = ["ACU"*20, "AUG"*20, "AUG"*20, "ACU"*20, "AUU"*20]
|
34 |
+
|
35 |
+
mamba2_mrna_config = Mamba2mRNAConfig(batch_size=5, device=device)
|
36 |
+
mamba2_mrna = Mamba2mRNA(configurer=mamba2_mrna_config)
|
37 |
+
|
38 |
+
# prepare data for input to the model
|
39 |
+
processed_input_data = mamba2_mrna.process_data(input_sequences)
|
40 |
+
|
41 |
+
# generate the embeddings for the input data
|
42 |
+
embeddings = mamba2_mrna.get_embeddings(processed_input_data)
|
43 |
+
```
|
44 |
+
|
45 |
+
#### Fine-Tuning
|
46 |
+
Classification fine-tuning example:
|
47 |
+
```python
|
48 |
+
from helical import Mamba2mRNAFineTuningModel, Mamba2mRNAConfig
|
49 |
+
import torch
|
50 |
+
|
51 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
52 |
+
|
53 |
+
input_sequences = ["ACU"*20, "AUG"*20, "AUG"*20, "ACU"*20, "AUU"*20]
|
54 |
+
labels = [0, 2, 2, 0, 1]
|
55 |
+
|
56 |
+
mamba2_mrna_config = Mamba2mRNAConfig(batch_size=5, device=device, max_length=100)
|
57 |
+
mamba2_mrna_fine_tune = Mamba2mRNAFineTuningModel(mamba2_mrna_config=mamba2_mrna_config, fine_tuning_head="classification", output_size=3)
|
58 |
+
|
59 |
+
# prepare data for input to the model
|
60 |
+
train_dataset = mamba2_mrna_fine_tune.process_data(input_sequences)
|
61 |
+
|
62 |
+
# fine-tune the model with the relevant training labels
|
63 |
+
mamba2_mrna_fine_tune.train(train_dataset=train_dataset, train_labels=labels)
|
64 |
+
|
65 |
+
# get outputs from the fine-tuned model on a processed dataset
|
66 |
+
outputs = mamba2_mrna_fine_tune.get_outputs(train_dataset)
|
67 |
+
```
|