Views
No views yet
Synthyra/ESMplusplus_large packages the biohub/ESMC-600M checkpoint with
the FastPLMs runtime for Hugging Face Transformers. It accepts amino-acid
sequences tokenized to residue IDs.trust_remote_code=True. See Technical details for each registered class and
whether its weights come from the checkpoint.1python -m pip install -r \
2 "https://huggingface.co/Synthyra/ESMplusplus_large/resolve/main/requirements.txt"trust_remote_code=True.1from transformers import AutoModel
2
3model_id = "Synthyra/ESMplusplus_large"
4model = AutoModel.from_pretrained(
5 model_id,
6 trust_remote_code=True,
7 attn_implementation="sdpa",
8).eval()model_id with the manifest-built
dist/hub/ESMplusplus_large path. Pass local_files_only=True.sdpa.eager, sdpa, flex_attention, flash_attention_2,
flash_attention_3. Requesting an unavailable backend raises instead of
silently changing implementation.output_attentions=True can use the documented one-call eager fallback to
materialize attention tensors. The configured backend does not change.1import torch
2
3from transformers import AutoTokenizer
4
5
6model_id = "Synthyra/ESMplusplus_large"
7tokenizer = AutoTokenizer.from_pretrained(
8 model_id,
9 trust_remote_code=True,
10)
11batch = tokenizer(
12 ["MSTNPKPQRKTKRNT", "MKTIIALSYIFCLVFA"],
13 padding=True,
14 return_tensors="pt",
15)
16
17with torch.inference_mode():
18 output = model(**batch)
19
20print(output.last_hidden_state.shape)1pooled = model.embed_dataset(
2 ["MSTNPKPQRKTKRNT", "MKTIIALSYIFCLVFA"],
3 batch_size=2,
4 pooling=("mean", "std"),
5)
6residues = model.embed_dataset(
7 ["MSTNPKPQRKTKRNT"],
8 full_embeddings=True,
9)
10print(pooled[0].tensor.shape) # (2 * d,)
11print(residues[0].tensor.shape) # (l, d)output and format="safetensors" or "sqlite" for transactional,
bounded-memory storage. Resume checks input order, model state, tokenizer
policy, backend, dtype, and pooling configuration before it appends data.classifier. Sequence labels have shape (b,).
Residue labels have shape (b, l) and use -100 outside biological positions.1import torch
2
3from transformers import AutoTokenizer
4from transformers import (
5 AutoModelForSequenceClassification,
6 AutoModelForTokenClassification,
7)
8
9
10model_id = "Synthyra/ESMplusplus_large"
11sequence_model = AutoModelForSequenceClassification.from_pretrained(
12 model_id, num_labels=2, trust_remote_code=True
13).eval()
14token_model = AutoModelForTokenClassification.from_pretrained(
15 model_id, num_labels=3, trust_remote_code=True
16).eval()
17tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
18sequences = ["MSTNPKPQRKTKRNT", "MKTIIALSYIFCLVFA"]
19batch = tokenizer(sequences, padding=True, return_tensors="pt")
20biological = batch["attention_mask"].bool() # (b, l)
21for special_id in tokenizer.all_special_ids:
22 biological &= batch["input_ids"].ne(special_id) # (b, l)
23
24sequence_labels = torch.zeros(len(sequences), dtype=torch.long) # (b,)
25token_labels = torch.full_like(batch["input_ids"], -100) # (b, l)
26token_labels[biological] = 0 # selected biological positions; labels stay (b, l)
27
28with torch.inference_mode():
29 sequence_output = sequence_model(**batch, labels=sequence_labels)
30 token_output = token_model(**batch, labels=token_labels)
31print(sequence_output.logits.shape) # (b, 2)
32print(token_output.logits.shape) # (b, l, 3)python -m pip install "datasets>=4.8,<5" "peft>=0.19,<0.20"1from peft import LoraConfig, TaskType, get_peft_model
2
3
4peft_model = get_peft_model(
5 sequence_model,
6 LoraConfig(
7 task_type=TaskType.SEQ_CLS,
8 r=8,
9 lora_alpha=16,
10 target_modules="all-linear",
11 modules_to_save=["classifier"],
12 ),
13)classifier with the adapter.
All FastPLMs checkpoints follow the Transformers PreTrainedModel contract and
can use PEFT. The ESM2-specific shipped CLI is an example, not a
support boundary. Record the target modules, base revision, data identity, and
trainable parameter scope.1from transformers import AutoModelForMaskedLM
2
3
4ttt_model = AutoModelForMaskedLM.from_pretrained(
5 "Synthyra/ESMplusplus_large",
6 trust_remote_code=True,
7)
8metrics = ttt_model.ttt(
9 seq="MSTNPKPQRKTKRNT",
10 ttt_config={"steps": 3, "batch_size": 1, "seed": 7},
11)
12ttt_model.save_pretrained("adapted", safe_serialization=True)
13ttt_model.ttt_reset()
14print(metrics)sequence_id is supplied, it controls ESMC attention groups and padding.
attention_mask is ignored. Values greater than or equal to zero are valid
sequence-group IDs. -1 marks padding. Omit sequence_id to use
attention_mask for padding.1import torch
2
3
4model.load_sae_models("biohub/ESMC-600M-sae-layer27-k64-codebook65536", [27])
5
6with torch.inference_mode():
7 output = model(**batch, normalize_sae=True)
8
9features = output.sae_outputs["layer27"] # (valid_tokens, codebook_dim), sparse COO
10print(features.shape, features.layout) # (valid_token_count, codebook_dim), sparse COOload_sae_models reads the shared config.json and one
layer_{index}.safetensors shard per requested layer, from a Hub repository
or a local directory, and attaches the layers on the model device in the model
dtype. add_sae_models still accepts official Biohub ESMCSAEModel.layers
entries.compute_sae=False to skip SAE work.
Outputs are detached sparse tensors with keys such as layer{N}. They omit
padding. The model uses sequence_id, then attention_mask, for padding.
normalize_sae=True uses Biohub (features / max) * idf normalization. SAE
computation requires input_ids. It rejects mask tokens because Biohub trained
the SAEs with unmasked sequences. This interface supports hidden-state SAEs
only, not MLP-output SAEs. FastPLMs does not copy SAE weights or add SAE
checkpoints to its model manifest.| Backend | Support | Measurement status |
|---|---|---|
sdpa | Recommended fidelity path | Pending release measurement |
eager | Supported | Pending release measurement |
flash_attention_2 | Supported | Unavailable on current GH200/aarch64 lock |
flex_attention | Supported, numerically divergent | Pending release measurement |
flash_attention_3 | Supported, numerically divergent | Unavailable on current GH200/aarch64 lock |
AutoConfig, AutoModel, AutoModelForMaskedLM, AutoModelForSequenceClassification, AutoModelForTokenClassificationAutoConfig = FastPLMs extension, AutoModel = pretrained, AutoModelForMaskedLM = pretrained, AutoModelForSequenceClassification = base weights + untrained task head, AutoModelForTokenClassification = base weights + untrained task headeager, sdpa, flex_attention, flash_attention_2, flash_attention_3defaultstatic_parametersnot_applicablecoretrueresolvedtruefalsemodels.toml. Built artifacts record exact source
identities and conversion details in source-record.json.Synthyra/ESMplusplus_largesource-record.jsonbiohub/ESMC-600Mfastesmc_to_fastplms_v1biohub-esm, biohub-transformerscheck, compliance, feature, artifact, benchmark0compliance tier. Its evidence identifies the
checkpoint, backend, dtype, hardware, inputs, and reference revision.mit. The local artifact contains applicable source
licenses, notices, attribution, and conversion records. Review them before use.