[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-71105":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":18,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":16,"starSnapshotCount":16,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},71105,"consistency_models","openai\u002Fconsistency_models","openai","Official repo for consistency models.","",null,"Python",6488,434,57,48,0,1,3,5,38.92,"MIT License",false,"main",true,[],"2026-06-12 02:02:47","# Consistency Models\n\nThis repository contains the codebase for [Consistency Models](https:\u002F\u002Farxiv.org\u002Fabs\u002F2303.01469), implemented using PyTorch for conducting large-scale experiments on ImageNet-64, LSUN Bedroom-256, and LSUN Cat-256. We have based our repository on [openai\u002Fguided-diffusion](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fguided-diffusion), which was initially released under the MIT license. Our modifications have enabled support for consistency distillation, consistency training, as well as several sampling and editing algorithms discussed in the paper.\n\nThe repository for CIFAR-10 experiments is in JAX and can be found at [openai\u002Fconsistency_models_cifar10](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fconsistency_models_cifar10).\n\n# Pre-trained models\n\nWe have released checkpoints for the main models in the paper. Before using these models, please review the corresponding [model card](model-card.md) to understand the intended use and limitations of these models.\n\nHere are the download links for each model checkpoint:\n\n * EDM on ImageNet-64: [edm_imagenet64_ema.pt](https:\u002F\u002Fopenaipublic.blob.core.windows.net\u002Fconsistency\u002Fedm_imagenet64_ema.pt)\n * CD on ImageNet-64 with l2 metric: [cd_imagenet64_l2.pt](https:\u002F\u002Fopenaipublic.blob.core.windows.net\u002Fconsistency\u002Fcd_imagenet64_l2.pt)\n * CD on ImageNet-64 with LPIPS metric: [cd_imagenet64_lpips.pt](https:\u002F\u002Fopenaipublic.blob.core.windows.net\u002Fconsistency\u002Fcd_imagenet64_lpips.pt)\n * CT on ImageNet-64: [ct_imagenet64.pt](https:\u002F\u002Fopenaipublic.blob.core.windows.net\u002Fconsistency\u002Fct_imagenet64.pt)\n * EDM on LSUN Bedroom-256: [edm_bedroom256_ema.pt](https:\u002F\u002Fopenaipublic.blob.core.windows.net\u002Fconsistency\u002Fedm_bedroom256_ema.pt)\n * CD on LSUN Bedroom-256 with l2 metric: [cd_bedroom256_l2.pt](https:\u002F\u002Fopenaipublic.blob.core.windows.net\u002Fconsistency\u002Fcd_bedroom256_l2.pt)\n * CD on LSUN Bedroom-256 with LPIPS metric: [cd_bedroom256_lpips.pt](https:\u002F\u002Fopenaipublic.blob.core.windows.net\u002Fconsistency\u002Fcd_bedroom256_lpips.pt)\n * CT on LSUN Bedroom-256: [ct_bedroom256.pt](https:\u002F\u002Fopenaipublic.blob.core.windows.net\u002Fconsistency\u002Fct_bedroom256.pt)\n * EDM on LSUN Cat-256: [edm_cat256_ema.pt](https:\u002F\u002Fopenaipublic.blob.core.windows.net\u002Fconsistency\u002Fedm_cat256_ema.pt)\n * CD on LSUN Cat-256 with l2 metric: [cd_cat256_l2.pt](https:\u002F\u002Fopenaipublic.blob.core.windows.net\u002Fconsistency\u002Fcd_cat256_l2.pt)\n * CD on LSUN Cat-256 with LPIPS metric: [cd_cat256_lpips.pt](https:\u002F\u002Fopenaipublic.blob.core.windows.net\u002Fconsistency\u002Fcd_cat256_lpips.pt)\n * CT on LSUN Cat-256: [ct_cat256.pt](https:\u002F\u002Fopenaipublic.blob.core.windows.net\u002Fconsistency\u002Fct_cat256.pt)\n\n# Dependencies\n\nTo install all packages in this codebase along with their dependencies, run\n```sh\npip install -e .\n```\n\nTo install with Docker, run the following commands:\n```sh\ncd docker && make build && make run\n```\n\n# Model training and sampling\n\nWe provide examples of EDM training, consistency distillation, consistency training, single-step generation, and multistep generation in [scripts\u002Flaunch.sh](scripts\u002Flaunch.sh).\n\n# Evaluations\n\nTo compare different generative models, we use FID, Precision, Recall, and Inception Score. These metrics can all be calculated using batches of samples stored in `.npz` (numpy) files. One can evaluate samples with [cm\u002Fevaluations\u002Fevaluator.py](evaluations\u002Fevaluator.py) in the same way as described in [openai\u002Fguided-diffusion](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fguided-diffusion), with reference dataset batches provided therein.\n\n## Use in 🧨 diffusers\n\nConsistency models are supported in [🧨 diffusers](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fdiffusers) via the [`ConsistencyModelPipeline` class](https:\u002F\u002Fhuggingface.co\u002Fdocs\u002Fdiffusers\u002Fmain\u002Fen\u002Fapi\u002Fpipelines\u002Fconsistency_models). Below we provide an example:\n\n```python\nimport torch\n\nfrom diffusers import ConsistencyModelPipeline\n\ndevice = \"cuda\"\n# Load the cd_imagenet64_l2 checkpoint.\nmodel_id_or_path = \"openai\u002Fdiffusers-cd_imagenet64_l2\"\npipe = ConsistencyModelPipeline.from_pretrained(model_id_or_path, torch_dtype=torch.float16)\npipe.to(device)\n\n# Onestep Sampling\nimage = pipe(num_inference_steps=1).images[0]\nimage.save(\"consistency_model_onestep_sample.png\")\n\n# Onestep sampling, class-conditional image generation\n# ImageNet-64 class label 145 corresponds to king penguins\n\nclass_id = 145\nclass_id = torch.tensor(class_id, dtype=torch.long)\n\nimage = pipe(num_inference_steps=1, class_labels=class_id).images[0]\nimage.save(\"consistency_model_onestep_sample_penguin.png\")\n\n# Multistep sampling, class-conditional image generation\n# Timesteps can be explicitly specified; the particular timesteps below are from the original Github repo.\n# https:\u002F\u002Fgithub.com\u002Fopenai\u002Fconsistency_models\u002Fblob\u002Fmain\u002Fscripts\u002Flaunch.sh#L77\nimage = pipe(timesteps=[22, 0], class_labels=class_id).images[0]\nimage.save(\"consistency_model_multistep_sample_penguin.png\")\n```\nYou can further speed up the inference process by using `torch.compile()` on `pipe.unet` (only supported from PyTorch 2.0). For more details, please check out the [official documentation](https:\u002F\u002Fhuggingface.co\u002Fdocs\u002Fdiffusers\u002Fmain\u002Fen\u002Fapi\u002Fpipelines\u002Fconsistency_models). This support was contributed to 🧨 diffusers by [dg845](https:\u002F\u002Fgithub.com\u002Fdg845) and [ayushtues](https:\u002F\u002Fgithub.com\u002Fayushtues).\n\n# Citation\n\nIf you find this method and\u002For code useful, please consider citing\n\n```bibtex\n@article{song2023consistency,\n  title={Consistency Models},\n  author={Song, Yang and Dhariwal, Prafulla and Chen, Mark and Sutskever, Ilya},\n  journal={arXiv preprint arXiv:2303.01469},\n  year={2023},\n}\n```\n","该项目是OpenAI官方发布的用于实现一致性模型的代码库，主要基于PyTorch框架。它支持在ImageNet-64、LSUN Bedroom-256和LSUN Cat-256等数据集上进行大规模实验，包括一致性蒸馏、一致性训练以及多种采样和编辑算法。项目提供了预训练模型供下载，并详细说明了每个模型的使用场景与限制条件。适用于需要高质量图像生成或处理的研究者及开发者，在图像生成、编辑等领域具有广泛的应用潜力。",2,"2026-06-11 03:35:54","high_star"]