FastPLMs
Collection
15 items
•
Updated
•
1
The GitHub with the implementation and requirements can be found here.
This is a barebones Huggingface AutoModel compatible implementation of Boltz2 focused on fast inference workflows.
The implementation is located in boltz_automodel/ and exposes:
Boltz2ConfigBoltz2Modelpredict_structure(amino_acid_sequence, ...)save_as_cif(structure_output, output_path, ...)torch + transformers (plus numpy).trust_remote_code=True.plddt, ptm, iptm, and derived confidence score when available).This implementation is self-contained inside boltz_automodel/ and does not require
the original cloned boltz package at runtime.
import torch
from transformers import AutoModel
model = AutoModel.from_pretrained(
"Synthyra/Boltz2",
trust_remote_code=True,
dtype=torch.float32,
).eval()
out = model.predict_structure(
amino_acid_sequence="MSTNPKPQRKTKRNTNRRPQDVKFPGG",
recycling_steps=3,
num_sampling_steps=200,
diffusion_samples=1,
)
print(out.sample_atom_coords.shape)
print(None if out.plddt is None else out.plddt.shape)
model.save_as_cif(out, "prediction.cif")
Use:
py -m boltz_automodel.get_boltz2_weights --checkpoint_path boltz_automodel/weights/boltz2_conf.ckpt --output_dir boltz2_automodel_export
The export directory contains:
config.jsonpytorch_model.binmodeling_boltz2.pyminimal_featurizer.pyminimal_structures.pycif_writer.pyvb_*.py (self-contained vendored Boltz2 inference modules/constants)predict_structure(...) returns Boltz2StructureOutput with:
sample_atom_coordsatom_pad_maskplddtcomplex_plddtptmiptmconfidence_score (derived when available)raw_outputBuild the container at repo root:
docker build -t fastplms-test -f Dockerfile .
Launch a test shell:
docker run --rm --gpus all -it -v ${PWD}:/workspace fastplms-test bash
Inside the container, run Boltz2 compliance against pip boltz:
python -m test_scripts.run_boltz2_compliance --device cuda --dtype float32 --seed 42 --num-sequences 3 --recycling-steps 3 --num-sampling-steps 200 --diffusion-samples 1
Artifacts are written to test_scripts/results/<timestamp>/boltz2_compliance/ by default:
metrics.jsonmetrics.csvsummary.txt