Apache License 2.0

项目介绍

AntixK/PyTorch-VAE 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 Apache License 2.0 许可证,目前获得 7.7k 个 Star、1.2k 次 Fork。

仓库全名
AntixK/PyTorch-VAE
开源许可证
Apache License 2.0
Star 数
7.7k
Fork 数
1.2k
未关闭 Issue
68

README 摘要

PyTorch VAE Update 22/12/2021: Added support for PyTorch Lightning 1.5.6 version and cleaned up the code. A collection of Variational AutoEncoders (VAEs) implemented in pytorch with focus on reproducibility. The aim of this project is to provide a quick and simple working example for many of the cool VAE models out there. All the models are trained on the CelebA dataset for consistency and comparison. The…

完整内容见 GitHub 原始 README 或本页 。

常见问题

PyTorch-VAE 用什么语言开发?

主要使用 Python 编写,采用 Apache License 2.0 许可证,目前有 7.7k 个 Star。

PyTorch-VAE 可以免费商用吗?

仓库采用 Apache License 2.0 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 PyTorch-VAE 的源码?

可以直接克隆仓库:git clone https://github.com/AntixK/PyTorch-VAE.git,默认分支为 master;安装与运行步骤见仓库 README。

PyTorch-VAE 最近还在维护吗?

仓库最近一次更新为 2025年3月22日,当前有 68 个未关闭 Issue;Star 数为 7.7k,可作为社区活跃度的参考。

语言占比

Python

贡献者

README

PyTorch VAE

Update 22/12/2021: Added support for PyTorch Lightning 1.5.6 version and cleaned up the code.

A collection of Variational AutoEncoders (VAEs) implemented in pytorch with focus on reproducibility. The aim of this project is to provide a quick and simple working example for many of the cool VAE models out there. All the models are trained on the CelebA dataset for consistency and comparison. The architecture of all the models are kept as similar as possible with the same layers, except for cases where the original paper necessitates a radically different architecture (Ex. VQ VAE uses Residual layers and no Batch-Norm, unlike other models). Here are the results of each model.

Requirements

  • Python >= 3.5
  • PyTorch >= 1.3
  • Pytorch Lightning >= 0.6.0 (GitHub Repo)
  • CUDA enabled computing device

Installation

$ git clone https://github.com/AntixK/PyTorch-VAE
$ cd PyTorch-VAE
$ pip install -r requirements.txt

Usage

$ cd PyTorch-VAE
$ python run.py -c configs/<config-file-name.yaml>

Config file template

model_params:
  name: "<name of VAE model>"
  in_channels: 3
  latent_dim: 
    .         # Other parameters required by the model
    .
    .

data_params:
  data_path: "<path to the celebA dataset>"
  train_batch_size: 64 # Better to have a square number
  val_batch_size:  64
  patch_size: 64  # Models are designed to work for this size
  num_workers: 4
  
exp_params:
  manual_seed: 1265
  LR: 0.005
  weight_decay:
    .         # Other arguments required for training, like scheduler etc.
    .
    .

trainer_params:
  gpus: 1         
  max_epochs: 100
  gradient_clip_val: 1.5
    .
    .
    .

logging_params:
  save_dir: "logs/"
  name: "<experiment name>"

View TensorBoard Logs

$ cd logs/<experiment name>/version_<the version you want>
$ tensorboard --logdir .

Note: The default dataset is CelebA. However, there has been many issues with downloading the dataset from google drive (owing to some file structure changes). So, the recommendation is to download the file from google drive directly and extract to the path of your choice. The default path assumed in the config files is `Data/celeba/img_align_celeba’. But you can change it acording to your preference.


Results

Model Paper Reconstruction Samples
VAE (Code, Config) Link
Conditional VAE (Code, Config) Link
WAE - MMD (RBF Kernel) (Code, Config) Link
WAE - MMD (IMQ Kernel) (Code, Config) Link
Beta-VAE (Code, Config) Link
Disentangled Beta-VAE (Code, Config) Link
Beta-TC-VAE (Code, Config) Link
IWAE (K = 5) (Code, Config) Link
MIWAE (K = 5, M = 3) (Code, Config) Link
DFCVAE (Code, Config) Link
MSSIM VAE (Code, Config) Link
Categorical VAE (Code, Config) Link
Joint VAE (Code, Config) Link
Info VAE (Code, Config) Link
LogCosh VAE (Code, Config) Link
SWAE (200 Projections) (Code, Config) Link
VQ-VAE (K = 512, D = 64) (Code, Config) Link N/A
DIP VAE (Code, Config) Link

Contributing

If you have trained a better model, using these implementations, by fine-tuning the hyper-params in the config file, I would be happy to include your result (along with your config file) in this repo, citing your name 😊.

Additionally, if you would like to contribute some models, please submit a PR.

License

Apache License 2.0

Permissions Limitations Conditions
✔️ Commercial use ❌ Trademark use ⓘ License and copyright notice
✔️ Modification ❌ Liability ⓘ State changes
✔️ Distribution ❌ Warranty
✔️ Patent use
✔️ Private use

Citation

@misc{Subramanian2020,
  author = {Subramanian, A.K},
  title = {PyTorch-VAE},
  year = {2020},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/AntixK/PyTorch-VAE}}
}

评论

暂无评论