{"success":true,"data":{"author":"Westlake University (westlake-repl)","bucketAccessType":"public","bucketName":"models/westlake-repl/SaProt_650M_AF2","bucketPrefix":"","category":"Biology","cloudProvider":"huggingface","createdAt":"2026-11-16T15:25:49.097Z","description":"Open weights for SaProt 650M, a structure-aware protein language model from Westlake University. Its vocabulary pairs each amino acid with a Foldseek 3Di structure token, so a protein is read as a sequence of residue plus local-structure tokens, and the model was pretrained on AlphaFold2-predicted structures. With structure tokens as input it outperforms sequence-only models on many fitness and function tasks; sequence-only input works but needs fine-tuning. The mounted repo holds SaProt_650M_AF2.pt (esm-style checkpoint), pytorch_model.bin with config.json and vocab.txt for transformers (EsmForMaskedLM), each about 2.6 GB. Pair it with the AlphaFold DB or PDB archives to build structure tokens next to the data. MIT licence.","displayTitle":"SaProt 650M structure-aware protein language model weights","huggingFaceUrl":"https://huggingface.co/westlake-repl/SaProt_650M_AF2","id":"ff7d5b7a-d120-5ffb-ba30-85fa4a6ebc24","license":"MIT","licenseEvidenceUrl":"https://github.com/westlake-repl/SaProt/blob/main/LICENSE","objectCountEstimate":8,"probeStatus":"ok","referenceUrl":"https://openreview.net/forum?id=6MRm3G4NiU","region":"us","schemaCard":{"accessHints":[{"language":"python-hub","snippet":"from huggingface_hub import snapshot_download\nsnapshot_download(repo_id=\"westlake-repl/SaProt_650M_AF2\")  # or read /mnt/archive directly"}],"caveats":["HuggingFace metadata: author=westlake-repl, license:mit, library=transformers, pipeline=fill-mask, downloads=30535","Weights are read lazily from the mount. Copying them to local disk first is faster when a model is loaded many times."],"format":"binary","generatedAt":"2026-11-17T19:17:21.658Z","layout":{"example":"SaProt_650M_AF2.pt","pattern":"{repoId}/{filename}"},"mountPath":"/mnt/archive","sampleObjects":["config.json","SaProt_650M_AF2.pt","pytorch_model.bin"],"sidecars":[{"bytes":"---\nlicense: mit\n---\n\n<!-- ##### 🔴 <font color=red>Note: SaProt requires structural (SA token) input for optimal performance. AA-sequence-only mode works but must be finetuned - frozen embeddings work only for SA, not AA sequences! With structural input, SaProt surpasses ESM2 in most tasks.</font> -->\n\nWe provide two ways to use SaProt, including through huggingface class and \nthrough the same way as in [esm github](https://github.com/facebookresearch/esm). Users can choose either one to use.\n\n## Huggingface model\nThe following code shows how to load the model.\n```\nfrom transformers import EsmTokenizer, EsmForMaskedLM\n\nmodel_path = \"/your/path/to/SaProt_650M_AF2\"\ntokenizer = EsmTokenizer.from_pretrained(model_path)\nmodel = EsmForMaskedLM.from_pretrained(model_path)\n\n#################### Example ####################\ndevice = \"cuda\"\nmodel.to(device)\n\nseq = \"M#EvVpQpL#VyQdYaKv\" # Here \"#\" represents lower plDDT regions (plddt < 70)\ntokens = tokenizer.tokenize(seq)\nprint(tokens)\n\ninputs = tokenizer(seq, return_tensors=\"pt\")\ninputs = {k: v.to(device) for k, v in inputs.items()}\n\noutputs = model(**inputs)\nprint(outputs.logits.shape)\n\n\"\"\"\n['M#', 'Ev', 'Vp', 'Qp', 'L#', 'Vy', 'Qd', 'Ya', 'Kv']\ntorch.Size([1, 11, 446])\n\"\"\"\n```\n\n## esm model\nThe esm version is also stored in the same folder, named `SaProt_650M_AF2.pt`. We provide a function to load the model.\n```\nfrom utils.esm_loader import load_esm_saprot\n\nmodel_path = \"/your/path/to/SaProt_650M_AF2.pt\"\nmodel, alphabet = load_esm_saprot(model_path)\n```\n\n## Predict mutational effect\nWe provide a function to predict the mutational effect of a protein sequence. The example below shows how to predict\nthe mutational effect at a specific position. If using the AF2 structure, we strongly recommend that you add pLDDT mask (see below). \n```python\nfrom model.saprot.saprot_foldseek_mutation_model import SaprotFoldseekMutationModel\n\n\nconfig = {\n    \"foldseek_path\": None,\n    \"config_path\": \"/your/path/to/SaProt_650M_AF2\", # Note this is the directory path of SaProt, not the \".pt\" file\n    \"load_pretrained\": True,\n}\nmodel = SaprotFoldseekMutationModel(**config)\ntokenizer = model.tokenizer\n\ndevice = \"cuda\"\nmodel.eval()\nmodel.to(device)\n\nseq = \"M#EvVpQpL#VyQdYaKv\" # Here \"#\" represents lower plDDT regions (plddt < 70)\n\n# Predict the effect of mutating the 3rd amino acid to A\nmut_info = \"V3A\"\nmut_value = model.predict_mut(seq, mut_info)\nprint(mut_value)\n\n# Predict mutational effect of combinatorial mutations, e.g. mutating the 3rd amino acid to A and the 4th amino acid to M\nmut_info = \"V3A:Q4M\"\nmut_value = model.predict_mut(seq, mut_info)\nprint(mut_value)\n\n# Predict all effects of mutations at 3rd position\nmut_pos = 3\nmut_dict = model.predict_pos_mut(seq, mut_pos)\nprint(mut_dict)\n\n# Predict probabilities of all amino acids at 3rd position\nmut_pos = 3\nmut_dict = model.predict_pos_prob(seq, mut_pos)\nprint(mut_dict)\n```\n\n## Get protein embeddings\nIf you want to generate protein embeddings, you could refer to the following code. The embeddings are the average of\nthe hidden states of the last layer.\n<!-- <font color=red>Note frozen SaProt supports SA sequence embeddings but not AA sequence embeddings.</font> -->\n```python\nfrom model.saprot.base import SaprotBaseModel\nfrom transformers import EsmTokenizer\n\n\nconfig = {\n    \"task\": \"base\",\n    \"config_path\": \"/your/path/to/SaProt_650M_AF2\", # Note this is the directory path of SaProt, not the \".pt\" file\n    \"load_pretrained\": True,\n}\n\nmodel = SaprotBaseModel(**config)\ntokenizer = EsmTokenizer.from_pretrained(config[\"config_path\"])\n\ndevice = \"cuda\"\nmodel.to(device)\n\nseq = \"M#EvVpQpL#VyQdYaKv\" # Here \"#\" represents lower plDDT regions (plddt < 70)\ntokens = tokenizer.tokenize(seq)\nprint(tokens)\n\ninputs = tokenizer(seq, return_tensors=\"pt\")\ninputs = {k: v.to(device) for k, v in inputs.items()}\n\nembeddings = model.get_hidden_states(inputs, reduction=\"mean\")\nprint(embeddings[0].shape)\n```","encoding":"utf8","key":"README.md","name":"README.md","size":3926,"truncated":false}],"sourceObjectKey":"SaProt_650M_AF2.pt","starterCell":"import os, json\nbase = \"/mnt/archive\"   # this model repo, mounted read-only\nfiles = sorted(os.listdir(base)); print(files)\nprint(json.dumps(json.load(open(os.path.join(base, \"config.json\"))), indent=1)[:800])\nprint(\"SaProt_650M_AF2.pt\", os.path.getsize(os.path.join(base, \"SaProt_650M_AF2.pt\")) // 2**20, \"MB\")","totalObjects":8},"summary":"Open weights for SaProt 650M, a structure-aware protein language model from Westlake University.","title":"SaProt 650M structure-aware protein language model weights","updatedAt":"2026-11-17T19:17:21.844Z","visibility":"public","websiteUrl":"https://huggingface.co/westlake-repl/SaProt_650M_AF2"}}