stephenjun8192 commited on
Commit
ed19e5d
·
verified ·
1 Parent(s): c4a69ce

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +77 -8
README.md CHANGED
@@ -1,32 +1,101 @@
1
  ---
2
  license: mit
 
 
3
  tags:
4
  - pharmacore
5
  - sparse
6
  - drug-discovery
7
  - apple-silicon
 
 
 
 
 
 
 
 
8
  base_model: seyonec/ChemBERTa-zinc-base-v1
 
 
 
 
 
 
 
 
 
 
9
  ---
10
 
11
- # chemberta-zinc-sparse50 (PharmaCore Sparse)
12
 
13
- 50% magnitude-pruned version of [seyonec/ChemBERTa-zinc-base-v1](https://huggingface.co/seyonec/ChemBERTa-zinc-base-v1)
14
- for efficient drug discovery on Apple Silicon.
15
 
16
- ## Key Stats
17
- - **Sparsity:** 50%
18
- - **Quality Retention:** 97.3%
19
- - **Use Case:** Molecular 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/chemberta-zinc-sparse50")
27
  tokenizer = AutoTokenizer.from_pretrained("seyonec/ChemBERTa-zinc-base-v1")
 
 
 
 
 
 
 
 
 
 
28
  ```
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  ## Part of PharmaCore
31
 
32
- [PharmaCore](https://github.com/stephenjun8192/PharmaCore) — Apple Silicon-native AI drug discovery platform.
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ language:
4
+ - en
5
  tags:
6
  - pharmacore
7
  - sparse
8
  - drug-discovery
9
  - apple-silicon
10
+ - chemberta
11
+ - molecular-language-model
12
+ - cheminformatics
13
+ - smiles
14
+ - pruning
15
+ - efficient-inference
16
+ library_name: transformers
17
+ pipeline_tag: feature-extraction
18
  base_model: seyonec/ChemBERTa-zinc-base-v1
19
+ model-index:
20
+ - name: chemberta-zinc-sparse50
21
+ results:
22
+ - task:
23
+ type: feature-extraction
24
+ name: Molecular Embedding
25
+ metrics:
26
+ - type: cosine_similarity
27
+ value: 0.973
28
+ name: Quality Retention vs Dense
29
  ---
30
 
31
+ # ChemBERTa-zinc Sparse 50% — PharmaCore
32
 
33
+ A **50% magnitude-pruned** version of [seyonec/ChemBERTa-zinc-base-v1](https://huggingface.co/seyonec/ChemBERTa-zinc-base-v1) optimized for efficient molecular encoding on Apple Silicon.
 
34
 
35
+ ## Why This Model?
36
+
37
+ | Metric | Dense (Original) | Sparse (This) | Improvement |
38
+ |--------|-----------------|---------------|-------------|
39
+ | Parameters (active) | 44.1M | 22M | 50% reduction |
40
+ | Inference (M4 MPS) | 5.1ms | 4.9ms | 4% faster |
41
+ | Quality Retention | 100% | 97.3% | Minimal loss |
42
+
43
+ ## Use Case
44
+
45
+ Molecular encoder in the [PharmaCore](https://github.com/reacherwu/PharmaCore) drug discovery pipeline:
46
+ - Encode SMILES strings into dense embeddings for drug-target scoring
47
+ - Molecular similarity computation for drug repurposing
48
+ - Drug-likeness assessment and ADMET property prediction
49
+ - Runs entirely on consumer Apple Silicon hardware (M1/M2/M3/M4)
50
 
51
  ## Usage
52
 
53
  ```python
54
  from transformers import AutoModel, AutoTokenizer
55
+ import torch
56
 
57
  model = AutoModel.from_pretrained("stephenjun8192/chemberta-zinc-sparse50")
58
  tokenizer = AutoTokenizer.from_pretrained("seyonec/ChemBERTa-zinc-base-v1")
59
+
60
+ # Encode a drug molecule (Erlotinib — EGFR inhibitor)
61
+ smiles = "COCCOc1cc2ncnc(Nc3cccc(C#C)c3)c2cc1OCCOC"
62
+ inputs = tokenizer(smiles, return_tensors="pt", padding=True, truncation=True)
63
+
64
+ with torch.no_grad():
65
+ outputs = model(**inputs)
66
+ embedding = outputs.last_hidden_state.mean(dim=1) # [1, 768]
67
+
68
+ print(f"Embedding shape: {embedding.shape}")
69
  ```
70
 
71
+ ## Sparsification Method
72
+
73
+ - **Technique:** Global magnitude pruning (unstructured)
74
+ - **Sparsity:** 50% of all weight parameters set to zero
75
+ - **Layers pruned:** All linear layers (attention Q/K/V/O, FFN)
76
+ - **Validation:** Cosine similarity of embeddings vs dense model ≥ 0.973
77
+ - **Training data:** Pre-trained on 100K ZINC molecules (SMILES)
78
+
79
+ ## Benchmarks (Apple M4 Mac mini, 16GB)
80
+
81
+ | Task | Time |
82
+ |------|------|
83
+ | Single molecule embedding | 4.9ms |
84
+ | Batch of 12 molecules | ~45ms |
85
+ | Molecular fingerprint + embedding | ~6ms |
86
+ | Drug repurposing (full screen) | ~18s |
87
+
88
  ## Part of PharmaCore
89
 
90
+ [PharmaCore](https://github.com/reacherwu/PharmaCore) — the first AI drug discovery platform that runs entirely on a MacBook. No cloud GPUs, no API keys, no data leaves your machine.
91
+
92
+ ## Citation
93
+
94
+ ```bibtex
95
+ @software{pharmacore2026,
96
+ title={PharmaCore: Apple Silicon-Native AI Drug Discovery},
97
+ author={Stephen Wu},
98
+ year={2026},
99
+ url={https://github.com/reacherwu/PharmaCore}
100
+ }
101
+ ```