File size: 9,951 Bytes
24ba92e ec7c559 24ba92e 72aea95 | 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 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | ---
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 OneScience-Group/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.
---
# 中文说明
## 模型概述
RFdiffusion 是一种基于扩散的蛋白质主链生成与设计方法。它可用于无条件主链生成、motif 支架搭建(motif scaffolding)、PPI/binder 设计以及对称寡聚体采样。
## 模型描述
RFdiffusion 是一个基于 RoseTTAFold 三轨网络和 SE(3) 等变去噪扩散过程的生成式蛋白质设计模型。它能够从随机结构出发逐步生成蛋白质主链,同时满足指定的拓扑或功能约束。
当前的 Hugging Face 软件包面向下载即用的工作流、本地快速验证以及 OneCode 自动化运行场景设计。代码、配置、示例输入和权重都包含在当前目录中。
## 适用场景
| 适用场景 | 说明 |
| :---: | :--- |
| 无条件主链生成 | 以 contig 约束作为输入,输出设计得到的主链 PDB 文件。 |
| motif 支架搭建 | 以包含 motif 的 PDB 文件和 contig 约束作为输入,输出支架设计结果。 |
| PPI/binder 设计 | 以目标结构、hotspot 和 contig 参数作为输入,输出候选 binder 设计。 |
| 对称寡聚体采样 | 使用对称性配置生成对称结构设计。 |
| Hugging Face 完整包验证 | 直接使用软件包布局 `config/ modules/ scripts/ examples/ weight/` 进行预检和推理(inference)。 |
## 使用方式
### 1. 使用 OneCode
你可以通过 OneCode 在线环境体验智能一键式 AI4S 编程:
[体验智能一键式 AI4S 编程](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)
### 2. 手动安装与使用
**硬件要求**
- 推荐在 GPU 或 DCU 上运行。
- CPU 可用于连通性检查,但速度相对较慢。
- DCU 用户需要提前安装 DTK。推荐使用 DTK 25.04.2 或更高版本,或与当前集群匹配的 OneScience 推荐版本。
**软件要求**
如需了解更多适配细节,请联系 liubiao@sugon.com。
**环境检查**
- NVIDIA GPU:
```bash
nvidia-smi
```
- 海光 DCU:
```bash
hy-smi
```
### 快速开始
#### 1. 安装运行环境
```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
```
如果下面的代码在运行时找不到所需的库,请按如下方式激活 CUDA。
```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. 下载模型包并安装环境
```bash
hf download OneScience-Group/RFdiffusion --local-dir ./RFdiffusion
```
#### 训练权重
训练权重已包含在 `weights` 文件夹中,下载模型包后即可直接使用。
#### 3. 运行预检
检查文件和真实权重:
```bash
python scripts/preflight.py --strict-weights
```
安装依赖后检查本地导入:
```bash
python scripts/preflight.py --strict-weights --strict-imports
```
仅验证入口点和 Hydra 配置,不运行采样:
```bash
RF_DIFFUSION_SMOKE_TEST=1 python scripts/run_inference.py
```
#### 4. 运行推理
如果因缺少 `.cache` 文件而执行失败,你可以手动创建它。
无条件主链采样示例:
```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
```
motif 支架搭建示例:
```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
```
对称采样示例:
```bash
python scripts/run_inference.py --config-name symmetry \
diffuser.T=15 \
inference.final_step=15 \
inference.output_prefix=outputs/symmetry/c2
```
#### 5. 常用环境变量
```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
```
## OneScience 官方信息
| 平台 | OneScience 主仓库 | Skills 仓库 |
| --- | --- | --- |
| 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 |
## 引用与许可
RFdiffusion 基于 BSD 开源许可证发布(参见 [LICENSE](https://github.com/RosettaCommons/RFdiffusion/blob/main/LICENSE) 文件),可免费用于非营利和商业目的。
|