Views
No views yet

prothash library using the from_pretrained() method. ONNX versions are also available.| Name | Context Length | Embedding Dimensions | Attention Heads (Q/KV) | Encoder Layers | Total Params | Teacher Model | Teacher Dimensions | Library Version |
|---|---|---|---|---|---|---|---|---|
| andrewdalpino/ProtHash-V0-384-Tiny | 2048 | 384 | 16/4 | 4 | 4.2M | esmc_300m | 960 | 0.2.x |
| andrewdalpino/ProtHash-V0-384 | 2048 | 384 | 16/4 | 10 | 10M | esmc_300m | 960 | 0.2.x |
| andrewdalpino/ProtHash-V0-512-Tiny | 2048 | 512 | 16/4 | 4 | 7.4M | esmc_600m | 1152 | 0.2.x |
| andrewdalpino/ProtHash-V0-512 | 2048 | 512 | 16/4 | 10 | 18M | esmc_600m | 1152 | 0.2.x |
prothash and esm packages installed into your environment. For ProtHash version 1 use library version 0.1.x and for version 2 install library version 0.2.x. We recommend using a virtual environment such as Python's venv module to prevent version conflicts with other packages.pip install prothash~=0.2.0 esm1import torch
2
3from esm.tokenization import EsmSequenceTokenizer
4
5from prothash.model import ProtHash
6
7tokenizer = EsmSequenceTokenizer()
8
9model_name = "andrewdalpino/ProtHash-V0-512"
10
11model = ProtHash.from_pretrained(model_name)
12
13# Optionally quantize the weights to Int8.
14model.quantize_weights()
15
16sequence = input("Enter a sequence: ")
17
18out = tokenizer(sequence, max_length=2048)
19
20tokens = out["input_ids"]
21
22# Input is a [1, T] tensor of token indices.
23x = torch.tensor(tokens, dtype=torch.int64).unsqueeze(0)
24
25# Output the sequence embedding in native dimensionality.
26y_embed_native = model.embed_native(x).squeeze(0)
27
28# Output a drop-in replacement for the teacher's embeddings.
29y_embed_teacher = model.embed_teacher(x).squeeze(0)
30
31print(y_embed_native.shape)
32print(y_embed_teacher.shape)
- The UniProt Consortium, UniProt: the Universal Protein Knowledgebase in 2025, Nucleic Acids Research, 2025, 53, D609–D617.
- T. Hayes, et al. Simulating 500 million years of evolution with a language model, 2024.
- B. Zhang, et al. Root Mean Square Layer Normalization. 33rd Conference on Neural Information Processing Systems, NeurIPS 2019.
- T. Kim, et al. Comparing Kullback-Leibler Divergence and Mean Squared Error Loss in Knowledge Distillation, 2021.