Installation of RFdiffusion on MacOSX M1 architecture without GPU support

  • Rosetta/DGL Issues: Some advanced functionalities (like DGL-based graph operations) may still fail due to missing native libraries on ARM.
  • Slower Performance: Without CUDA, all computations run on CPU—expect longer runtimes.
  • Apple Silicon Macs can run RFdiffusion via specialized forks and environment tweaks.
  • CUDA-dependent tasks will use CPU; complex models may run slowly.
  • Installing Miniconda and the correct dependencies is essential for a smooth setup.
  • You may need to troubleshoot DGL and compatibility issues.
  1. GitHub Issue: RFdiffusion installation on M1/M2:
    https://github.com/RosettaCommons/RFdiffusion/issues/118

  2. Mac-compatible install instructions (community fork):
    https://github.com/YaoYinYing/RFdiffusion#conda-install-se3-transformer

  3. Hugging Face RFdiffusion package and setup:
    https://huggingface.co/GlandVergil/RFdiffusion

  4. Stable Diffusion on Apple Silicon overview:
    https://huggingface.co/docs/diffusers/v0.5.1/en/optimization/mps

  5. Tutorial: Installing RFdiffusion step-by-step:
    https://meilerlab.org/wp-content/uploads/2023/12/RFDiffusion_tutorial.pdf

Installing RFdiffusion on MacOS M1: Step-by-Step Guide

The explosion of deep learning is transforming the way researchers approach protein design. RFdiffusion, a RosettaFold-based generative tool, empowers users to craft entirely new protein structures. Yet, many Mac users—especially those on the latest Apple Silicon (M1/M2)—hit a wall: the official codebase is built for CUDA on NVIDIA GPUs. Here’s how you can overcome this challenge and get RFdiffusion running on your M1 Mac.

Why RFdiffusion?

RFdiffusion excels at de novo protein design, enabling advances in biotechnology, drug discovery, and synthetic biology. Its architecture adapts the power of RosettaFold for generative tasks, making it invaluable for academic and industrial researchers alike.

The Challenge on Mac M1

The official RFdiffusion relies on CUDA and some Linux-centric dependencies. Apple Silicon (M1/M2) lacks CUDA—NVIDIA’s GPU platform—so a direct installation fails due to missing libraries (like cudatoolkit and dgl). Fortuitously, the open-source community has developed forks and installation recipes, with promising results.

The instruction below should work on MacOSX M1 architecture without GPU support, so it will be slooooww…

https://github.com/YaoYinYing/RFdiffusion/tree/mps-test

git clone https://github.com/RosettaCommons/RFdiffusion.git
cd RFdiffusion
mkdir models && cd models
wget http://files.ipd.uw.edu/pub/RFdiffusion/6f5902ac237024bdd0c176cb93063dc4/Base_ckpt.pt
wget http://files.ipd.uw.edu/pub/RFdiffusion/e29311f6f1bf1af907f9ef9f44b8328b/Complex_base_ckpt.pt
wget http://files.ipd.uw.edu/pub/RFdiffusion/60f09a193fb5e5ccdc4980417708dbab/Complex_Fold_base_ckpt.pt
wget http://files.ipd.uw.edu/pub/RFdiffusion/74f51cfb8b440f50d70878e05361d8f0/InpaintSeq_ckpt.pt
wget http://files.ipd.uw.edu/pub/RFdiffusion/76d00716416567174cdb7ca96e208296/InpaintSeq_Fold_ckpt.pt
wget http://files.ipd.uw.edu/pub/RFdiffusion/5532d2e1f3a4738decd58b19d633b3c3/ActiveSite_ckpt.pt
wget http://files.ipd.uw.edu/pub/RFdiffusion/12fc204edeae5b57713c5ad7dcb97d39/Base_epoch8_ckpt.pt
wget http://files.ipd.uw.edu/pub/RFdiffusion/f572d396fae9206628714fb2ce00f72e/Complex_beta_ckpt.pt
wget http://files.ipd.uw.edu/pub/RFdiffusion/1befcb9b28e2f778f53d47f18b7597fa/RF_structure_prediction_weights.pt
 
conda env create -f ./SE3nv_macos.yml
conda activate RFdiffusion
conda install 'pytorch==2.3.0' torchvision torchaudio cpuonly -c pytorch
pip install 'dgl==2.2.1' -f https://data.dgl.ai/wheels/repo.html
pip install git+https://github.com/YaoYinYing/nvtx-mock --force-reinstall
pip install nvtx
pip install git+https://github.com/YaoYinYing/SE3Transformer@rfdiffusion-mps-test
pip install git+https://github.com/NVIDIA/dllogger#egg=dllogger
pip install git+https://github.com/YaoYinYing/RFdiffusion@mps-test
pip install pydantic
pip install torchdata==0.9.0
conda activate RFdiffusion
cd ./examples
tar -xvf ./ppi_scaffolds_subset.tar.gz
 

Make your first run:

./scripts/run_inference.py 'contigmap.contigs=[150-150]' inference.output_prefix=test_outputs/test inference.num_designs=10