{"id":15600937,"url":"https://github.com/lucidrains/autoregressive-diffusion-pytorch","last_synced_at":"2025-10-09T21:16:43.105Z","repository":{"id":249856443,"uuid":"832742378","full_name":"lucidrains/autoregressive-diffusion-pytorch","owner":"lucidrains","description":"Implementation of Autoregressive Diffusion in Pytorch","archived":false,"fork":false,"pushed_at":"2024-11-03T16:23:30.000Z","size":1150,"stargazers_count":382,"open_issues_count":2,"forks_count":11,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-05-31T06:48:09.004Z","etag":null,"topics":["artificial-intelligence","autoregressive-diffusion","deep-learning"],"latest_commit_sha":null,"homepage":"","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/lucidrains.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":"2024-07-23T16:22:47.000Z","updated_at":"2025-05-24T09:54:21.000Z","dependencies_parsed_at":"2024-07-23T20:23:12.877Z","dependency_job_id":"b3843149-27f1-4f65-a7fc-f9265ad4bc5d","html_url":"https://github.com/lucidrains/autoregressive-diffusion-pytorch","commit_stats":{"total_commits":55,"total_committers":1,"mean_commits":55.0,"dds":0.0,"last_synced_commit":"6be13c42106694d01ea80f482e7737a11e0fd8b1"},"previous_names":["lucidrains/autoregressive-diffusion-pytorch"],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/lucidrains/autoregressive-diffusion-pytorch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fautoregressive-diffusion-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fautoregressive-diffusion-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fautoregressive-diffusion-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fautoregressive-diffusion-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucidrains","download_url":"https://codeload.github.com/lucidrains/autoregressive-diffusion-pytorch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fautoregressive-diffusion-pytorch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002072,"owners_count":26083285,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["artificial-intelligence","autoregressive-diffusion","deep-learning"],"created_at":"2024-10-03T02:09:46.837Z","updated_at":"2025-10-09T21:16:43.088Z","avatar_url":"https://github.com/lucidrains.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"./ar-diffusion.png\" width=\"400px\"\u003e\u003c/img\u003e\n\n## Autoregressive Diffusion - Pytorch\n\nImplementation of the architecture behind \u003ca href=\"https://arxiv.org/abs/2406.11838\"\u003eAutoregressive Image Generation without Vector Quantization\u003c/a\u003e in Pytorch\n\nOfficial repository has been released \u003ca href=\"https://github.com/LTH14/mar\"\u003ehere\u003c/a\u003e\n\n\u003ca href=\"https://github.com/lucidrains/transfusion-pytorch\"\u003eAlternative route\u003c/a\u003e\n\n\u003cimg src=\"./images/results.96600.png\" width=\"400px\"\u003e\u003c/img\u003e\n\n*oxford flowers at 96k steps*\n\n## Install\n\n```bash\n$ pip install autoregressive-diffusion-pytorch\n```\n\n## Usage\n\n```python\nimport torch\nfrom autoregressive_diffusion_pytorch import AutoregressiveDiffusion\n\nmodel = AutoregressiveDiffusion(\n    dim_input = 512,\n    dim = 1024,\n    max_seq_len = 32,\n    depth = 8,\n    mlp_depth = 3,\n    mlp_width = 1024\n)\n\nseq = torch.randn(3, 32, 512)\n\nloss = model(seq)\nloss.backward()\n\nsampled = model.sample(batch_size = 3)\n\nassert sampled.shape == seq.shape\n\n```\n\nFor images treated as a sequence of tokens (as in paper)\n\n```python\nimport torch\nfrom autoregressive_diffusion_pytorch import ImageAutoregressiveDiffusion\n\nmodel = ImageAutoregressiveDiffusion(\n    model = dict(\n        dim = 1024,\n        depth = 12,\n        heads = 12,\n    ),\n    image_size = 64,\n    patch_size = 8\n)\n\nimages = torch.randn(3, 3, 64, 64)\n\nloss = model(images)\nloss.backward()\n\nsampled = model.sample(batch_size = 3)\n\nassert sampled.shape == images.shape\n\n```\n\nAn images trainer\n\n```python\nimport torch\n\nfrom autoregressive_diffusion_pytorch import (\n    ImageDataset,\n    ImageAutoregressiveDiffusion,\n    ImageTrainer\n)\n\ndataset = ImageDataset(\n    '/path/to/your/images',\n    image_size = 128\n)\n\nmodel = ImageAutoregressiveDiffusion(\n    model = dict(\n        dim = 512\n    ),\n    image_size = 128,\n    patch_size = 16\n)\n\ntrainer = ImageTrainer(\n    model = model,\n    dataset = dataset\n)\n\ntrainer()\n```\n\nFor an improvised version using flow matching, just import `ImageAutoregressiveFlow` and `AutoregressiveFlow` instead\n\nThe rest is the same\n\nex.\n\n```python\nimport torch\n\nfrom autoregressive_diffusion_pytorch import (\n    ImageDataset,\n    ImageTrainer,\n    ImageAutoregressiveFlow,\n)\n\ndataset = ImageDataset(\n    '/path/to/your/images',\n    image_size = 128\n)\n\nmodel = ImageAutoregressiveFlow(\n    model = dict(\n        dim = 512\n    ),\n    image_size = 128,\n    patch_size = 16\n)\n\ntrainer = ImageTrainer(\n    model = model,\n    dataset = dataset\n)\n\ntrainer()\n```\n\n## Citations\n\n```bibtex\n@article{Li2024AutoregressiveIG,\n    title   = {Autoregressive Image Generation without Vector Quantization},\n    author  = {Tianhong Li and Yonglong Tian and He Li and Mingyang Deng and Kaiming He},\n    journal = {ArXiv},\n    year    = {2024},\n    volume  = {abs/2406.11838},\n    url     = {https://api.semanticscholar.org/CorpusID:270560593}\n}\n```\n\n```bibtex\n@article{Wu2023ARDiffusionAD,\n    title     = {AR-Diffusion: Auto-Regressive Diffusion Model for Text Generation},\n    author    = {Tong Wu and Zhihao Fan and Xiao Liu and Yeyun Gong and Yelong Shen and Jian Jiao and Haitao Zheng and Juntao Li and Zhongyu Wei and Jian Guo and Nan Duan and Weizhu Chen},\n    journal   = {ArXiv},\n    year      = {2023},\n    volume    = {abs/2305.09515},\n    url       = {https://api.semanticscholar.org/CorpusID:258714669}\n}\n```\n\n```bibtex\n@article{Karras2022ElucidatingTD,\n    title   = {Elucidating the Design Space of Diffusion-Based Generative Models},\n    author  = {Tero Karras and Miika Aittala and Timo Aila and Samuli Laine},\n    journal = {ArXiv},\n    year    = {2022},\n    volume  = {abs/2206.00364},\n    url     = {https://api.semanticscholar.org/CorpusID:249240415}\n}\n```\n\n```bibtex\n@article{Liu2022FlowSA,\n    title   = {Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow},\n    author  = {Xingchao Liu and Chengyue Gong and Qiang Liu},\n    journal = {ArXiv},\n    year    = {2022},\n    volume  = {abs/2209.03003},\n    url     = {https://api.semanticscholar.org/CorpusID:252111177}\n}\n```\n\n```bibtex\n@article{Esser2024ScalingRF,\n    title   = {Scaling Rectified Flow Transformers for High-Resolution Image Synthesis},\n    author  = {Patrick Esser and Sumith Kulal and A. Blattmann and Rahim Entezari and Jonas Muller and Harry Saini and Yam Levi and Dominik Lorenz and Axel Sauer and Frederic Boesel and Dustin Podell and Tim Dockhorn and Zion English and Kyle Lacey and Alex Goodwin and Yannik Marek and Robin Rombach},\n    journal = {ArXiv},\n    year    = {2024},\n    volume  = {abs/2403.03206},\n    url     = {https://api.semanticscholar.org/CorpusID:268247980}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Fautoregressive-diffusion-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucidrains%2Fautoregressive-diffusion-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Fautoregressive-diffusion-pytorch/lists"}