hhhhh789 commited on
Commit ·
bde6d0a
1
Parent(s): ed4aa37
add readme
Browse files
README.md
CHANGED
|
@@ -1,3 +1,91 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## [ICLR 2025 Spotlight] A Periodic Bayesian Flow for Material Generation (CrysBFN)
|
| 2 |
+
|
| 3 |
+
> [!IMPORTANT]
|
| 4 |
+
> [2025/07] We upload the pretrained checkpoints [here](https://drive.google.com/drive/folders/1W5kGiZYFRJZiyKyTwCdcPk9lbjTsTCO-?usp=drive_link) with instructions below.
|
| 5 |
+
|
| 6 |
+
This is the implementation code for ICLR 2025 Spotlight paper CrysBFN.
|
| 7 |
+
|
| 8 |
+
[\[paper\]](arxiv.org/pdf/2502.02016)
|
| 9 |
+
[\[website\]](https://t.co/a4x4qlROH7)
|
| 10 |
+
|
| 11 |
+

|
| 12 |
+
|
| 13 |
+
Here is the visualization of the proposed periodic Bayesian flow:
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+

|
| 17 |
+
|
| 18 |
+
And here is the visualization of the unified BFN generation framework
|
| 19 |
+

|
| 20 |
+
<!-- Here is an animation of the generation process.
|
| 21 |
+
 -->
|
| 22 |
+
|
| 23 |
+
## Install
|
| 24 |
+
### 1. Set up environment variables
|
| 25 |
+
Firstly please set up dot environment variables in .env file.
|
| 26 |
+
- `PROJECT_ROOT`: path to the folder that contains this repo. e.g. /data/wuhl/CrysBFN
|
| 27 |
+
- `HYDRA_JOBS`: path to a folder to store hydra outputs. This is the directory where we store checkpoints. e.g. /data/wuhl/CrysBFN/hydra
|
| 28 |
+
- `WABDB`: path to a folder to store wandb outputs e.g. /data/wuhl/CrysBFN/wandb
|
| 29 |
+
|
| 30 |
+
### 2. Install with Mamba
|
| 31 |
+
We recommend using [Mamba](https://github.com/conda-forge/miniforge) or conda (with libmamba solver) to build the python environment. It may take several minutes to solve the environment—please wait patiently.
|
| 32 |
+
```
|
| 33 |
+
conda env create -f environment.yml
|
| 34 |
+
conda activate crysbfn
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
## Training, Sampling and Evaluation
|
| 38 |
+
We use shell scripts in `scripts` to manage all pipelines. Hyper-parameters can be set in those shell script files. Scripts to launch experiments can be found in `scripts/csp_scripts` and `scripts/gen_scripts` for crystal structure prediction task and de novo generation task.
|
| 39 |
+
### Training
|
| 40 |
+
|
| 41 |
+
For launching a de novo generation task training experiment, please use the following code:
|
| 42 |
+
```
|
| 43 |
+
bash ./scripts/gen_scripts/mp20_exps.sh
|
| 44 |
+
```
|
| 45 |
+
Every first run on each dataset requires longer time (< 1 hour) for preparing the cache processed data.
|
| 46 |
+
For launching a crystal structure prediction task training experiment, please use the following code:
|
| 47 |
+
```
|
| 48 |
+
bash ./scripts/csp_scripts/mp20_exps.sh
|
| 49 |
+
```
|
| 50 |
+
### Sampling and Evaluating
|
| 51 |
+
After training, please modify the MODEL_PATH variable as the hydra directory of the training experiment. Then, use the below code to generate and evaluating samples.
|
| 52 |
+
```
|
| 53 |
+
bash scripts/csp_scripts/eval_mp20.sh
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
### Use Our Checkpoints
|
| 57 |
+
We provide our checkpoints [here](https://drive.google.com/drive/folders/1W5kGiZYFRJZiyKyTwCdcPk9lbjTsTCO-?usp=drive_link). Here is a fastest example (NFE=10) to use the checkpoint to verify your installation:
|
| 58 |
+
|
| 59 |
+
1. Download the zip file into the hydra directory and unzip it
|
| 60 |
+
```
|
| 61 |
+
cd hydra
|
| 62 |
+
unzip ./mp20_csp_s10.zip
|
| 63 |
+
```
|
| 64 |
+
2. Modify the first line in `scripts/csp_scripts/mp20_eval.sh`
|
| 65 |
+
```
|
| 66 |
+
MODEL_PATH=/data/wuhl/CrysBFN/hydra/mp20_csp_s10 # modify according to your path
|
| 67 |
+
```
|
| 68 |
+
3. Run the code to sample and eval
|
| 69 |
+
```
|
| 70 |
+
cd ..
|
| 71 |
+
bash scripts/csp_scripts/mp20_eval.sh
|
| 72 |
+
```
|
| 73 |
+
### Toy Example
|
| 74 |
+
We provide toy examples with minimal components illustrating how BFNs work in `./toy_example`.
|
| 75 |
+
|
| 76 |
+
## Citation
|
| 77 |
+
If you find this repo or our paper useful, please cite our paper :\)
|
| 78 |
+
```
|
| 79 |
+
@misc{wu2025periodicbayesianflowmaterial,
|
| 80 |
+
title={A Periodic Bayesian Flow for Material Generation},
|
| 81 |
+
author={Hanlin Wu and Yuxuan Song and Jingjing Gong and Ziyao Cao and Yawen Ouyang and Jianbing Zhang and Hao Zhou and Wei-Ying Ma and Jingjing Liu},
|
| 82 |
+
year={2025},
|
| 83 |
+
eprint={2502.02016},
|
| 84 |
+
archivePrefix={arXiv},
|
| 85 |
+
primaryClass={cs.LG},
|
| 86 |
+
url={https://arxiv.org/abs/2502.02016},
|
| 87 |
+
}
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
## Acknowledgement
|
| 91 |
+
The main structure of this repository is mainly based on [CDVAE](https://github.com/txie-93/cdvae). The environment configuration file is modified after environment.yml in [FlowMM](https://github.com/txie-93/cdvae).
|