RFdiffusion / README.md
Zhongning's picture
Add Chinese README section
72aea95 verified
|
Raw History Blame Contribute Delete
9.95 kB
---
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) 文件),可免费用于非营利和商业目的。