{"id":27979451,"url":"https://github.com/hkchengrex/c2ot","last_synced_at":"2025-05-08T02:53:28.835Z","repository":{"id":282336508,"uuid":"947688248","full_name":"hkchengrex/C2OT","owner":"hkchengrex","description":"The Curse of Conditions: Analyzing and Improving Optimal Transport for Conditional Flow-Based Generation","archived":false,"fork":false,"pushed_at":"2025-03-14T03:32:54.000Z","size":6070,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-08T02:53:24.021Z","etag":null,"topics":["flow-matching","generative-modeling","generative-models"],"latest_commit_sha":null,"homepage":"http://hkchengrex.com/C2OT/","language":"Jupyter Notebook","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/hkchengrex.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":"2025-03-13T04:55:29.000Z","updated_at":"2025-05-06T01:59:04.000Z","dependencies_parsed_at":"2025-03-14T03:37:28.609Z","dependency_job_id":null,"html_url":"https://github.com/hkchengrex/C2OT","commit_stats":null,"previous_names":["hkchengrex/c2ot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hkchengrex%2FC2OT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hkchengrex%2FC2OT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hkchengrex%2FC2OT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hkchengrex%2FC2OT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hkchengrex","download_url":"https://codeload.github.com/hkchengrex/C2OT/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252989963,"owners_count":21836667,"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":["flow-matching","generative-modeling","generative-models"],"created_at":"2025-05-08T02:53:28.293Z","updated_at":"2025-05-08T02:53:28.826Z","avatar_url":"https://github.com/hkchengrex.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cp align=\"center\"\u003e\n  \u003ch2\u003eThe Curse of Conditions: Analyzing and Improving Optimal Transport for Conditional Flow-Based Generation\u003c/h2\u003e\n  \u003ca href=\"https://arxiv.org/abs/2503.10636\"\u003ePaper\u003c/a\u003e | \u003ca href=\"https://hkchengrex.github.io/C2OT\"\u003eWebpage\u003c/a\u003e | \u003ca href=\"https://colab.research.google.com/drive/1uhYPqnGlPoMTEqEgzpPvFQEcnr0faSBA?usp=sharing\"\u003eColab\u003c/a\u003e \n\u003c/p\u003e\n\u003cp\u003e\n\u003ca href=\"https://hkchengrex.github.io/\"\u003eHo Kei Cheng\u003c/a\u003e and \n\u003ca href=\"https://www.alexander-schwing.de/\"\u003eAlexander Schwing\u003c/a\u003e\n\u003cbr\u003e\nUniversity of Illinois Urbana-Champaign\n\u003c/p\u003e\n\u003c/div\u003e\n\n![8GtoMoons](https://imgur.com/bcmTUiE.png)\n\n## High-Level Summary\n\nC\u003csup\u003e2\u003c/sup\u003eOT is an algorithm for computing prior-to-data couplings for flow-matching-based generative models during training.\nOur goal is to achieve straighter flows, enabled by optimal transport (OT) couplings, while mitigating the test-time degradation that OT encounters in the conditional setting (see figure above).\nThe key idea is that OT samples from a condition-skewed prior distribution at test time, whereas C\u003csup\u003e2\u003c/sup\u003eOT unskews the prior by incorporating a condition-dependent term into the OT cost.\n\n\n## Installation\n\nWe have only tested this on Ubuntu.\n\n### Prerequisites\n\nWe recommend using a [miniforge](https://github.com/conda-forge/miniforge) environment.\n\n- Python 3.9+\n- PyTorch 2.5.1+ and corresponding torchvision/torchaudio (pick your CUDA version https://pytorch.org/, pip install recommended)\n\n**1. Install prerequisite if not yet met:**\n\n```bash\npip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 --upgrade\n```\n\n(Or any other CUDA versions that your GPUs/driver support)\n\n\u003c!-- ```\nconda install -c conda-forge 'ffmpeg\u003c7\n```\n(Optional, if you use miniforge and don't already have the appropriate ffmpeg) --\u003e\n\n**2. Clone our repository:**\n\n```bash\ngit clone https://github.com/hkchengrex/C2OT.git\n```\n\n**3. Install with pip (install pytorch first before attempting this!):**\n\n```bash\ncd C2OT\npip install -e .\n```\n\n(If you encounter the File \"setup.py\" not found error, upgrade your pip with pip install --upgrade pip)\n\n## Demo\n\nAfter installation, you can run our demo notebook at [moons.ipynb](moons.ipynb). More details to be added. \nYou can also run this demo on [Colab](https://colab.research.google.com/drive/1uhYPqnGlPoMTEqEgzpPvFQEcnr0faSBA?usp=sharing) without a local installation.\n\n## Citation\n\n```bibtex\n@inproceedings{cheng2025curse,\n  title={The Curse of Conditions: Analyzing and Improving Optimal Transport for Conditional Flow-Based Generation},\n  author={Cheng, Ho Kei and Schwing, Alexander},\n  booktitle={arXiv},\n  year={2025}\n}\n```\n\n## Acknowledgement\n\nMany thanks to:\n- [torchcfm](https://github.com/atong01/conditional-flow-matching)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhkchengrex%2Fc2ot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhkchengrex%2Fc2ot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhkchengrex%2Fc2ot/lists"}