Add a dataset card
Browse files
README.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
tags:
|
| 4 |
+
- biology
|
| 5 |
+
- protein
|
| 6 |
+
- protein-language-model
|
| 7 |
+
- embeddings
|
| 8 |
+
- representation-learning
|
| 9 |
+
pretty_name: Vec2Vec protein embeddings of PLAT
|
| 10 |
+
size_categories:
|
| 11 |
+
- 100K<n<1M
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Vec2Vec protein embeddings of PLAT
|
| 15 |
+
|
| 16 |
+
Frozen, pooled embeddings of every protein in
|
| 17 |
+
[GleghornLab/plat_data](https://huggingface.co/datasets/GleghornLab/plat_data) from ten encoders that
|
| 18 |
+
read it three different ways: protein language models read the amino acid sequence, general text
|
| 19 |
+
models read the sequence or the curator description, and an annotation encoder reads the typed
|
| 20 |
+
annotation set. With every encoder embedding the same proteins, a translator between any two spaces
|
| 21 |
+
can be trained and scored without running a large model. These are the embeddings behind the Gleghorn
|
| 22 |
+
Lab's study of embedding translation between protein representation spaces.
|
| 23 |
+
|
| 24 |
+
| | |
|
| 25 |
+
|---|---|
|
| 26 |
+
| Proteins | 67,402 (PLAT train, valid and test) |
|
| 27 |
+
| Encoders | ESM2 8M, 35M, 150M, 650M and 3B; ModernBERT-base and -large; gpt-oss-20b and -120b; AT-Base |
|
| 28 |
+
| Vector | Mean then variance over tokens, concatenated: twice the encoder width, float32 |
|
| 29 |
+
| Format | One gzip-compressed PyTorch dictionary per encoder, keyed by the raw input |
|
| 30 |
+
| Licence | CC BY 4.0, inheriting the UniProt data |
|
| 31 |
+
|
| 32 |
+
## Homology leakage
|
| 33 |
+
|
| 34 |
+
The embeddings carry PLAT's splits unchanged. PLAT was clustered at 40% identity before the split, but a
|
| 35 |
+
later screen at 40% identity and 80% coverage of both sequences found a training neighbor for 12.57% of
|
| 36 |
+
test proteins, so it is not homology-disjoint; the
|
| 37 |
+
[PLAT card](https://huggingface.co/datasets/GleghornLab/plat_data) gives the counts.
|
| 38 |
+
|
| 39 |
+
## How it was built
|
| 40 |
+
|
| 41 |
+
1. Read every row of PLAT.
|
| 42 |
+
2. Ran each encoder frozen, in inference only, on the columns it reads, and truncated inputs instead
|
| 43 |
+
of dropping them: sequences at 1,024 tokens, descriptions at 2,048 and annotation sets at 192.
|
| 44 |
+
3. Pooled each input's token embeddings into their mean and variance and concatenated the two,
|
| 45 |
+
mean first.
|
| 46 |
+
4. Stored one vector per distinct input in a dictionary per encoder, so proteins with identical
|
| 47 |
+
inputs share one entry, and saved it with `torch.save` under gzip.
|
| 48 |
+
|
| 49 |
+
## Columns
|
| 50 |
+
|
| 51 |
+
Each file is a dictionary from an input to its vector.
|
| 52 |
+
|
| 53 |
+
| Key | Encoders | Example |
|
| 54 |
+
|---|---|---|
|
| 55 |
+
| amino acid sequence, `str` | ESM2, ModernBERT, gpt-oss | `"MDQPQFSGAPRFLTRPKAFV..."` |
|
| 56 |
+
| description text, `str` | ModernBERT, gpt-oss | `"The following text describes a protein: ..."` |
|
| 57 |
+
| annotation ids, `tuple` of `int` | AT-Base | `(2459, 2633, 6640, ...)` |
|
| 58 |
+
|
| 59 |
+
A description or sequence is looked up exactly as it appears in PLAT, and an annotation set as the
|
| 60 |
+
tuple of its `annotation` list. For example, the ESM2-8 file holds 67,402 sequences with vectors of 640
|
| 61 |
+
values, ModernBERT-base holds 107,096 keys (67,402 sequences and 39,694 distinct descriptions) with 1,536, and AT-Base holds 53,371
|
| 62 |
+
distinct annotation sets with 1,024.
|
| 63 |
+
|
| 64 |
+
## Example rows
|
| 65 |
+
|
| 66 |
+
```python
|
| 67 |
+
import gzip, io, torch
|
| 68 |
+
from datasets import load_dataset
|
| 69 |
+
from huggingface_hub import hf_hub_download
|
| 70 |
+
|
| 71 |
+
path = hf_hub_download("GleghornLab/vec2vec_embeddings",
|
| 72 |
+
"embeddings/ESM2-650_False_mean_var.pth.gz", repo_type="dataset")
|
| 73 |
+
with gzip.open(path, "rb") as handle:
|
| 74 |
+
table = torch.load(io.BytesIO(handle.read()), weights_only=True)
|
| 75 |
+
|
| 76 |
+
plat = load_dataset("GleghornLab/plat_data", split="test")
|
| 77 |
+
x = torch.stack([table[seq] for seq in plat["sequence"]]) # (3420, 2560)
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
Load with `weights_only=True`: the files are pickle containers, and nothing else is needed to read them.
|
| 81 |
+
|
| 82 |
+
## What a model trained on it may say
|
| 83 |
+
|
| 84 |
+
A translator trained on these vectors maps one encoder's pooled space to another's. Its scores say how
|
| 85 |
+
much of one space can be recovered from the other on PLAT's proteins, under mean and variance pooling and
|
| 86 |
+
these truncation lengths. They do not say how the full token-level representations relate, and an
|
| 87 |
+
encoder's pooled vector on a long protein covers only its first 1,024 tokens.
|
| 88 |
+
|
| 89 |
+
## Sources and licence
|
| 90 |
+
|
| 91 |
+
The inputs come from PLAT, built from [UniProtKB](https://www.uniprot.org) under
|
| 92 |
+
[CC BY 4.0](https://www.uniprot.org/help/license); cite UniProt when you use them. The encoders and
|
| 93 |
+
their licences:
|
| 94 |
+
|
| 95 |
+
| Encoder | Model | Reads | Licence |
|
| 96 |
+
|---|---|---|---|
|
| 97 |
+
| ESM2 8M to 3B | [facebook/esm2](https://huggingface.co/facebook/esm2_t33_650M_UR50D) family | sequence | MIT |
|
| 98 |
+
| ModernBERT-base, -large | [answerdotai/ModernBERT-base](https://huggingface.co/answerdotai/ModernBERT-base), [-large](https://huggingface.co/answerdotai/ModernBERT-large) | sequence, description | Apache 2.0 |
|
| 99 |
+
| gpt-oss-20b, -120b | [openai/gpt-oss-20b](https://huggingface.co/openai/gpt-oss-20b), [-120b](https://huggingface.co/openai/gpt-oss-120b) | sequence, description | Apache 2.0 |
|
| 100 |
+
| AT-Base | Annotation Transformer of the Gleghorn Lab, not public | annotation set | |
|
| 101 |
+
|
| 102 |
+
## Files
|
| 103 |
+
|
| 104 |
+
| File | Encoder | Keys |
|
| 105 |
+
|---|---|---|
|
| 106 |
+
| `embeddings/ESM2-8_False_mean_var.pth.gz` | ESM2 8M | sequence |
|
| 107 |
+
| `embeddings/ESM2-35_False_mean_var.pth.gz` | ESM2 35M | sequence |
|
| 108 |
+
| `embeddings/ESM2-150_False_mean_var.pth.gz` | ESM2 150M | sequence |
|
| 109 |
+
| `embeddings/ESM2-650_False_mean_var.pth.gz` | ESM2 650M | sequence |
|
| 110 |
+
| `embeddings/ESM2-3B_False_mean_var.pth.gz` | ESM2 3B | sequence |
|
| 111 |
+
| `embeddings/custom---answerdotai_ModernBERT-base_False_mean_var.pth.gz` | ModernBERT-base | sequence, description |
|
| 112 |
+
| `embeddings/custom---answerdotai_ModernBERT-large_False_mean_var.pth.gz` | ModernBERT-large | sequence, description |
|
| 113 |
+
| `embeddings/custom---openai_gpt-oss-20b_False_mean_var.pth.gz` | gpt-oss-20b | sequence, description |
|
| 114 |
+
| `embeddings/gpt-oss-120b_False_mean_var.pth.gz` | gpt-oss-120b | sequence, description |
|
| 115 |
+
| `embeddings/at_AT-Base_best_pad192_mean_var.pth.gz` | AT-Base | annotation set |
|