RFdiffusion / README.md
anzhi2710gmailcom's picture
Upload folder using huggingface_hub
24ba92e verified
|
Raw
History Blame Contribute Delete
5.34 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 --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.