mattwoodx commited on
Commit
296c003
1 Parent(s): 821c381

Add model weights and configs

Browse files
README.md CHANGED
@@ -1,3 +1,66 @@
1
  ---
2
  license: cc-by-nc-sa-4.0
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: cc-by-nc-sa-4.0
3
+ tags:
4
+ - Helical
5
+ - RNA
6
+ - Biology
7
+ - Transformers
8
+ - Genomics
9
+ - Mamba2
10
+ - Sequence
11
+ library_name: transformers
12
  ---
13
+ # Mamba2-mRNA
14
+ 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.
15
+
16
+ # Helical<a name="helical"></a>
17
+
18
+ #### Install the package
19
+
20
+ Run the following to install the [Helical](https://github.com/helicalAI/helical) package via pip:
21
+ ```console
22
+ pip install --upgrade helical
23
+ ```
24
+
25
+ #### Generate Embeddings
26
+ ```python
27
+ from helical import Mamba2mRNA, Mamba2mRNAConfig
28
+ import torch
29
+
30
+ device = "cuda" if torch.cuda.is_available() else "cpu"
31
+
32
+ input_sequences = ["ACU"*20, "AUG"*20, "AUG"*20, "ACU"*20, "AUU"*20]
33
+
34
+ mamba2_mrna_config = Mamba2mRNAConfig(batch_size=5, device=device)
35
+ mamba2_mrna = Mamba2mRNA(configurer=mamba2_mrna_config)
36
+
37
+ # prepare data for input to the model
38
+ processed_input_data = mamba2_mrna.process_data(input_sequences)
39
+
40
+ # generate the embeddings for the input data
41
+ embeddings = mamba2_mrna.get_embeddings(processed_input_data)
42
+ ```
43
+
44
+ #### Fine-Tuning
45
+ Classification fine-tuning example:
46
+ ```python
47
+ from helical import Mamba2mRNAFineTuningModel, Mamba2mRNAConfig
48
+ import torch
49
+
50
+ device = "cuda" if torch.cuda.is_available() else "cpu"
51
+
52
+ input_sequences = ["ACU"*20, "AUG"*20, "AUG"*20, "ACU"*20, "AUU"*20]
53
+ labels = [0, 2, 2, 0, 1]
54
+
55
+ mamba2_mrna_config = Mamba2mRNAConfig(batch_size=5, device=device, max_length=100)
56
+ mamba2_mrna_fine_tune = Mamba2mRNAFineTuningModel(mamba2_mrna_config=mamba2_mrna_config, fine_tuning_head="classification", output_size=3)
57
+
58
+ # prepare data for input to the model
59
+ train_dataset = mamba2_mrna_fine_tune.process_data(input_sequences)
60
+
61
+ # fine-tune the model with the relevant training labels
62
+ mamba2_mrna_fine_tune.train(train_dataset=train_dataset, train_labels=labels)
63
+
64
+ # get outputs from the fine-tuned model on a processed dataset
65
+ outputs = mamba2_mrna_fine_tune.get_outputs(train_dataset)
66
+ ```
config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Mamba2ForCausalLM"
4
+ ],
5
+ "bos_token_id": 0,
6
+ "chunk_size": 256,
7
+ "conv_kernel": 4,
8
+ "eos_token_id": 2,
9
+ "expand": 2,
10
+ "head_dim": 32,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 512,
13
+ "initializer_range": 0.1,
14
+ "layer_norm_epsilon": 1e-05,
15
+ "model_type": "mamba2",
16
+ "n_groups": 1,
17
+ "num_heads": 32,
18
+ "num_hidden_layers": 16,
19
+ "pad_token_id": 1,
20
+ "rescale_prenorm_residual": false,
21
+ "residual_in_fp32": true,
22
+ "rms_norm": true,
23
+ "state_size": 128,
24
+ "tie_word_embeddings": false,
25
+ "time_step_floor": 0.0001,
26
+ "time_step_limit": [
27
+ 0.0,
28
+ Infinity
29
+ ],
30
+ "time_step_max": 0.1,
31
+ "time_step_min": 0.001,
32
+ "time_step_rank": 32,
33
+ "torch_dtype": "float32",
34
+ "transformers_version": "4.45.1",
35
+ "use_bias": false,
36
+ "use_cache": true,
37
+ "use_conv_bias": true,
38
+ "vocab_size": 13
39
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e890c76d8e9775c00ccd7c12a988ea5aa90d8630d5cd6c52dce481acff98d6c0
3
+ size 110684944
special_tokens_map.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "[BOS]",
3
+ "cls_token": "[CLS]",
4
+ "eos_token": "[SEP]",
5
+ "mask_token": "[MASK]",
6
+ "pad_token": "[PAD]",
7
+ "sep_token": "[SEP]",
8
+ "unk_token": "[UNK]"
9
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "0": {
5
+ "content": "[CLS]",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "1": {
13
+ "content": "[SEP]",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "2": {
21
+ "content": "[BOS]",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "3": {
29
+ "content": "[MASK]",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "4": {
37
+ "content": "[PAD]",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "6": {
45
+ "content": "[UNK]",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ }
52
+ },
53
+ "bos_token": "[BOS]",
54
+ "clean_up_tokenization_spaces": false,
55
+ "cls_token": "[CLS]",
56
+ "eos_token": "[SEP]",
57
+ "mask_token": "[MASK]",
58
+ "model_max_length": 8000,
59
+ "pad_token": "[PAD]",
60
+ "padding_side": "left",
61
+ "sep_token": "[SEP]",
62
+ "tokenizer_class": "CharTokenizer",
63
+ "unk_token": "[UNK]"
64
+ }