stephenjun8192 commited on
Commit
d797a6c
·
verified ·
1 Parent(s): 5e6175b

Upload esm2-35m-sparse50 sparse model from PharmaCore

Browse files
Files changed (6) hide show
  1. README.md +32 -0
  2. config.json +32 -0
  3. model.safetensors +3 -0
  4. sparsification_results.json +155 -0
  5. tokenizer_config.json +53 -0
  6. vocab.txt +33 -0
README.md ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - pharmacore
5
+ - sparse
6
+ - drug-discovery
7
+ - apple-silicon
8
+ base_model: facebook/esm2_t12_35M_UR50D
9
+ ---
10
+
11
+ # esm2-35m-sparse50 (PharmaCore Sparse)
12
+
13
+ 50% magnitude-pruned version of [facebook/esm2_t12_35M_UR50D](https://huggingface.co/facebook/esm2_t12_35M_UR50D)
14
+ for efficient drug discovery on Apple Silicon.
15
+
16
+ ## Key Stats
17
+ - **Sparsity:** 50%
18
+ - **Quality Retention:** 97.3%
19
+ - **Use Case:** Protein encoding in PharmaCore drug discovery pipeline
20
+
21
+ ## Usage
22
+
23
+ ```python
24
+ from transformers import AutoModel, AutoTokenizer
25
+
26
+ model = AutoModel.from_pretrained("stephenjun8192/esm2-35m-sparse50")
27
+ tokenizer = AutoTokenizer.from_pretrained("facebook/esm2_t12_35M_UR50D")
28
+ ```
29
+
30
+ ## Part of PharmaCore
31
+
32
+ [PharmaCore](https://github.com/stephenjun8192/PharmaCore) — Apple Silicon-native AI drug discovery platform.
config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_cross_attention": false,
3
+ "architectures": [
4
+ "EsmModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.0,
7
+ "classifier_dropout": null,
8
+ "dtype": "float32",
9
+ "emb_layer_norm_before": false,
10
+ "esmfold_config": null,
11
+ "hidden_act": "gelu",
12
+ "hidden_dropout_prob": 0.0,
13
+ "hidden_size": 480,
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 1920,
16
+ "is_decoder": false,
17
+ "is_folding_model": false,
18
+ "layer_norm_eps": 1e-05,
19
+ "mask_token_id": 32,
20
+ "max_position_embeddings": 1026,
21
+ "model_type": "esm",
22
+ "num_attention_heads": 20,
23
+ "num_hidden_layers": 12,
24
+ "pad_token_id": 1,
25
+ "position_embedding_type": "rotary",
26
+ "tie_word_embeddings": true,
27
+ "token_dropout": true,
28
+ "transformers_version": "5.5.4",
29
+ "use_cache": true,
30
+ "vocab_list": null,
31
+ "vocab_size": 33
32
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b77052485a6517e12a856ec1514b1efcc7bd0bde997106b1e91fc94d02a205fe
3
+ size 134025308
sparsification_results.json ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "/tmp/esm2_35m",
3
+ "sparsity_target": 0.5,
4
+ "pruning_target": "all",
5
+ "pre_pruning": {
6
+ "total_params": 33500401,
7
+ "zero_params": 673,
8
+ "sparsity_pct": 0.0,
9
+ "top_layers": {
10
+ "embeddings.word_embeddings.weight": {
11
+ "total": 15840,
12
+ "zeros": 0,
13
+ "sparsity": 0.0
14
+ },
15
+ "encoder.layer.0.attention.self.query.weight": {
16
+ "total": 230400,
17
+ "zeros": 0,
18
+ "sparsity": 0.0
19
+ },
20
+ "encoder.layer.0.attention.self.key.weight": {
21
+ "total": 230400,
22
+ "zeros": 0,
23
+ "sparsity": 0.0
24
+ },
25
+ "encoder.layer.0.attention.self.value.weight": {
26
+ "total": 230400,
27
+ "zeros": 0,
28
+ "sparsity": 0.0
29
+ },
30
+ "encoder.layer.0.attention.output.dense.weight": {
31
+ "total": 230400,
32
+ "zeros": 0,
33
+ "sparsity": 0.0
34
+ },
35
+ "encoder.layer.0.intermediate.dense.weight": {
36
+ "total": 921600,
37
+ "zeros": 0,
38
+ "sparsity": 0.0
39
+ },
40
+ "encoder.layer.0.intermediate.dense.bias": {
41
+ "total": 1920,
42
+ "zeros": 0,
43
+ "sparsity": 0.0
44
+ },
45
+ "encoder.layer.0.output.dense.weight": {
46
+ "total": 921600,
47
+ "zeros": 1,
48
+ "sparsity": 0.0
49
+ },
50
+ "encoder.layer.1.attention.self.query.weight": {
51
+ "total": 230400,
52
+ "zeros": 0,
53
+ "sparsity": 0.0
54
+ },
55
+ "encoder.layer.1.attention.self.key.weight": {
56
+ "total": 230400,
57
+ "zeros": 0,
58
+ "sparsity": 0.0
59
+ }
60
+ }
61
+ },
62
+ "post_pruning": {
63
+ "total_params": 33500401,
64
+ "zero_params": 16704659,
65
+ "sparsity_pct": 49.86,
66
+ "top_layers": {
67
+ "encoder.layer.0.attention.self.query.weight": {
68
+ "total": 230400,
69
+ "zeros": 115200,
70
+ "sparsity": 50.0
71
+ },
72
+ "encoder.layer.0.attention.self.key.weight": {
73
+ "total": 230400,
74
+ "zeros": 115200,
75
+ "sparsity": 50.0
76
+ },
77
+ "encoder.layer.0.attention.self.value.weight": {
78
+ "total": 230400,
79
+ "zeros": 115200,
80
+ "sparsity": 50.0
81
+ },
82
+ "encoder.layer.0.attention.output.dense.weight": {
83
+ "total": 230400,
84
+ "zeros": 115200,
85
+ "sparsity": 50.0
86
+ },
87
+ "encoder.layer.0.intermediate.dense.weight": {
88
+ "total": 921600,
89
+ "zeros": 460800,
90
+ "sparsity": 50.0
91
+ },
92
+ "encoder.layer.0.output.dense.weight": {
93
+ "total": 921600,
94
+ "zeros": 460800,
95
+ "sparsity": 50.0
96
+ },
97
+ "encoder.layer.1.attention.self.query.weight": {
98
+ "total": 230400,
99
+ "zeros": 115200,
100
+ "sparsity": 50.0
101
+ },
102
+ "encoder.layer.1.attention.self.key.weight": {
103
+ "total": 230400,
104
+ "zeros": 115200,
105
+ "sparsity": 50.0
106
+ },
107
+ "encoder.layer.1.attention.self.value.weight": {
108
+ "total": 230400,
109
+ "zeros": 115200,
110
+ "sparsity": 50.0
111
+ },
112
+ "encoder.layer.1.attention.output.dense.weight": {
113
+ "total": 230400,
114
+ "zeros": 115200,
115
+ "sparsity": 50.0
116
+ }
117
+ }
118
+ },
119
+ "quality": {
120
+ "per_protein_cosine_similarity": {
121
+ "insulin_human": 0.9178829789161682,
122
+ "insulin_mouse": 0.9191319942474365,
123
+ "egfr_fragment": 0.920665979385376,
124
+ "p53_fragment": 0.9336360096931458,
125
+ "hemoglobin_a": 0.9500190019607544,
126
+ "lysozyme": 0.9186660051345825,
127
+ "ubiquitin": 0.7709019780158997,
128
+ "cytochrome_c": 0.8732290267944336
129
+ },
130
+ "average_cosine_similarity": 0.900517,
131
+ "pairwise_rank_correlation": 0.558292,
132
+ "insulin_pair_similarity": 0.995582
133
+ },
134
+ "benchmark_original": {
135
+ "device": "mps",
136
+ "n_runs": 20,
137
+ "mean_ms": 8.46,
138
+ "std_ms": 0.17,
139
+ "min_ms": 8.22,
140
+ "max_ms": 8.78,
141
+ "throughput_seqs_per_sec": 118.2
142
+ },
143
+ "benchmark_sparse": {
144
+ "device": "mps",
145
+ "n_runs": 20,
146
+ "mean_ms": 5.97,
147
+ "std_ms": 0.2,
148
+ "min_ms": 5.69,
149
+ "max_ms": 6.42,
150
+ "throughput_seqs_per_sec": 167.6
151
+ },
152
+ "speedup": 1.417,
153
+ "device": "mps",
154
+ "torch_version": "2.11.0"
155
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<cls>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<pad>",
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
+ "32": {
36
+ "content": "<mask>",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "backend": "custom",
45
+ "cls_token": "<cls>",
46
+ "eos_token": "<eos>",
47
+ "is_local": true,
48
+ "mask_token": "<mask>",
49
+ "model_max_length": 1000000000000000019884624838656,
50
+ "pad_token": "<pad>",
51
+ "tokenizer_class": "EsmTokenizer",
52
+ "unk_token": "<unk>"
53
+ }
vocab.txt ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <cls>
2
+ <pad>
3
+ <eos>
4
+ <unk>
5
+ L
6
+ A
7
+ G
8
+ V
9
+ S
10
+ E
11
+ R
12
+ T
13
+ I
14
+ D
15
+ P
16
+ K
17
+ Q
18
+ N
19
+ F
20
+ Y
21
+ M
22
+ H
23
+ W
24
+ C
25
+ X
26
+ B
27
+ U
28
+ Z
29
+ O
30
+ .
31
+ -
32
+ <null_1>
33
+ <mask>