Registry / ai-ml / fair-esm

fair-esm

JSON →
library2.0.0pypypiunverified

FAIR ESM provides pretrained transformer language models for proteins, including ESM-2 and ESM-1b. Version 2.0.0 adds new models and enhancements. The library is actively maintained by Meta AI.

pip install fair-esm
INSTALL
IMPORT
SIG · FAIR-ESM
F
fair-esm
ai-mlpythonv2.0.0
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

esm2_t48_15B_UR50D
from esm.pretrained import esm2_t48_15B_UR50D
from esm.pretrained import esm2_t48_15B_UR50D

Load an ESM-2 model, tokenize sequences, and extract representations.

import torch from esm.pretrained import esm2_t33_650M_UR50D from esm import Alphabet model, alphabet = esm2_t33_650M_UR50D() batch_converter = alphabet.get_batch_converter() model.eval() data = [ ("protein1", "MKTVRQERLKSIVRILERSKEPVSGAQLAEELSVSRQVIVQDIAYLRSLGYNIVATPRGYVLAGG"), ] batch_labels, batch_strs, batch_tokens = batch_converter(data) with torch.no_grad(): results = model(batch_tokens, repr_layers=[33], return_contacts=True) token_representations = results["representations"][33] print(token_representations.shape)
Debug
Known issues
breakingIn v2.0.0, model loading through torch.hub is deprecated; use esm.pretrained instead.
fix
Use from esm.pretrained import ... instead of torch.hub.load('facebookresearch/esm', ...)
affects: >=2.0.0
breakingThe 'esm.pretrained' module no longer provides the old ESM-1b model alias 'esm1b_t33_650M_UR50S' directly; use 'esm1b_t33_650M_UR50S()' remains but check model list.
fix
Refer to the model zoo documentation for updated model names.
affects: >=2.0.0
gotchaGPU memory is very high (e.g., ESM-2 15B requires ~300GB); smaller models like 650M are recommended for most users.
fix
Use esm2_t33_650M_UR50D (650M params) for typical usage.
affects: all
gotchaThe 'return_contacts' flag in forward() can cause OOM; only use if needed.
fix
Set return_contacts=False (default) unless you need attention map.
affects: all
deprecatedThe 'esm.model' submodule is being reorganized; direct class imports may break in future versions.
fix
Use esm.pretrained for model loading and esm for Alphabet.
affects: <2.0.0
Upgrade
Version history
2.0.0latest on PyPI · released Nov 1, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
47 hits · last 30 days
node
46
OpenAI (training)
1
Resources
fair-esm — pip install fair-esm · libregistry