File size: 5,336 Bytes
24ba92e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | ---
license: bsd-3-clause
language:
- en
tags:
- OneScience
- protein backbone generation
- protein design
frameworks:
- PyTorch
---
<p align="center">
<strong>
<span style="font-size: 30px;">RFdiffusion</span>
</strong>
</p>
# Model Overview
RFdiffusion is a diffusion-based method for protein backbone generation and design. It can be used for unconditional backbone generation, motif scaffolding, PPI/binder design, and symmetric oligomer sampling.
# Model Description
RFdiffusion is a generative protein design model based on the RoseTTAFold three-track network and an SE(3)-equivariant denoising diffusion process. It can progressively generate protein backbones from random structures while satisfying specified topology or functional constraints.
The current Hugging Face package is designed for download-and-use workflows, local quick validation, and OneCode automated runtime scenarios. Code, configurations, example inputs, and weights are all included in the current directory.
# Use Cases
| Use case | Description |
| :---: | :--- |
| Unconditional backbone generation | Takes contig constraints as input and outputs designed backbone PDB files. |
| Motif scaffolding | Takes a PDB file containing the motif and contig constraints as input, and outputs scaffold design results. |
| PPI/binder design | Takes the target structure, hotspot, and contig parameters as input, and outputs candidate binder designs. |
| Symmetric oligomer sampling | Uses symmetry configuration to generate symmetric structure designs. |
| Hugging Face full-package validation | Uses the package layout `config/ modules/ scripts/ examples/ weight/` directly for preflight checks and inference. |
# Usage
## 1. Using OneCode
You can try intelligent one-click AI4S programming through the OneCode online environment:
[Try intelligent one-click AI4S programming](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)
## 2. Manual Installation and Usage
**Hardware Requirements**
- Running on a GPU or DCU is recommended.
- CPU can be used for connectivity checks, but it is relatively slow.
- DCU users need to install DTK in advance. DTK 25.04.2 or later is recommended, or the OneScience-recommended version that matches the current cluster.
**Software Requirements**
For more information about adaptation details, contact liubiao@sugon.com.
**Environment Checks**
- NVIDIA GPU:
```bash
nvidia-smi
```
- Hygon DCU:
```bash
hy-smi
```
## Quick Start
### 1. Install the Runtime Environment
```bash
conda create -n onescience311 python=3.11 -y
conda activate onescience311
pip install onescience[bio] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
```
If the following code cannot find required libraries at runtime, activate CUDA as shown below.
```bash
source ${ROCM_PATH}/cuda/env.sh
export LD_LIBRARY_PATH="$CONDA_PREFIX/lib:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="$CONDA_PREFIX/lib/python3.11/site-packages/fastpt/torch/lib:$LD_LIBRARY_PATH"
```
### 2. Download the Model Package and Install the Environment
```bash
hf download --model OneScience-Sugon/RFdiffusion --local-dir ./RFdiffusion
```
### Training Weights
Training weights are already included in the `weights` folder and can be used directly after downloading the model package.
### 3. Run Preflight Checks
Check files and real weights:
```bash
python scripts/preflight.py --strict-weights
```
Check local imports after installing dependencies:
```bash
python scripts/preflight.py --strict-weights --strict-imports
```
Validate only the entry point and Hydra configuration without running sampling:
```bash
RF_DIFFUSION_SMOKE_TEST=1 python scripts/run_inference.py
```
### 4. Run Inference
If execution fails because a `.cache` file is missing, you can create it manually.
Example of unconditional backbone sampling:
```bash
python scripts/run_inference.py \
'contigmap.contigs=[80-80]' \
diffuser.T=15 \
inference.final_step=15 \
inference.num_designs=1 \
inference.write_trajectory=False \
inference.output_prefix=outputs/smoke/design
```
Example of motif scaffolding:
```bash
python scripts/run_inference.py \
inference.input_pdb=examples/input_pdbs/1YCR.pdb \
'contigmap.contigs=[10-40/A163-181/10-40]' \
inference.output_prefix=outputs/motif/design
```
Example of symmetric sampling:
```bash
python scripts/run_inference.py --config-name symmetry \
diffuser.T=15 \
inference.final_step=15 \
inference.output_prefix=outputs/symmetry/c2
```
### 5. Common Environment Variables
```bash
export RF_DIFFUSION_MODEL_DIR=weight
export RF_DIFFUSION_INPUT_PDB=examples/input_pdbs/1qys.pdb
export RF_DIFFUSION_OUTPUT_PREFIX=outputs/design
export RF_DIFFUSION_SCHEDULE_DIR=.cache/schedules
```
# Official OneScience Information
| Platform | OneScience main repository | Skills repository |
| --- | --- | --- |
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
# Citation and License
RFdiffusion is released under the BSD open-source license (see the [LICENSE](https://github.com/RosettaCommons/RFdiffusion/blob/main/LICENSE) file) and can be used free of charge for both non-profit and commercial purposes.
|