esm icon indicating copy to clipboard operation
esm copied to clipboard

Binder design script without modal?

Open remybonnav opened this issue 5 months ago • 4 comments

Thanks for your amazing contribution.

I'm wondering if you could publish also a basic script for binder design that run locally without modal?

Thanks in advance

remybonnav avatar Jun 03 '26 19:06 remybonnav

Hi @remybonnav, the current code should support running a single trajectory of binder design without Modal.

From a fresh environment containing only python and uv, could you try running uv run binder_design.py?

When I do that I see the following:

>>> uv run binder_design.py
Installed 133 packages in 28.65s
ESMC: transformer_engine is not installed; falling back to pure-PyTorch LayerNorm+Linear / LayerNorm+MLP. Outputs will differ numerically — measured on the unnormalized residual stream (before the final LayerNorm), ~O(10) max-diff in fp32 and ~O(100) in bf16; after the final LayerNorm these shrink to a few ULP and perplexity stays within rounding noise. Install with `pip install transformer-engine[pytorch]` to enable fused fp32-reduction LayerNorm.
ESMC: neither xformers nor flash-attn is installed; falling back to PyTorch ``F.scaled_dot_product_attention``. The attention reduction order in bf16 differs from a fused kernel by ~1 bf16 ULP per attention block; compounded across the 80-block stack this reaches ~O(100) max-diff on the unnormalized residual stream. Install xformers (preferred) with `pip install xformers` for a fused attention kernel.
ESMC: flash-attn rotary kernel not installed; falling back to pure-PyTorch RoPE. For faster GPU inference run `pip install flash-attn`.
🚨 No checkpoint found for ESMCForSequenceClassification.forward. Please add a `checkpoint` arg to `auto_docstring` or add one in ESMCConfig's docstring
🚨 No checkpoint found for ESMCForTokenClassification.forward. Please add a `checkpoint` arg to `auto_docstring` or add one in ESMCConfig's docstring
Loading checkpoint shards: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 6/6 [00:03<00:00,  1.96it/s]
`torch_dtype` is deprecated! Use `dtype` instead!
Loading checkpoint shards: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 6/6 [00:00<00:00, 56.83it/s]
Loading CCD dictionary from /mnt/main0/home/rverkuil/.cache/huggingface/hub/models--biohub--ESMFold2/snapshots/1ebf0e3481a5184eb6171d40615c79e384b48796/ccd.pkl
2026-06-04 17:33:42,190 INFO:   step   0  |  intra_contact_loss=4.3884  inter_contact_loss=4.7736  glob_loss=0.6850  total_loss=7.7805  plm_loss=3.0625  T=0.9999
2026-06-04 17:33:49,526 INFO:   step   5  |  intra_contact_loss=3.8481  inter_contact_loss=4.0759  glob_loss=0.1322  total_loss=7.2228  plm_loss=3.2344  T=0.9961
2026-06-04 17:33:57,205 INFO:   step  10  |  intra_contact_loss=2.6913  inter_contact_loss=2.8747  glob_loss=-0.0195  total_loss=6.1697  plm_loss=3.3906  T=0.9869
2026-06-04 17:34:04,352 INFO:   step  15  |  intra_contact_loss=3.5283  inter_contact_loss=3.9460  glob_loss=0.0866  total_loss=7.3170  plm_loss=3.5625  T=0.9725
...
2026-06-04 17:37:08,659 INFO:   step 140  |  intra_contact_loss=1.1595  inter_contact_loss=1.6398  glob_loss=-0.3149  total_loss=3.0710  plm_loss=1.7344  T=0.0188
2026-06-04 17:37:18,073 INFO:   step 145  |  intra_contact_loss=1.2424  inter_contact_loss=1.7267  glob_loss=-0.4155  total_loss=3.0499  plm_loss=1.6484  T=0.0117
2026-06-04 17:37:38,225 INFO:
Designed sequence: ['AFTVTVPKDLYVVEYGSNMTIECKFPVEKQLDLAALIVYWEMEDKNIIQFVHGEEDLKVQHSSYRQRARLLKDQLSLGNAALQITDVKLQDAGVYRCMISYGGADYKRITVKVNA|EEEEEASGGGGGGGGGGGGILDLLQSILEILRLLLRLLRRGFRVSIRLLLLLQILVEQLLDLAELAGLDDLLPRLEALRRRILELLRQFGRGLSEEAVLDFARALLEATRAVLARVRATQDLDAAEAEVLAQAEAVVEALEEVVERLRREVRAAAAAR']
2026-06-04 17:37:38,226 INFO: Trajectory length: 150 steps
2026-06-04 17:37:38,226 INFO: Average final loss: 2.8958

It should also work to make an env containing the packages specified at the top of binder_design.py, and then invoking python binder_design.py.


NOTE - we are planning some improvements in the coming week:

  1. Improving documentation generally!
  2. Allow passing in command line arguments more easily. Right now there is just a hard-coded case in the script's mainguard.
  3. Allow using use_scaling_models=True when running locally.
    1. Right now it will fail when calling uv run binder_design.py due to the abnumber package requiring these conda-only installs. This can be addressed.
  4. Speed improvements.

robert-verkuil avatar Jun 04 '26 17:06 robert-verkuil

Looking forward to these changes. Thanks for sharing your work. Already getting better predictions compared to Protenix-v2 and Boltz-2 for antibody-antigen complexes that include large structural changes upon binding.

rano1256 avatar Jun 10 '26 12:06 rano1256

NOTE - we are planning some improvements in the coming week:

  1. Improving documentation generally!

  2. Allow passing in command line arguments more easily. Right now there is just a hard-coded case in the script's mainguard.

  3. Allow using use_scaling_models=True when running locally.

    1. Right now it will fail when calling uv run binder_design.py due to the abnumber package requiring these conda-only installs. This can be addressed.
  4. Speed improvements.

Hi, do you have an estimated timeline for these changes? Thank you.

rano1256 avatar Jul 02 '26 03:07 rano1256

Closing this issue for now as it is stale. Please re-open if needed.

faustomilletari avatar Jul 21 '26 12:07 faustomilletari