ESM2 is an embedding oracle that wraps Meta’s ESM-2 protein language model. It produces high-dimensional per-residue embeddings that capture biochemical and evolutionary context, which are used by embedding-based energy terms like EmbeddingsSimilarityEnergy.
By default, BAGEL uses the 650M parameter version of ESM-2, but any ESM-2 model size can be specified via the config parameter. For multimers, ESM-2 uses the same linker and positional encoding approach as ESMFold.
ESM-2 inference is powered by boileroom. boileroom handles model loading, GPU execution, and dependency isolation — either serverlessly via Modal or locally via Apptainer. See the boileroom ESM-2 reference for backend configuration details.
Parameters
bool
default:"False"
Whether to run ESM-2 on Modal’s serverless GPU infrastructure. Set to
True for serverless execution (no local GPU required), or False for local GPU execution.dict[str, Any]
default:"{}"
Model-specific configuration. Can be used to specify model size, linker parameters, and other options.
App | None
default:"None"
Optional Modal app context for reusing an existing Modal session.
Methods
embed
Calculate the embeddings of the residues in the chains. Parameterslist[Chain]
required
The chains to embed. Sequences are concatenated with appropriate linker handling.
