Text Classification
Transformers
Joblib
English
biology
antimicrobial-peptides
esm2
protein-language-model
drug-discovery
Instructions to use tomekdab/ai-amp-models with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tomekdab/ai-amp-models with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="tomekdab/ai-amp-models")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("tomekdab/ai-amp-models", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language: en
|
| 4 |
+
tags:
|
| 5 |
+
- biology
|
| 6 |
+
- antimicrobial-peptides
|
| 7 |
+
- esm2
|
| 8 |
+
- protein-language-model
|
| 9 |
+
- drug-discovery
|
| 10 |
+
library_name: transformers
|
| 11 |
+
pipeline_tag: text-classification
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# AMP-Scan models
|
| 15 |
+
|
| 16 |
+
Trained models for antimicrobial peptide (AMP) prediction, part of the
|
| 17 |
+
[ai-amp-search](https://github.com/tomdabro/ai-amp-search) project.
|
| 18 |
+
|
| 19 |
+
## Models in this repo
|
| 20 |
+
|
| 21 |
+
| File | What it is | Size | Verified |
|
| 22 |
+
|------|-----------|------|----------|
|
| 23 |
+
| `esm_amp.joblib` | ESM-2 embeddings + logistic regression (AMP classifier) | 3 KB | acc 0.992, AUC 1.000 (naive split) / 0.971 (homology-controlled) |
|
| 24 |
+
| `hemolysis.joblib` | ESM-2 embeddings + logistic regression (toxicity) | 3 KB | acc 0.994, AUC 0.998 |
|
| 25 |
+
| `amp_gpt.pt` | Character-level GPT trained on AMP sequences (2.69M params) | 10 MB | val perplexity 10.13 (best epoch) |
|
| 26 |
+
| `esm_finetuned.pt` | ESM-2 35M fine-tuned end-to-end with classification head | 134 MB | acc 0.956, AUC 0.990 |
|
| 27 |
+
|
| 28 |
+
## Usage
|
| 29 |
+
|
| 30 |
+
```python
|
| 31 |
+
import joblib, torch
|
| 32 |
+
from transformers import AutoModel, AutoTokenizer
|
| 33 |
+
|
| 34 |
+
# AMP classifier (frozen ESM-2 embeddings + logistic regression)
|
| 35 |
+
clf = joblib.load("esm_amp.joblib")["clf"]
|
| 36 |
+
tok = AutoTokenizer.from_pretrained("facebook/esm2_t6_8M_UR50D")
|
| 37 |
+
esm = AutoModel.from_pretrained("facebook/esm2_t6_8M_UR50D")
|
| 38 |
+
# ... embed with mean pooling, then clf.predict_proba(X)
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
Full pipeline (train, score, generate, evaluate) in the GitHub repo:
|
| 42 |
+
`https://github.com/tomdabro/ai-amp-search`
|
| 43 |
+
|
| 44 |
+
## Data
|
| 45 |
+
|
| 46 |
+
- **GRAMPA** (Witten & Witten 2019, bioRxiv): 6,642 unique AMP
|
| 47 |
+
sequences with log10 MIC against E. coli.
|
| 48 |
+
- **ConsAMPHemo** (Xie et al. 2025, Protein Science): 884 peptides,
|
| 49 |
+
hemolytic vs non-hemolytic.
|
| 50 |
+
- **UniProt** (CC-BY-4.0): non-AMP negatives.
|
| 51 |
+
|
| 52 |
+
## Honest evaluation
|
| 53 |
+
|
| 54 |
+
The naive random split gives AUC 1.000 — inflated by homology leakage
|
| 55 |
+
(near-identical family variants in both train and test). With a
|
| 56 |
+
homology-controlled split (k-mer Jaccard >= 0.8 clustering, split by
|
| 57 |
+
cluster), the honest AUC is **0.971**. Length-binned AUC: [5,20] 0.959,
|
| 58 |
+
[21,50] 0.972 — the model is not just predicting length.
|
| 59 |
+
|
| 60 |
+
## License
|
| 61 |
+
|
| 62 |
+
MIT (code). Data is third-party with its own terms.
|