|
Download README.md from GleghornLab/vec2vec_embeddings: direct link, hf CLI and curl.
- Browser
- Download file 5.74 kB
-
https://huggingface.co/datasets/GleghornLab/vec2vec_embeddings/resolve/main/README.md
- Command line
-
hf download hf://datasets/GleghornLab/vec2vec_embeddings/README.md
-
curl -L -o README.md https://huggingface.co/datasets/GleghornLab/vec2vec_embeddings/resolve/main/README.md
5.74 kB
| license: cc-by-4.0 | |
| tags: | |
| - biology | |
| - protein | |
| - protein-language-model | |
| - embeddings | |
| - representation-learning | |
| pretty_name: Vec2Vec protein embeddings of PLAT | |
| size_categories: | |
| - 100K<n<1M | |
| # Vec2Vec protein embeddings of PLAT | |
| Frozen, pooled embeddings of every protein in | |
| [GleghornLab/plat_data](https://huggingface.co/datasets/GleghornLab/plat_data) from ten encoders that | |
| read it three different ways: protein language models read the amino acid sequence, general text | |
| models read the sequence or the curator description, and an annotation encoder reads the typed | |
| annotation set. With every encoder embedding the same proteins, a translator between any two spaces | |
| can be trained and scored without running a large model. These are the embeddings behind the Gleghorn | |
| Lab's study of embedding translation between protein representation spaces. | |
| | | | | |
| |---|---| | |
| | Proteins | 67,402 (PLAT train, valid and test) | | |
| | Encoders | ESM2 8M, 35M, 150M, 650M and 3B; ModernBERT-base and -large; gpt-oss-20b and -120b; AT-Base | | |
| | Vector | Mean then variance over tokens, concatenated: twice the encoder width, float32 | | |
| | Format | One gzip-compressed PyTorch dictionary per encoder, keyed by the raw input | | |
| | Licence | CC BY 4.0, inheriting the UniProt data | | |
| ## Homology leakage | |
| The embeddings carry PLAT's splits unchanged. PLAT was clustered at 40% identity before the split, but a | |
| later screen at 40% identity and 80% coverage of both sequences found a training neighbor for 12.57% of | |
| test proteins, so it is not homology-disjoint; the | |
| [PLAT card](https://huggingface.co/datasets/GleghornLab/plat_data) gives the counts. | |
| ## How it was built | |
| 1. Read every row of PLAT. | |
| 2. Ran each encoder frozen, in inference only, on the columns it reads, and truncated inputs instead | |
| of dropping them: sequences at 1,024 tokens, descriptions at 2,048 and annotation sets at 192. | |
| 3. Pooled each input's token embeddings into their mean and variance and concatenated the two, | |
| mean first. | |
| 4. Stored one vector per distinct input in a dictionary per encoder, so proteins with identical | |
| inputs share one entry, and saved it with `torch.save` under gzip. | |
| ## Columns | |
| Each file is a dictionary from an input to its vector. | |
| | Key | Encoders | Example | | |
| |---|---|---| | |
| | amino acid sequence, `str` | ESM2, ModernBERT, gpt-oss | `"MDQPQFSGAPRFLTRPKAFV..."` | | |
| | description text, `str` | ModernBERT, gpt-oss | `"The following text describes a protein: ..."` | | |
| | annotation ids, `tuple` of `int` | AT-Base | `(2459, 2633, 6640, ...)` | | |
| A description or sequence is looked up exactly as it appears in PLAT, and an annotation set as the | |
| tuple of its `annotation` list. For example, the ESM2-8 file holds 67,402 sequences with vectors of 640 | |
| values, ModernBERT-base holds 107,096 keys (67,402 sequences and 39,694 distinct descriptions) with 1,536, and AT-Base holds 53,371 | |
| distinct annotation sets with 1,024. | |
| ## Example rows | |
| ```python | |
| import gzip, io, torch | |
| from datasets import load_dataset | |
| from huggingface_hub import hf_hub_download | |
| path = hf_hub_download("GleghornLab/vec2vec_embeddings", | |
| "embeddings/ESM2-650_False_mean_var.pth.gz", repo_type="dataset") | |
| with gzip.open(path, "rb") as handle: | |
| table = torch.load(io.BytesIO(handle.read()), weights_only=True) | |
| plat = load_dataset("GleghornLab/plat_data", split="test") | |
| x = torch.stack([table[seq] for seq in plat["sequence"]]) # (3420, 2560) | |
| ``` | |
| Load with `weights_only=True`: the files are pickle containers, and nothing else is needed to read them. | |
| ## What a model trained on it may say | |
| A translator trained on these vectors maps one encoder's pooled space to another's. Its scores say how | |
| much of one space can be recovered from the other on PLAT's proteins, under mean and variance pooling and | |
| these truncation lengths. They do not say how the full token-level representations relate, and an | |
| encoder's pooled vector on a long protein covers only its first 1,024 tokens. | |
| ## Sources and licence | |
| The inputs come from PLAT, built from [UniProtKB](https://www.uniprot.org) under | |
| [CC BY 4.0](https://www.uniprot.org/help/license); cite UniProt when you use them. The encoders and | |
| their licences: | |
| | Encoder | Model | Reads | Licence | | |
| |---|---|---|---| | |
| | ESM2 8M to 3B | [facebook/esm2](https://huggingface.co/facebook/esm2_t33_650M_UR50D) family | sequence | MIT | | |
| | ModernBERT-base, -large | [answerdotai/ModernBERT-base](https://huggingface.co/answerdotai/ModernBERT-base), [-large](https://huggingface.co/answerdotai/ModernBERT-large) | sequence, description | Apache 2.0 | | |
| | 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 | | |
| | AT-Base | Annotation Transformer of the Gleghorn Lab, not public | annotation set | | | |
| ## Files | |
| | File | Encoder | Keys | | |
| |---|---|---| | |
| | `embeddings/ESM2-8_False_mean_var.pth.gz` | ESM2 8M | sequence | | |
| | `embeddings/ESM2-35_False_mean_var.pth.gz` | ESM2 35M | sequence | | |
| | `embeddings/ESM2-150_False_mean_var.pth.gz` | ESM2 150M | sequence | | |
| | `embeddings/ESM2-650_False_mean_var.pth.gz` | ESM2 650M | sequence | | |
| | `embeddings/ESM2-3B_False_mean_var.pth.gz` | ESM2 3B | sequence | | |
| | `embeddings/custom---answerdotai_ModernBERT-base_False_mean_var.pth.gz` | ModernBERT-base | sequence, description | | |
| | `embeddings/custom---answerdotai_ModernBERT-large_False_mean_var.pth.gz` | ModernBERT-large | sequence, description | | |
| | `embeddings/custom---openai_gpt-oss-20b_False_mean_var.pth.gz` | gpt-oss-20b | sequence, description | | |
| | `embeddings/gpt-oss-120b_False_mean_var.pth.gz` | gpt-oss-120b | sequence, description | | |
| | `embeddings/at_AT-Base_best_pad192_mean_var.pth.gz` | AT-Base | annotation set | | |