mattwoodx commited on
Commit
c8a2f3d
·
1 Parent(s): d933223

Upload weights and config

Browse files
Files changed (3) hide show
  1. README.md +61 -0
  2. config.json +46 -0
  3. model.safetensors +3 -0
README.md CHANGED
@@ -1,3 +1,64 @@
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
+ - Sequence
10
+ library_name: transformers
11
  ---
12
+ # Helix-mRNA
13
+ Helix-mRNA emerges as a hybrid state-space and transformer based model, leveraging both the efficient sequence processing capabilities of Mamba2's state-space architecture and the contextual understanding of transformer attention mechanisms, allowing for the best of both worlds between these two approaches. These traits make it particularly suitable for studying full-length transcripts, splice variants, and complex mRNA structural elements.
14
+
15
+ We tokenize mRNA sequences at single-nucleotide resolution by mapping each nucleotide (A, C, U, G) and ambiguous base (N) to a unique integer. A further special character E is incorporated into the sequence, denoting the start of each codon. This fine-grained approach maximizes the model's ability to extract patterns from the sequences. Unlike coarser tokenization methods that might group nucleotides together or use k-mer based approaches, our single-nucleotide resolution preserves the full sequential information of the mRNA molecule. This simple yet effective encoding scheme ensures that no information is lost during the preprocessing stage, allowing the downstream model to learn directly from the raw sequence composition.
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 HelixmRNA, HelixmRNAConfig
29
+ import torch
30
+
31
+ device = "cuda" if torch.cuda.is_available() else "cpu"
32
+
33
+ input_sequences = ["EACU"*20, "EAUG"*20, "EAUG"*20, "EACU"*20, "EAUU"*20]
34
+
35
+ helix_mrna_config = HelixmRNAConfig(batch_size=5, device=device, max_length=100)
36
+ helix_mrna = HelixmRNA()
37
+
38
+ # prepare data for input to the model
39
+ processed_input_data = helix_mrna.process_data(input_sequences)
40
+
41
+ # generate the embeddings for the processed data
42
+ embeddings = helix_mrna.get_embeddings(processed_input_data)
43
+ ```
44
+
45
+ #### Fine-Tuning
46
+ Classification fine-tuning example:
47
+ ```python
48
+ from helical import HelixmRNAFineTuningModel, HelixmRNAConfig
49
+ import torch
50
+
51
+ device = "cuda" if torch.cuda.is_available() else "cpu"
52
+
53
+ input_sequences = ["EACU"*20, "EAUG"*20, "EAUG"*20, "EACU"*20, "EAUU"*20]
54
+ labels = [0, 2, 2, 0, 1]
55
+
56
+ helixr_config = HelixmRNAConfig(batch_size=5, device=device)
57
+ helixr_fine_tune = HelixmRNAFineTuningModel(helix_mrna_config=helixr_config, output_size=3, max_length=100)
58
+
59
+ train_dataset = helixr_fine_tune.process_data(input_sequences)
60
+
61
+ helixr_fine_tune.train(train_dataset=train_dataset, train_labels=labels)
62
+
63
+ outputs = helixr_fine_tune.get_outputs(train_dataset)
64
+ ```
config.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/home/models/helix-mRNA/helix_mrna_8l_256h_5.1883Mio_12288_2024-11-30_18-51-46/checkpoint-23000",
3
+ "architectures": [
4
+ "HelixmRNAForCausalLM"
5
+ ],
6
+ "attention_dropout": 0.0,
7
+ "attn_implementation": "flash_attention_2",
8
+ "bos_token_id": 0,
9
+ "chunk_size": 256,
10
+ "conv_kernel": 4,
11
+ "eos_token_id": 2,
12
+ "expand": 2,
13
+ "head_dim": 32,
14
+ "hidden_act": "silu",
15
+ "hidden_size": 256,
16
+ "initializer_range": 0.1,
17
+ "intermediate_size": 512,
18
+ "layer_norm_epsilon": 1e-05,
19
+ "layers_block_type_string": "M+M*M+M+",
20
+ "model_type": "mamba2",
21
+ "n_groups": 1,
22
+ "num_attention_heads": 32,
23
+ "num_heads": 16,
24
+ "num_hidden_layers": 8,
25
+ "num_key_value_heads": 8,
26
+ "pad_token_id": 1,
27
+ "rescale_prenorm_residual": false,
28
+ "residual_in_fp32": true,
29
+ "rms_norm": true,
30
+ "state_size": 128,
31
+ "tie_word_embeddings": false,
32
+ "time_step_floor": 0.0001,
33
+ "time_step_limit": [
34
+ 0.0,
35
+ Infinity
36
+ ],
37
+ "time_step_max": 0.1,
38
+ "time_step_min": 0.001,
39
+ "time_step_rank": 16,
40
+ "torch_dtype": "float32",
41
+ "transformers_version": "4.45.1",
42
+ "use_bias": false,
43
+ "use_cache": false,
44
+ "use_conv_bias": true,
45
+ "vocab_size": 14
46
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0c0e977c4a14516495048cb5e08ec7998ec8a2a02c0f274e15c3515cae254be4
3
+ size 10382896