Biological prediction models made simple.
See the code
Biological prediction models made simple.
Biotrainer is an open-source framework that simplifies machine learning model development for protein analysis. It provides the following modules:
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
# 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.
sequence_to_class/residues_to_classresidue_to_classresidue_to_class)residue_to_value) [BETA]sequence_to_class)sequence_to_value)residues_to_class, like sequence_to_class with per-residue embeddings)residues_to_value, like sequence_to_value with per-residue embeddings)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.
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
# 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
@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}
}
Biological prediction models made simple.
See the code
Biological prediction models made simple.
Biotrainer is an open-source framework that simplifies machine learning model development for protein analysis. It provides the following modules:
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
# 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.
sequence_to_class/residues_to_classresidue_to_classresidue_to_class)residue_to_value) [BETA]sequence_to_class)sequence_to_value)residues_to_class, like sequence_to_class with per-residue embeddings)residues_to_value, like sequence_to_value with per-residue embeddings)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.
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
# 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
@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}
}