{"id":13595128,"url":"https://github.com/openai/glow","last_synced_at":"2025-10-20T06:37:05.699Z","repository":{"id":41519375,"uuid":"137939715","full_name":"openai/glow","owner":"openai","description":"Code for reproducing results in \"Glow: Generative Flow with Invertible 1x1 Convolutions\"","archived":false,"fork":false,"pushed_at":"2024-07-23T14:56:11.000Z","size":1276,"stargazers_count":3141,"open_issues_count":65,"forks_count":516,"subscribers_count":229,"default_branch":"master","last_synced_at":"2025-04-11T10:05:32.823Z","etag":null,"topics":["paper"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/1807.03039","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-19T20:03:00.000Z","updated_at":"2025-04-07T10:26:29.000Z","dependencies_parsed_at":"2024-11-27T14:31:05.210Z","dependency_job_id":null,"html_url":"https://github.com/openai/glow","commit_stats":{"total_commits":33,"total_committers":4,"mean_commits":8.25,"dds":"0.24242424242424243","last_synced_commit":"91b2c577a5c110b2b38761fc56d81f7d87f077c1"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openai%2Fglow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openai%2Fglow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openai%2Fglow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openai%2Fglow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openai","download_url":"https://codeload.github.com/openai/glow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254243362,"owners_count":22038046,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["paper"],"created_at":"2024-08-01T16:01:44.454Z","updated_at":"2025-10-20T06:37:00.660Z","avatar_url":"https://github.com/openai.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"**Status:** Archive (code is provided as-is, no updates expected)\n\n# Glow\n\nCode for reproducing results in [\"Glow: Generative Flow with Invertible 1x1 Convolutions\"](https://d4mucfpksywv.cloudfront.net/research-covers/glow/paper/glow.pdf)\n\nTo use pretrained CelebA-HQ model, make your own manipulation vectors and run our interactive demo, check `demo` folder.\n\n## Requirements\n\n - Tensorflow (tested with v1.8.0)\n - Horovod (tested with v0.13.8) and (Open)MPI\n\nRun\n```\npip install -r requirements.txt\n```\n\nTo setup (Open)MPI, check instructions on Horovod github [page](https://github.com/uber/horovod).\n\n## Download datasets\nFor small scale experiments, use MNIST/CIFAR-10 (directly downloaded by `train.py` using keras)\n\nFor larger scale experiments, the datasets used are in the Google Cloud locations `https://openaipublic.azureedge.net/glow-demo/data/{dataset_name}-tfr.tar`. The dataset_names are below, we mention the exact preprocessing / downsampling method for a correct comparison of likelihood.\n\nQuantitative results\n- `imagenet-oord` - 20GB. Unconditional ImageNet 32x32 and 64x64, as described in PixelRNN/RealNVP papers (we downloaded [this](http://image-net.org/small/download.php) processed version).\n- `lsun_realnvp` - 140GB. LSUN 96x96. Random 64x64 crops taken at processing time, as described in RealNVP.\n\nQualitative results\n- `celeba` - 4GB. CelebA-HQ 256x256 dataset, as described in Progressive growing of GAN's. For 1024x1024 version (120GB), use `celeba-full-tfr.tar` while downloading.\n- `imagenet` - 20GB. ImageNet 32x32 and 64x64 with class labels. Centre cropped, area downsampled.\n- `lsun` - 700GB. LSUN 256x256. Centre cropped, area downsampled.\n\nTo download and extract celeb for example, run\n```\nwget https://openaipublic.azureedge.net/glow-demo/data/celeba-tfr.tar\ntar -xvf celeb-tfr.tar\n```\nChange `hps.data_dir` in train.py file to point to the above folder (or use the `--data_dir` flag when you run train.py)\n\nFor `lsun`, since download can be quite big, you can instead follow the instructions in `data_loaders/generate_tfr/lsun.py` to generate the tfr file directly from LSUN images. `church_outdoor` will be the smallest category.\n\n## Simple Train with 1 GPU\n\nRun wtih small depth to test\n```\nCUDA_VISIBLE_DEVICES=0 python train.py --depth 1\n```\n\n## Train with multiple GPUs using MPI and Horovod\n\nRun default training script with 8 GPUs:\n```\nmpiexec -n 8 python train.py\n```\n\n##### Ablation experiments\n\n```\nmpiexec -n 8 python train.py --problem cifar10 --image_size 32 --n_level 3 --depth 32 --flow_permutation [0/1/2] --flow_coupling [0/1] --seed [0/1/2] --learntop --lr 0.001\n```\n\nPretrained models, logs and samples\n```\nwget https://openaipublic.azureedge.net/glow-demo/logs/abl-[reverse/shuffle/1x1]-[add/aff].tar\n```\n\n##### CIFAR-10 Quantitative result\n\n```\nmpiexec -n 8 python train.py --problem cifar10 --image_size 32 --n_level 3 --depth 32 --flow_permutation 2 --flow_coupling 1 --seed 0 --learntop --lr 0.001 --n_bits_x 8\n```\n\n##### ImageNet 32x32 Quantitative result\n\n```\nmpiexec -n 8 python train.py --problem imagenet-oord --image_size 32 --n_level 3 --depth 48 --flow_permutation 2 --flow_coupling 1 --seed 0 --learntop --lr 0.001 --n_bits_x 8\n```\n\n##### ImageNet 64x64 Quantitative result\n```\nmpiexec -n 8 python train.py --problem imagenet-oord --image_size 64 --n_level 4 --depth 48 --flow_permutation 2 --flow_coupling 1 --seed 0 --learntop --lr 0.001 --n_bits_x 8\n```\n\n##### LSUN 64x64 Quantitative result\n```\nmpiexec -n 8 python train.py --problem lsun_realnvp --category [bedroom/church_outdoor/tower] --image_size 64 --n_level 3 --depth 48 --flow_permutation 2 --flow_coupling 1 --seed 0 --learntop --lr 0.001 --n_bits_x 8\n```\n\nPretrained models, logs and samples\n```\nwget https://openaipublic.azureedge.net/glow-demo/logs/lsun-rnvp-[bdr/crh/twr].tar\n```\n\n##### CelebA-HQ 256x256 Qualitative result\n\n```\nmpiexec -n 40 python train.py --problem celeba --image_size 256 --n_level 6 --depth 32 --flow_permutation 2 --flow_coupling 0 --seed 0 --learntop --lr 0.001 --n_bits_x 5\n```\n\n##### LSUN 96x96 and 128x128 Qualitative result\n```\nmpiexec -n 40 python train.py --problem lsun --category [bedroom/church_outdoor/tower] --image_size [96/128] --n_level 5 --depth 64 --flow_permutation 2 --flow_coupling 0 --seed 0 --learntop --lr 0.001 --n_bits_x 5\n```\n\nLogs and samples\n```\nwget https://openaipublic.azureedge.net/glow-demo/logs/lsun-bdr-[96/128].tar\n```\n\n##### Conditional CIFAR-10 Qualitative result\n```\nmpiexec -n 8 python train.py --problem cifar10 --image_size 32 --n_level 3 --depth 32 --flow_permutation 2 --flow_coupling 0 --seed 0 --learntop --lr 0.001 --n_bits_x 5 --ycond --weight_y=0.01\n```\n\n##### Conditional ImageNet 32x32 Qualitative result\n```\nmpiexec -n 8 python train.py --problem imagenet --image_size 32 --n_level 3 --depth 48 --flow_permutation 2 --flow_coupling 0 --seed 0 --learntop --lr 0.001 --n_bits_x 5 --ycond --weight_y=0.01\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenai%2Fglow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenai%2Fglow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenai%2Fglow/lists"}