Instructions to use sahithimacharapu2/ec-esm13 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sahithimacharapu2/ec-esm13 with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("sahithimacharapu2/ec-esm13", device_map="auto") - Notebooks
- Google Colab
- Kaggle
ESM-2 35M Enzyme EC Number Classifier
Fine-tuned ESM-2 35M for Enzyme Commission (EC) number prediction from amino-acid sequences.
Task
Given a protein sequence, predict its 4-level EC number (e.g., 1.1.1.131).
Evaluation is at all 4 levels (L1βL4); primary metric is L4 accuracy.
Inference
python /app/predict.py --input val_inputs.parquet --output predictions.jsonl
Input: Parquet with columns id (str) and sequence (str).
Output: JSONL, one line per input: {"id": "...", "prediction": ["x.x.x.x", ...]}.
Docker
# Clone repo (includes model weights)
git lfs install
git clone https://huggingface.co/YOUR_USERNAME/enzyme-ec-esm2
# Build
docker build -t enzyme-ec enzyme-ec-esm2/
# Run
docker run --rm \
-v $(pwd)/data:/data \
enzyme-ec \
python /app/predict.py \
--input /data/val_inputs.parquet \
--output /data/predictions.jsonl
Environment Variables
| Variable | Default | Description |
|---|---|---|
EC_TIME_BUDGET |
660 |
Max seconds for inference |
EC_BATCH |
32 |
Batch size |
EC_THRESH |
0.5 |
Probability threshold for extra predictions (set 1.1 for top-1 only) |
Training Code
# Key architecture (must match for checkpoint to load)
class ESMClassifier(nn.Module):
def __init__(self, model_name, num_classes, dropout=0.1, n_freeze=4):
super().__init__()
self.esm = EsmModel.from_pretrained(model_name, add_pooling_layer=False)
H = self.esm.config.hidden_size # 480
self.classifier = nn.Sequential(
nn.Dropout(dropout), nn.Linear(H, H), nn.GELU(),
nn.Dropout(dropout), nn.Linear(H, num_classes))
File Structure
.
βββ Dockerfile
βββ README.md
βββ ec_vocabulary.json # 6939 valid EC numbers
βββ inputs.py # input validation helper
βββ model.py # ESMClassifier definition + load_model()
βββ predict.py # inference entrypoint
βββ requirements.txt
βββ task.json # benchmark metadata
βββ weights/
βββ classes.json # l4 class list + fallback_ec
βββ classifier_head.pt # fine-tuned head state_dict
βββ meta.json # model hyperparameters
βββ esm2/ # ESM-2 backbone weights
βββ config.json
βββ model.safetensors
βββ tokenizer_config.json
βββ vocab.txt
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support