{"id":13869960,"url":"https://github.com/ermongroup/markov-chain-gan","last_synced_at":"2025-10-20T05:09:16.131Z","repository":{"id":84350861,"uuid":"93277745","full_name":"ermongroup/markov-chain-gan","owner":"ermongroup","description":"Code for \"Generative Adversarial Training for Markov Chains\" (ICLR 2017 Workshop)","archived":false,"fork":false,"pushed_at":"2017-10-25T13:33:48.000Z","size":2057,"stargazers_count":80,"open_issues_count":0,"forks_count":20,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-31T16:09:10.034Z","etag":null,"topics":["generative-adversarial-network","generative-model","iclr2017","markov-chain","markov-chain-generator","tensorflow"],"latest_commit_sha":null,"homepage":null,"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/ermongroup.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}},"created_at":"2017-06-03T22:44:50.000Z","updated_at":"2024-07-22T18:06:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"0d8dbce2-7938-42a7-bde3-faf166b12440","html_url":"https://github.com/ermongroup/markov-chain-gan","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ermongroup%2Fmarkov-chain-gan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ermongroup%2Fmarkov-chain-gan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ermongroup%2Fmarkov-chain-gan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ermongroup%2Fmarkov-chain-gan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ermongroup","download_url":"https://codeload.github.com/ermongroup/markov-chain-gan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252979372,"owners_count":21835041,"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":["generative-adversarial-network","generative-model","iclr2017","markov-chain","markov-chain-generator","tensorflow"],"created_at":"2024-08-05T20:01:23.495Z","updated_at":"2025-10-20T05:09:11.086Z","avatar_url":"https://github.com/ermongroup.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Markov Chain GAN (MGAN)\nTensorFlow code for [Generative Adversarial Training for Markov Chains](https://openreview.net/pdf?id=S1L-hCNtl) (ICLR 2017 Workshop Track).\n\nWork by [Jiaming Song](http://tsong.me), [Shengjia Zhao](http://szhao.me) and [Stefano Ermon](http://cs.stanford.edu/~ermon).\n\n\u003cbr/\u003e\n\n## Preprocessing\nRunning the code requires some preprocessing.\nNamely, we transform the data to TensorFlow Records file to maximize speed \n(as [suggested by TensorFlow](https://www.tensorflow.org/performance/performance_guide)).\n\n### MNIST\nThe data used for training is [here](https://drive.google.com/open?id=0B0LzoDno7qkJdDluZW5DSnpyWTg).\nDownload and place the directory in `~/data/mnist_tfrecords`. \n\n(This can be easily done by using a symlink or you can change the path in file `models/mnist/__init__.py`)\n\n### CelebA\nThe data used for training is [here](https://drive.google.com/open?id=0B0LzoDno7qkJX3p2YS1DODNrM3c).\nDownload and place the directory in `~/data/celeba_tfrecords`.\n\n\u003cbr/\u003e\n\n## Running Experiments\n```\npython mgan.py [data] [model] -b [B] -m [M] -d [critic iterations] --gpus [gpus]\n```\nwhere `B` defines the steps from noise to data, `M` defines the steps from data to data, and `[gpus]` defines the `CUDA_VISIBLE_DEVICES` environment variable.\n\n### MNIST\n```\npython mgan.py mnist mlp -b 4 -m 3 -d 7 --gpus [gpus]\n```\n\n### CelebA\nWithout shortcut connections:\n```\npython mgan.py celeba conv -b 4 -m 3 -d 7 --gpus [gpus]\n```\n\nWith shortcut connections (will observe a much slower transition):\n```\npython mgan.py celeba conv_res -b 4 -m 3 -d 7 --gpus [gpus]\n```\n\n### Custom Experiments\nIt is easy to define your own problem and run experiments.\n- Create a folder `data` under the `models` directory, and define `data_sampler` and `noise_sampler` in `__init__.py`.\n- Create a file `model.py` under the `models/data` directory, and define the following:\n  - `class TransitionFunction(TransitionBase)` (Generator)\n  - `class Discriminator(DiscriminatorBase)` (Discriminator)\n  - `def visualizer(model, name)` (If you need to generate figures)\n  - `epoch_size` and `logging_freq`\n- That's it!\n\n\u003cbr/\u003e\n\n## Figures\nEach row is from a single chain, where we sample for 50 time steps.\n\n### MNIST\n![MNIST MLP](figs/mnist_mlp.png)\n\n### CelebA\nWithout shortcut connections:\n![CelebA 1-layer conv](figs/celeba_conv.png)\n\nWith shortcut connections:\n![CelebA 1-layer conv with shortcuts](figs/celeba_conv_res.png)\n\n## Related Projects\n[a-nice-mc](https://github.com/jiamings/a-nice-mc): adversarial training for efficient MCMC kernels, which is based on this project.\n\n## Citation\nIf you use this code for your research, please cite our paper:\n\n```\n@article{song2017generative,\n  title={Generative Adversarial Training for Markov Chains},\n  author={Song, Jiaming and Zhao, Shengjia and Ermon, Stefano},\n  journal={ICLR 2017 (Workshop Track)},\n  year={2017}\n}\n```\n\n## Contact\n[tsong@cs.stanford.edu](mailto:tsong@cs.stanford.edu)\n\nCode for the Pairwise Discriminator is not available at this moment; I will add that when I have the time.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fermongroup%2Fmarkov-chain-gan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fermongroup%2Fmarkov-chain-gan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fermongroup%2Fmarkov-chain-gan/lists"}