Biotrainer
Biological prediction models made simple.
Overview
Biotrainer is an open-source framework that simplifies machine learning model development for protein analysis. It provides the following modules:
- Training: Easy to use training and inference pipelines for protein feature prediction
- Embedding: Built-in support for protein language models (ProtT5, ESM-2, ESM-C, ...) and baselines (blosum62, one_hot_encoding, ...)
- BioEngineer: Zero-shot predictions and mutation generation of protein sequences
- AutoEval: Automated evaluation of protein language models on curated downstream tasks
Quick Start
1. Installation
Install using pip:
pip install biotrainer
Manual installation using uv:
# First, install uv if you haven't already:
pip install uv
# Create and activate a virtual environment
uv venv
source .venv/bin/activate # On Unix/macOS
# OR
.venv\Scripts\activate # On Windows
# Basic installation
uv sync
# Installation with extras (jupyter, onnx, tensorboard)
uv sync --all-extras
# For Windows users with CUDA support:
# Visit https://pytorch.org/get-started/locally/ and follow GPU-specific installation, e.g.:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
2. Basic Usage
# Training
biotrainer train --config examples/training/sequence_to_class/config.yml
# Inference after Training
python3
>>> from biotrainer.training import BiotrainerModel
>>> model = BiotrainerModel.from_training_result("output/out.yml")
>>> predictions = model.predict("SEQUENCE")
# AutoEval
autoeval_report = (AutoEval(embedder_name="facebook/esm2_t6_8M_UR50D", development_mode=True).
pbc_supervised_contact().
pbc_zeroshot_contact().
pbc_supervised().
pgym(zero_shot_method=ZeroShotMethod.MASKED_MARGINALS).
run())
autoeval_report.summary(development_mode=False)
Note: Biocentral provides a more powerful CLI that uses biotrainer for local or remote model training. The biotrainer CLI is marked as deprecated and might be removed in a future release.
3. Quick Start Datasets
- Subcellular Localization Prediction
- Protocol:
sequence_to_class/residues_to_class - Citations and Download
- Protocol:
- Secondary Structure Prediction
- Protocol:
residue_to_class - Citations and Download
- Protocol:
Features
Supported Training Protocols
- Residue-level classification (
residue_to_class) - Residue-level regression (
residue_to_value) [BETA] - Sequence-level classification (
sequence_to_class) - Sequence-level regression (
sequence_to_value) - Residues-level classification (
residues_to_class, like sequence_to_class with per-residue embeddings) - Residues-level regression (
residues_to_value, like sequence_to_value with per-residue embeddings)
Autoeval
The biotrainer autoeval module allows automatical evaluation of a protein language model on downstream tasks.
You can find public results (wip!) on the autoeval dashboard and compare them
to your own. Learn more in the autoeval examples.
Documentation
Tutorials
- First Steps Guide
- Interactive Training Tutorial
- Config Options Overview
- Biocentral Web Interface (Biotrainer Frontend)
Detailed Guides
Example Training Configuration
protocol: residue_to_class
input_file: input.fasta
model_choice: CNN
optimizer_choice: adam
learning_rate: 1e-3
loss_choice: cross_entropy_loss
use_class_weights: True
num_epochs: 200
batch_size: 128
embedder_name: Rostlab/prot_t5_xl_uniref50
Docker Support
# Run using pre-built image
docker run --gpus all --rm \
-v "$(pwd)/examples/docker":/mnt \
-u $(id -u ${USER}):$(id -g ${USER}) \
ghcr.io/sacdallago/biotrainer:latest /mnt/config.yml
More information on running docker with gpus: Nvidia container toolkit
Getting Help
- Check our Troubleshooting Guide
- Create an issue
- Visit biocentral.cloud
Citation
@inproceedings{
sanchez2022standards,
title={Standards, tooling and benchmarks to probe representation learning on proteins},
author={Joaquin Gomez Sanchez and Sebastian Franz and Michael Heinzinger and Burkhard Rost and Christian Dallago},
booktitle={NeurIPS 2022 Workshop on Learning Meaningful Representations of Life},
year={2022},
url={https://openreview.net/forum?id=adODyN-eeJ8}
}
Metadata
Release files for biotrainer 2.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| biotrainer-2.1.2.tar.gz | 190.2 kB | Without provenance | Details for biotrainer-2.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| biotrainer-2.1.2-py3-none-any.whl | Python 3 | none | any | Details for biotrainer-2.1.2-py3-none-any.whl |
Total release size: 452.8 kB
Release files / biotrainer-2.1.2.tar.gz
| Download URL | biotrainer-2.1.2.tar.gz |
|---|---|
| Size | 190.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b810feff0363ca2b09d83a217aa1daf52abd2ba742845399dfe1fea6c748e64
|
|
BLAKE2b-256 checksum How to use checksums |
cc59499c2d87cb27b7dfb3b37ff26513da757c83e436e7e40514b4d443fdc785
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.7
|
Release files / biotrainer-2.1.2-py3-none-any.whl
| Download URL | biotrainer-2.1.2-py3-none-any.whl |
|---|---|
| Size | 262.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
472cfcea07e80f1b88ecf4931339cc4cfa786672eb97f5dad106ee1a9f6a5025
|
|
BLAKE2b-256 checksum How to use checksums |
cae5a0674d462fa4456b47536bda0004ef31f4de5e358a5cc8a658bef1176eff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.7
|
Security for biotrainer 2.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.