# AI use cases for Esm (Biohub/esm)

Repo: [Biohub/esm](https://github.com/Biohub/esm) | Use cases: 3 | Page: https://dedupedai.com/use-cases/biohub-esm/

The esm package from Biohub (EvolutionaryScale) ships ESMC, a protein language model trained on billions of protein sequences, ESMFold2, a structure prediction model built on ESMC 6B that predicts all atom 3D structures from sequence, and sparse autoencoders that decompose ESMC representations into interpretable features. Models run locally from Hugging Face weights or through the Biohub Platform with an API token.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Turn protein sequences into embeddings with ESMC: https://dedupedai.com/use-cases/biohub-esm/embed-protein-sequences-with-esmc/
- Predict an all atom structure from a sequence: https://dedupedai.com/use-cases/biohub-esm/predict-protein-structures-with-esmfold2/
- Read which learned features a protein activates: https://dedupedai.com/use-cases/biohub-esm/interpret-esmc-features-with-sparse-autoencoders/

## How to turn protein sequences into embeddings with ESMC with Esm

Repo: [Biohub/esm](https://github.com/Biohub/esm) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Load ESMC 6B from Hugging Face with the Esm package and get per layer representations for your sequences.

**Who it is for:** A computational biologist who needs protein representations for a downstream model.

**The problem:** Training a protein model from scratch is out of reach for most teams.

**The outcome:** Embeddings and logits for each sequence you pass in, ready for a downstream classifier.

### Steps

1. Install the package with `pip install esm`
2. Load the model and tokenizer with EsmcForMaskedLM.from_pretrained and EsmcTokenizer as in the README example
3. Tokenize your sequences with return_tensors set to pt and padding set to True, then move the inputs to model.device
4. Run the model inside torch.inference_mode, and pass output_hidden_states=True to get hidden states from all transformer layers

### Prompt to paste into your agent

```text
Using Biohub/esm, write a script that installs esm with `pip install esm`, loads ESMC-6B with EsmcForMaskedLM.from_pretrained, and saves all layer hidden states for every sequence in <my FASTA file> as a NumPy array.
```

### Caveat

On a machine with no NVIDIA GPU the README suggests installing torch from its CPU only index to replace the 4.6 GB CUDA build.

Risk, platform: The install is about 5.6 GB and the local examples load the model with device set to cuda, so plan for a GPU box and disk space.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/biohub-esm/embed-protein-sequences-with-esmc/

## How to predict an all atom structure from a sequence with Esm

Repo: [Biohub/esm](https://github.com/Biohub/esm) | Difficulty: Advanced | Time: 2 hours | Basis: From the README

Run ESMFold2 locally to fold a protein, including DNA chains and ligands, and write the result as mmCIF.

**Who it is for:** A structural biologist who wants a predicted complex without a cluster job.

**The problem:** Structure prediction pipelines are hard to assemble and slow to run.

**The outcome:** A .cif file of the predicted complex plus pLDDT, pTM and ipTM scores.

### Steps

1. Install the package with `pip install esm`
2. Build a StructurePredictionInput with ProteinInput, DNAInput and LigandInput entries as in the README example
3. Load the model with EsmFold2Model.from_pretrained and call ESMFold2InputBuilder().fold with num_loops, num_sampling_steps and a seed
4. Print result.plddt, result.ptm and result.iptm, then write result.complex.to_mmcif() to a .cif file

### Prompt to paste into your agent

```text
With Biohub/esm, fold <my protein sequence> with ESMFold2 using ESMFold2InputBuilder().fold, print pLDDT, pTM and ipTM, and save the structure as a mmCIF file I can open in a viewer.
```

### Caveat

The README notes the model is validated for protein protein interaction design; treat any prediction as a hypothesis to test.

Risk, platform: AMD ROCm users need ROCm 6.4 or newer, and Esm requires PyTorch 2.11.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/biohub-esm/predict-protein-structures-with-esmfold2/

## How to read which learned features a protein activates with Esm

Repo: [Biohub/esm](https://github.com/Biohub/esm) | Difficulty: Advanced | Time: 1 hour | Basis: From the README

Attach an ESMC sparse autoencoder and inspect the sparse feature activations for a sequence.

**Who it is for:** A researcher who wants to know what a protein model has learned about their sequence.

**The problem:** Raw embeddings say nothing a human can read.

**The outcome:** A sparse tensor of feature activations per layer you can map to the published feature descriptions.

### Steps

1. Install the package with `pip install esm`
2. Load ESMC with EsmcForMaskedLM.from_pretrained and the autoencoder with EsmcSaeModel.from_pretrained on biohub/ESMC-6B-sae-k64-codebook16384
3. Call sae.initialize_layers([30, 60]) and model.add_sae_models with those layers, as in the README
4. Run the model and read output.sae_outputs["layer60"], which is a sparse coo tensor

### Prompt to paste into your agent

```text
Using Biohub/esm, attach the ESMC-6B SAE to layers 30 and 60, run <my sequence> through it, and list the strongest sparse features with their shapes.
```

### Caveat

The human readable feature descriptions in the README apply to the ESMC-6B-sae-layer60-k64-codebook16384 codebook, not every SAE variant.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/biohub-esm/interpret-esmc-features-with-sparse-autoencoders/
