DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to turn protein sequences into embeddings with ESMC with Esm

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

Short answer: Install the package with pip install esm; then load the model and tokenizer with EsmcForMaskedLM.from_pretrained and EsmcTokenizer as in the README example; Tokenize your sequences with return_tensors set to pt and padding set to True, then move the inputs to model.device. All steps.

  • Top pick
  • Security and science
  • Intermediate
  • 45 minutes
  • From the README
  • Claude Code
  • Codex
  • Cursor
  • Gemini CLI

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.

Who it is forA computational biologist who needs protein representations for a downstream model.

The problemTraining a protein model from scratch is out of reach for most teams.

The outcomeEmbeddings and logits for each sequence you pass in, ready for a downstream classifier.

What you need first

  • Python with pip; `pip install esm` is about 5.6 GB, of which about 4.6 GB is the CUDA build of torch
  • A CUDA GPU for the local examples, which load models with device set to cuda
  • A Biohub Platform API token if you use the hosted client instead of local weights

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 for your agent

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.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for Biohub/esm and "Turn protein sequences into embeddings with ESMC"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer