이 repo에는 종이 별 모양의 데노이징 확산 확률 모델에 대한 공식 Pytorch 구현이 포함되어 있습니다. 이는 비 유클리드 매니 폴드에 적용 할 수있는 비 가우시안 확산 모델을 생성하는 접근 방식이 포함되어 있습니다.
Andrey Okhotin*, Dmitry Molchanov*, Vladimir Arkhipkin, Grigory Bartosh, Viktor Ohanesian, Aibek Alanov, Dmitry Vetrov
보조 : Sergei Kholkin

DDPMS (Denoising 확산 확률 론적 모델)는 최근 생성 모델링의 혁신에 대한 토대를 제공합니다. 그들의 Markovian 구조는 가우시안 이외의 분포 또는 이산 이외의 분포로 DDPM을 정의하기가 어렵습니다. 이 논문에서는 별 모양의 DDPM (SS-DDPM)을 소개합니다. 별 모양의 확산 프로세스를 통해 전이 확률을 정의하거나 포스터를 계산해야 할 필요성을 우회 할 수 있습니다. 우리는 지수 분포 패밀리에 대한 별 모양과 특정 Markovian 확산 사이의 이중성을 확립하고 SS-DDPMS에서 훈련 및 샘플링을위한 효율적인 알고리즘을 도출합니다. 가우스 분포의 경우, SS-DDPM은 DDPM과 동일합니다. 그러나 SS-DDPMS는 베타, 폰 미스 (폰 미스) (피셔, 디 히렛, 위시 르트 등과 같은 분포로 확산 모델을 설계하기위한 간단한 레시피를 제공합니다. 이는 제한된 매니 폴드에 데이터가있을 때 특히 유용 할 수 있습니다. 우리는 다른 설정에서 모델을 평가하고 Beta SS-DDPM이 가우스 DDPM과 비슷한 결과를 달성하는 이미지 데이터에서도 경쟁력이 있습니다.
"lib/diffusion"디렉토리에 설명 된 주요 SS-DDPM 논리. 원한다면 충분할 수 있습니다
또한 디렉토리 "Notebooks"에서 Geodesic 및 Synthetic Data에서 SS-DDPM을 사용하는 예를 찾을 수 있습니다. 결과를 재현하려면 CIFAR10 및 Text8에서 실험에 대한 명령 실행의 예를 찾을 수 있습니다.
리포 구조 :
이 repo는 Torch == 1.12.0+Cu113 Torchvision == 0.13.0+Cu113으로 테스트되었습니다
git clone https://github.com/andrey-okhotin/star-shaped
cd star-shaped
pip install -r requirements.txt
# only if you don't have pytorch or your pytorch version < 1.11
pip install torch==1.12.0+cu113 torchvision==0.13.0+cu113 --extra-index-url https://download.pytorch.org/whl/cu113
# only for experiments with synthetic data, otherwise you can just comment all 'import npeet'
git clone https://github.com/gregversteeg/NPEET.git && cd NPEET && pip install . && cd ../ && rm -rf NPEET데이터 세트 폴더의 컨텐츠 다운로드 - 모든 파이프 라인에 필요합니다. 이 명령은 약 5 분이 걸릴 수 있습니다.
pip install py7zr gdown
rm -rf star-shaped/datasets
gdown --fuzzy https://drive.google.com/file/d/1ndXOmbNXR6pwoJ5qs1gVP0eAKU_RAl6E/view ? usp=sharing
py7zr x datasets.7z && rm datasets.7z && mv datasets star-shaped/datasetspretrained_models 폴더의 컨텐츠 다운로드 - 훈련 파이프 라인에 필요하지 않습니다. 이 명령은 약 3 분이 걸릴 수 있습니다.
pip install py7zr gdown
rm -rf star-shaped/pretrained_models
gdown --fuzzy https://drive.google.com/file/d/1Lebmsti31CwOFg4LYJYlWmlS7rGYQfVi/view ? usp=sharing
py7zr x pretrained_models.7z && rm pretrained_models.7z && mv pretrained_models star-shaped/pretrained_modelsDirectory SS_DDPM/노트북의 Jupyter-Notebook에서 실행할 수 있습니다. 그곳에서 훈련 및 샘플링의 예를 찾을 수 있습니다.
Directory SS_DDPM에서 Bash에서 실행할 수 있습니다
실행 명령 :
python lib/run_pipeline -gpu < gpu0_idx > _ < gpu1_idx > _ < gpu2_idx > -pipeline < pipeline_name > -logs_file < name_of_txt_file_to_write_execution_info > -port < available_port_for_processes_sync > . . . " other_pipeline_arguments "단일 노드에서 3 GPU에서 실행하기위한 짧은 사용 예 :
python lib/run_pipeline -gpu 0_1_2 -pipeline train_cifar10 -logs_file logs_train_cifar10.txt -port 8890 . . . " other_pipeline_arguments " 4 NVIDIA V100에서 BETA SS-DDPM 교육 (~ 32GB GPU 메모리 필요). 검사 점은 디렉토리 "Checkpoints/Train_Beta_SS_CIFAR10"디렉토리에 저장됩니다. 손실 그래픽은 디렉토리 "results/train_beta_ss_cifar10"에 저장됩니다.
python lib/run_pipeline.py -gpu 0_1_2_3 -port 8900 -pipeline training_cifar10 -diffusion beta_ss -loss KL_rescaled -save_folder train_beta_ss_cifar10 -logs_file logs_training_beta_ss_cifar10.txt
cp checkpoints/training_beta_ss_cifar10/NCSNpp_episode0_epoch1050_model.pt pretrained_models/ncsnpp-cifar10_beta-ss.pt2 NVIDIA V100의 샘플링 베타 SS-DDPM. 결과는 디렉토리 "results/sampling_beta_ss_ss_cifar10/generated_samples"에 저장됩니다.
python lib/run_pipeline.py -gpu 0_1 -port 8900 -pipeline sampling_cifar10 -diffusion beta_ss -num_sampling_steps 1000 -pretrained_model ncsnpp-cifar10_beta-ss.pt -num_samples 50000 -save_folder sampling_beta_ss_cifar10 -logs_file logs_sampling_beta_ss.txt
python -m pytorch_fid datasets/FID_cifar10_pack50000 results/sampling_beta_ss_cifar10/generated_samples정확히 동일한 명령을 실행하면 FID ~ 3.24가됩니다.
4 NVIDIA A100에서 범주 형 SS-DDPM 교육 (~ 150GB GPU 메모리 필요). 검사 점은 디렉토리 "Checkpoints/Training_categorical_ss_text8"디렉토리에 저장됩니다. 손실 그래픽은 디렉토리 "results/training_categorical_ss_text8"에 저장됩니다.
python lib/run_pipeline.py -gpu 0_1_2_3 -port 8900 -pipeline training_text8 -diffusion categorical_ss -loss KL -save_folder training_categorical_ss_text8 -logs_file logs_training_categorical_ss.txt
cp checkpoints/training_categorical_ss_text8/T5Encoder_episode0_epoch2016_model.pt pretrained_models/t5base-text8_categorical-ss_fully-trained.pt3 NVIDIA A100에서 범주 형 SS-DDPM의 NLL 추정. 결과는 디렉토리 "results/nll_estimations"에 저장됩니다.
python lib/run_pipeline.py -gpu 0_1_2 -port 8900 -pipeline estimating_nll_text8 -diffusion categorical_ss -pretrained_model t5base-text8_categorical-ss_fully-trained.pt -num_samples -1 -batch_size 1536 -dataset_part test -num_iwae_trajectories 1 -save_folder nll_text8_categorical-ss -logs_file logs_nll_text8_categorical_ss.txt정확히 동일한 명령을 실행하면 NLL ~ 1.61을 얻게됩니다.
@ inproceedings { okhotin2023star ,
author = { Andrey Okhotin , Dmitry Molchanov , Vladimir Arkhipkin , Grigory Bartosh , Viktor Ohanesian , Aibek Alanov and Dmitry Vetrov },
title = { Star - Shaped Denoising Diffusion Probabilistic Models },
booktitle = { Advances in Neural Information Processing Systems },
volume = { 36 },
year = { 2023 }
}