{
 "schema_version": 1,
 "generated": "2026-10-31",
 "id": "biohub-esm--embed-protein-sequences-with-esmc",
 "repo": "Biohub/esm",
 "repo_url": "https://github.com/Biohub/esm",
 "repo_slug": "biohub-esm",
 "title": "Turn protein sequences into embeddings with ESMC",
 "page_title": "How to turn protein sequences into embeddings with ESMC with Esm",
 "summary": "Load ESMC 6B from Hugging Face with the Esm package and get per layer representations for your sequences.",
 "who": "A computational biologist who needs protein representations for a downstream model.",
 "problem": "Training a protein model from scratch is out of reach for most teams.",
 "outcome": "Embeddings and logits for each sequence you pass in, ready for a downstream classifier.",
 "steps": [
  "Install the package with `pip install esm`",
  "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",
  "Run the model inside torch.inference_mode, and pass output_hidden_states=True to get hidden states from all transformer layers"
 ],
 "agent_prompt": "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.",
 "agents": [
  "claude-code",
  "codex",
  "cursor",
  "gemini-cli"
 ],
 "difficulty": "Intermediate",
 "time": "45 minutes",
 "basis": "readme",
 "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.",
 "category": "Security and science",
 "tags": [
  "Security and science"
 ],
 "lang": "",
 "requirements": [
  "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"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [
  {
   "tag": "platform",
   "notice": "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."
  }
 ],
 "best": true,
 "score": 1.0,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/biohub-esm/embed-protein-sequences-with-esmc/",
 "md": "https://dedupedai.com/use-cases/biohub-esm/embed-protein-sequences-with-esmc/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/biohub-esm--embed-protein-sequences-with-esmc.json",
 "api_version": "v1"
}
