add PDB → features quickstart, link to release
Browse files
README.md
CHANGED
|
@@ -11,24 +11,65 @@ tags:
|
|
| 11 |
# K-Fold Structure Encoder (35M)
|
| 12 |
|
| 13 |
ELECTRA-style structure-aware protein encoder, 35M parameters.
|
| 14 |
-
Part of [k-fold-structure](https://github.com/<TODO-github-org>/k-fold-structure-release)
|
| 15 |
|
| 16 |
## Files
|
| 17 |
|
| 18 |
-
- `35M.ckpt` — full Lightning checkpoint (for re-training)
|
| 19 |
-
- `config.yaml` — model config
|
| 20 |
- `backbone_tokenizer.pt` — backbone (bb) token VQ-VAE
|
| 21 |
- `fullatom_tokenizer.pt` — full-atom (fa) token VQ-VAE
|
| 22 |
|
| 23 |
## Quickstart
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
```python
|
| 26 |
import sys
|
| 27 |
sys.path.insert(0, "code/triprorep")
|
| 28 |
from inference import load_encoder, encode
|
| 29 |
|
| 30 |
-
encoder
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
```
|
| 33 |
|
| 34 |
License: MIT
|
|
|
|
| 11 |
# K-Fold Structure Encoder (35M)
|
| 12 |
|
| 13 |
ELECTRA-style structure-aware protein encoder, 35M parameters.
|
| 14 |
+
Part of the [k-fold-structure release](https://github.com/<TODO-github-org>/k-fold-structure-release).
|
| 15 |
|
| 16 |
## Files
|
| 17 |
|
| 18 |
+
- `35M.ckpt` — full Lightning checkpoint (for re-training / fine-tuning)
|
| 19 |
+
- `config.yaml` — model + data config (sanitized: replace `/path/to/...` with your local paths)
|
| 20 |
- `backbone_tokenizer.pt` — backbone (bb) token VQ-VAE
|
| 21 |
- `fullatom_tokenizer.pt` — full-atom (fa) token VQ-VAE
|
| 22 |
|
| 23 |
## Quickstart
|
| 24 |
|
| 25 |
+
Clone the GitHub release for the runner code:
|
| 26 |
+
|
| 27 |
+
```bash
|
| 28 |
+
git clone https://github.com/<TODO-github-org>/k-fold-structure-release.git
|
| 29 |
+
cd k-fold-structure-release
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
### Option A — one-shot: PDB → per-residue features
|
| 33 |
+
|
| 34 |
+
```python
|
| 35 |
+
import sys
|
| 36 |
+
sys.path.insert(0, "code/triprorep")
|
| 37 |
+
from inference import load_encoder, embed_pdb
|
| 38 |
+
|
| 39 |
+
encoder = load_encoder("35M", hf_repo="k-fold-structure/triprorep-35M")
|
| 40 |
+
features = embed_pdb(encoder, "your_protein.pdb",
|
| 41 |
+
hf_repo="k-fold-structure/triprorep-35M")
|
| 42 |
+
# features: np.ndarray [L, D] fp16 (L = #residues; D = encoder hidden dim)
|
| 43 |
+
print(features.shape)
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
`embed_pdb` downloads the bundled tokenizers from this repo on first call,
|
| 47 |
+
runs PDB → (seq, bb, fa) tokens through the tokenizer VQ-VAEs, then forwards
|
| 48 |
+
through the encoder.
|
| 49 |
+
|
| 50 |
+
### Option B — already tokenized: token IDs → features
|
| 51 |
+
|
| 52 |
+
If you already have token IDs (e.g., from `k-fold-structure/repsp-triprorep-tokens`):
|
| 53 |
+
|
| 54 |
```python
|
| 55 |
import sys
|
| 56 |
sys.path.insert(0, "code/triprorep")
|
| 57 |
from inference import load_encoder, encode
|
| 58 |
|
| 59 |
+
encoder = load_encoder("35M", hf_repo="k-fold-structure/triprorep-35M")
|
| 60 |
+
features = encode(encoder, seq_ids, bb_ids, fa_ids) # each: int array [L]
|
| 61 |
+
# features: np.ndarray [L, D] fp16
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
## Citation
|
| 65 |
+
|
| 66 |
+
```
|
| 67 |
+
@misc{k-fold-structure-35m,
|
| 68 |
+
title = {K-Fold Structure Encoder (35M)},
|
| 69 |
+
author = {<TODO>},
|
| 70 |
+
year = {2026},
|
| 71 |
+
url = {https://huggingface.co/k-fold-structure/triprorep-35M}
|
| 72 |
+
}
|
| 73 |
```
|
| 74 |
|
| 75 |
License: MIT
|