[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-LTH14--mar":3,"tool-LTH14--mar":64},[4,18,26,35,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107888,2,"2026-04-06T11:32:50",[14,15,13],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":10,"last_commit_at":41,"category_tags":42,"status":17},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[43,15,13,14],"语言模型",{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":10,"last_commit_at":50,"category_tags":51,"status":17},4292,"Deep-Live-Cam","hacksider\u002FDeep-Live-Cam","Deep-Live-Cam 是一款专注于实时换脸与视频生成的开源工具，用户仅需一张静态照片，即可通过“一键操作”实现摄像头画面的即时变脸或制作深度伪造视频。它有效解决了传统换脸技术流程繁琐、对硬件配置要求极高以及难以实时预览的痛点，让高质量的数字内容创作变得触手可及。\n\n这款工具不仅适合开发者和技术研究人员探索算法边界，更因其极简的操作逻辑（仅需三步：选脸、选摄像头、启动），广泛适用于普通用户、内容创作者、设计师及直播主播。无论是为了动画角色定制、服装展示模特替换，还是制作趣味短视频和直播互动，Deep-Live-Cam 都能提供流畅的支持。\n\n其核心技术亮点在于强大的实时处理能力，支持口型遮罩（Mouth Mask）以保留使用者原始的嘴部动作，确保表情自然精准；同时具备“人脸映射”功能，可同时对画面中的多个主体应用不同面孔。此外，项目内置了严格的内容安全过滤机制，自动拦截涉及裸露、暴力等不当素材，并倡导用户在获得授权及明确标注的前提下合规使用，体现了技术发展与伦理责任的平衡。",88924,"2026-04-06T03:28:53",[14,15,13,52],"视频",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"status":17},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",85013,"2026-04-06T11:09:19",[15,16,52,61,13,62,43,14,63],"插件","其他","音频",{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":69,"readme_en":70,"readme_zh":71,"quickstart_zh":72,"use_case_zh":73,"hero_image_url":74,"owner_login":75,"owner_name":76,"owner_avatar_url":77,"owner_bio":78,"owner_company":79,"owner_location":79,"owner_email":80,"owner_twitter":79,"owner_website":81,"owner_url":82,"languages":83,"stars":88,"forks":89,"last_commit_at":90,"license":91,"difficulty_score":10,"env_os":92,"env_gpu":93,"env_ram":94,"env_deps":95,"category_tags":102,"github_topics":79,"view_count":32,"oss_zip_url":79,"oss_zip_packed_at":79,"status":17,"created_at":103,"updated_at":104,"faqs":105,"releases":106},4783,"LTH14\u002Fmar","mar","PyTorch implementation of MAR+DiffLoss https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.11838","mar 是一个基于 PyTorch 开发的开源项目，旨在实现无需向量量化（Vector Quantization）的自回归图像生成。它复现了 NeurIPS 2024 的亮点论文成果，核心目标是解决传统自回归模型在图像生成中依赖离散码本所带来的信息损失与重建质量瓶颈问题。\n\n通过引入创新的 DiffLoss 机制，mar 能够直接在连续潜空间中进行高效的自回归建模，从而在 ImageNet 256x256 数据集上取得了卓越的生成效果，其 FID 分数低至 1.55，显著优于许多现有方案。该项目不仅提供了从 MAR-B 到 MAR-H 多种规模的预训练模型，还集成了完整的训练、评估脚本以及便捷的 Colab 演示和 Gradio 交互界面。\n\nmar 非常适合人工智能研究人员、深度学习开发者以及对前沿生成式模型感兴趣的技术爱好者使用。无论是希望复现顶级会议算法的研究者，还是想要快速体验高质量图像生成的开发者，都能通过其清晰的代码结构和丰富的预训练资源轻松上手。对于设计师而言，利用其提供的在线 Demo 也能直观探索自回归模型在创意图像合成方面的潜力。","# Autoregressive Image Generation without Vector Quantization \u003Cbr>\u003Csub>Official PyTorch Implementation\u003C\u002Fsub>\n\n[![arXiv](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FarXiv%20paper-2406.11838-b31b1b.svg)](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.11838)&nbsp;\n[![PWC](https:\u002F\u002Fimg.shields.io\u002Fendpoint.svg?url=https:\u002F\u002Fpaperswithcode.com\u002Fbadge\u002Fautoregressive-image-generation-without\u002Fimage-generation-on-imagenet-256x256)](https:\u002F\u002Fpaperswithcode.com\u002Fsota\u002Fimage-generation-on-imagenet-256x256?p=autoregressive-image-generation-without)\n[![Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](http:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FLTH14\u002Fmar\u002Fblob\u002Fmain\u002Fdemo\u002Frun_mar.ipynb)\n[![huggingface](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F%F0%9F%A4%97%20HuggingFace-mar-yellow)](https:\u002F\u002Fhuggingface.co\u002Fjadechoghari\u002Fmar)&nbsp;\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FLTH14_mar_readme_cd0701ad6eb6.png\" width=\"720\">\n\u003C\u002Fp>\n\nThis is a PyTorch\u002FGPU implementation of the paper [Autoregressive Image Generation without Vector Quantization](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.11838) (Neurips 2024 Spotlight Presentation):\n\n```\n@article{li2024autoregressive,\n  title={Autoregressive Image Generation without Vector Quantization},\n  author={Li, Tianhong and Tian, Yonglong and Li, He and Deng, Mingyang and He, Kaiming},\n  journal={arXiv preprint arXiv:2406.11838},\n  year={2024}\n}\n```\n\nThis repo contains:\n\n* 🪐 A simple PyTorch implementation of [MAR](models\u002Fmar.py) and [DiffLoss](models\u002Fdiffloss.py)\n* ⚡️ Pre-trained class-conditional MAR models trained on ImageNet 256x256\n* 💥 A self-contained [Colab notebook](http:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FLTH14\u002Fmar\u002Fblob\u002Fmain\u002Fdemo\u002Frun_mar.ipynb) for running various pre-trained MAR models\n* 🛸 An MAR+DiffLoss [training and evaluation script](main_mar.py) using PyTorch DDP\n* 🎉 Also checkout our [Hugging Face model cards](https:\u002F\u002Fhuggingface.co\u002Fjadechoghari\u002Fmar) and [Gradio demo](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fjadechoghari\u002Fmar) (thanks [@jadechoghari](https:\u002F\u002Fgithub.com\u002Fjadechoghari)).\n\n## Preparation\n\n### Dataset\nDownload [ImageNet](http:\u002F\u002Fimage-net.org\u002Fdownload) dataset, and place it in your `IMAGENET_PATH`.\n\n### Installation\n\nDownload the code:\n```\ngit clone https:\u002F\u002Fgithub.com\u002FLTH14\u002Fmar.git\ncd mar\n```\n\nA suitable [conda](https:\u002F\u002Fconda.io\u002F) environment named `mar` can be created and activated with:\n\n```\nconda env create -f environment.yaml\nconda activate mar\n```\n\nDownload pre-trained VAE and MAR models:\n\n```\npython util\u002Fdownload.py\n```\n\nFor convenience, our pre-trained MAR models can be downloaded directly here as well:\n\n| MAR Model                                                              | FID-50K | Inception Score | #params | \n|------------------------------------------------------------------------|---------|-----------------|---------|\n| [MAR-B](https:\u002F\u002Fwww.dropbox.com\u002Fscl\u002Ffi\u002Ff6dpuyjb7fudzxcyhvrhk\u002Fcheckpoint-last.pth?rlkey=a6i4bo71vhfo4anp33n9ukujb&dl=0) | 2.31    | 281.7           | 208M    |\n| [MAR-L](https:\u002F\u002Fwww.dropbox.com\u002Fscl\u002Ffi\u002Fpxacc5b2mrt3ifw4cah6k\u002Fcheckpoint-last.pth?rlkey=m48ovo6g7ivcbosrbdaz0ehqt&dl=0) | 1.78    | 296.0           | 479M    |\n| [MAR-H](https:\u002F\u002Fwww.dropbox.com\u002Fscl\u002Ffi\u002F1qmfx6fpy3k7j9vcjjs3s\u002Fcheckpoint-last.pth?rlkey=4lae281yzxb406atp32vzc83o&dl=0) | 1.55    | 303.7           | 943M    |\n\n### (Optional) Caching VAE Latents\n\nGiven that our data augmentation consists of simple center cropping and random flipping, \nthe VAE latents can be pre-computed and saved to `CACHED_PATH` to save computations during MAR training:\n\n```\ntorchrun --nproc_per_node=8 --nnodes=1 --node_rank=0 \\\nmain_cache.py \\\n--img_size 256 --vae_path pretrained_models\u002Fvae\u002Fkl16.ckpt --vae_embed_dim 16 \\\n--batch_size 128 \\\n--data_path ${IMAGENET_PATH} --cached_path ${CACHED_PATH}\n```\n\n## Usage\n\n### Demo\nRun our interactive visualization [demo](http:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FLTH14\u002Fmar\u002Fblob\u002Fmain\u002Fdemo\u002Frun_mar.ipynb) using Colab notebook!\n\n### Local Gradio App\n\n```\npython demo\u002Fgradio_app.py \n```\n\n\n\n### Training\nScript for the default setting (MAR-L, DiffLoss MLP with 3 blocks and a width of 1024 channels, 400 epochs):\n```\ntorchrun --nproc_per_node=8 --nnodes=4 --node_rank=${NODE_RANK} --master_addr=${MASTER_ADDR} --master_port=${MASTER_PORT} \\\nmain_mar.py \\\n--img_size 256 --vae_path pretrained_models\u002Fvae\u002Fkl16.ckpt --vae_embed_dim 16 --vae_stride 16 --patch_size 1 \\\n--model mar_large --diffloss_d 3 --diffloss_w 1024 \\\n--epochs 400 --warmup_epochs 100 --batch_size 64 --blr 1.0e-4 --diffusion_batch_mul 4 \\\n--output_dir ${OUTPUT_DIR} --resume ${OUTPUT_DIR} \\\n--data_path ${IMAGENET_PATH}\n```\n- Training time is ~1d7h on 32 H100 GPUs with `--batch_size 64`.\n- Add `--online_eval` to evaluate FID during training (every 40 epochs).\n- (Optional) To train with cached VAE latents, add `--use_cached --cached_path ${CACHED_PATH}` to the arguments. \nTraining time with cached latents is ~1d11h on 16 H100 GPUs with `--batch_size 128` (nearly 2x faster than without caching).\n- (Optional) To save GPU memory during training by using gradient checkpointing (thanks to @Jiawei-Yang), add `--grad_checkpointing` to the arguments. \nNote that this may slightly reduce training speed.\n\n### Evaluation (ImageNet 256x256)\n\nEvaluate MAR-B (DiffLoss MLP with 6 blocks and a width of 1024 channels, 800 epochs) with classifier-free guidance:\n```\ntorchrun --nproc_per_node=8 --nnodes=1 --node_rank=0 \\\nmain_mar.py \\\n--model mar_base --diffloss_d 6 --diffloss_w 1024 \\\n--eval_bsz 256 --num_images 50000 \\\n--num_iter 256 --num_sampling_steps 100 --cfg 2.9 --cfg_schedule linear --temperature 1.0 \\\n--output_dir pretrained_models\u002Fmar\u002Fmar_base \\\n--resume pretrained_models\u002Fmar\u002Fmar_base \\\n--data_path ${IMAGENET_PATH} --evaluate\n```\n\nEvaluate MAR-L (DiffLoss MLP with 8 blocks and a width of 1280 channels, 800 epochs) with classifier-free guidance:\n```\ntorchrun --nproc_per_node=8 --nnodes=1 --node_rank=0 \\\nmain_mar.py \\\n--model mar_large --diffloss_d 8 --diffloss_w 1280 \\\n--eval_bsz 256 --num_images 50000 \\\n--num_iter 256 --num_sampling_steps 100 --cfg 3.0 --cfg_schedule linear --temperature 1.0 \\\n--output_dir pretrained_models\u002Fmar\u002Fmar_large \\\n--resume pretrained_models\u002Fmar\u002Fmar_large \\\n--data_path ${IMAGENET_PATH} --evaluate\n```\n\nEvaluate MAR-H (DiffLoss MLP with 12 blocks and a width of 1536 channels, 800 epochs) with classifier-free guidance:\n```\ntorchrun --nproc_per_node=8 --nnodes=1 --node_rank=0 \\\nmain_mar.py \\\n--model mar_huge --diffloss_d 12 --diffloss_w 1536 \\\n--eval_bsz 128 --num_images 50000 \\\n--num_iter 256 --num_sampling_steps 100 --cfg 3.2 --cfg_schedule linear --temperature 1.0 \\\n--output_dir pretrained_models\u002Fmar\u002Fmar_huge \\\n--resume pretrained_models\u002Fmar\u002Fmar_huge \\\n--data_path ${IMAGENET_PATH} --evaluate\n```\n\n- Set `--cfg 1.0 --temperature 0.95` to evaluate without classifier-free guidance.\n- Generation speed can be significantly increased by reducing the number of autoregressive iterations (e.g., `--num_iter 64`).\n\n## Acknowledgements\nWe thank Congyue Deng and Xinlei Chen for helpful discussion. We thank\nGoogle TPU Research Cloud (TRC) for granting us access to TPUs, and Google Cloud Platform for\nsupporting GPU resources.\n\nA large portion of codes in this repo is based on [MAE](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fmae), [MAGE](https:\u002F\u002Fgithub.com\u002FLTH14\u002Fmage) and [DiT](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FDiT).\n\n## Contact\n\nIf you have any questions, feel free to contact me through email (tianhong@mit.edu). Enjoy!\n","# 无需向量量化自回归图像生成\u003Cbr>\u003Csub>官方 PyTorch 实现\u003C\u002Fsub>\n\n[![arXiv](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FarXiv%20paper-2406.11838-b31b1b.svg)](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.11838)&nbsp;\n[![PWC](https:\u002F\u002Fimg.shields.io\u002Fendpoint.svg?url=https:\u002F\u002Fpaperswithcode.com\u002Fbadge\u002Fautoregressive-image-generation-without\u002Fimage-generation-on-imagenet-256x256)](https:\u002F\u002Fpaperswithcode.com\u002Fsota\u002Fimage-generation-on-imagenet-256x256?p=autoregressive-image-generation-without)\n[![Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](http:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FLTH14\u002Fmar\u002Fblob\u002Fmain\u002Fdemo\u002Frun_mar.ipynb)\n[![huggingface](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F%F0%9F%A4%97%20HuggingFace-mar-yellow)](https:\u002F\u002Fhuggingface.co\u002Fjadechoghari\u002Fmar)&nbsp;\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FLTH14_mar_readme_cd0701ad6eb6.png\" width=\"720\">\n\u003C\u002Fp>\n\n这是论文《无需向量量化的自回归图像生成》（NeurIPS 2024 Spotlight Presentation）的 PyTorch\u002FGPU 实现：\n\n```\n@article{li2024autoregressive,\n  title={Autoregressive Image Generation without Vector Quantization},\n  author={Li, Tianhong and Tian, Yonglong and Li, He and Deng, Mingyang and He, Kaiming},\n  journal={arXiv preprint arXiv:2406.11838},\n  year={2024}\n}\n```\n\n本仓库包含：\n\n* 🪐 [MAR](models\u002Fmar.py) 和 [DiffLoss](models\u002Fdiffloss.py) 的简单 PyTorch 实现\n* ⚡️ 在 ImageNet 256x256 数据集上训练好的类别条件 MAR 模型\n* 💥 一个自包含的 [Colab 笔记本](http:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FLTH14\u002Fmar\u002Fblob\u002Fmain\u002Fdemo\u002Frun_mar.ipynb)，用于运行各种预训练的 MAR 模型\n* 🛸 使用 PyTorch DDP 的 MAR+DiffLoss [训练与评估脚本](main_mar.py)\n* 🎉 此外，还可以查看我们的 [Hugging Face 模型卡片](https:\u002F\u002Fhuggingface.co\u002Fjadechoghari\u002Fmar) 和 [Gradio 演示](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fjadechoghari\u002Fmar)（感谢 [@jadechoghari](https:\u002F\u002Fgithub.com\u002Fjadechoghari)）。\n\n## 准备工作\n\n### 数据集\n下载 [ImageNet](http:\u002F\u002Fimage-net.org\u002Fdownload) 数据集，并将其放置在你的 `IMAGENET_PATH` 目录下。\n\n### 安装\n\n克隆代码：\n```\ngit clone https:\u002F\u002Fgithub.com\u002FLTH14\u002Fmar.git\ncd mar\n```\n\n可以创建并激活一个名为 `mar` 的合适 [conda](https:\u002F\u002Fconda.io\u002F) 环境：\n\n```\nconda env create -f environment.yaml\nconda activate mar\n```\n\n下载预训练的 VAE 和 MAR 模型：\n\n```\npython util\u002Fdownload.py\n```\n\n为方便起见，我们还在此直接提供预训练的 MAR 模型下载：\n\n| MAR 模型                                                              | FID-50K | Inception Score | #params | \n|------------------------------------------------------------------------|---------|-----------------|---------|\n| [MAR-B](https:\u002F\u002Fwww.dropbox.com\u002Fscl\u002Ffi\u002Ff6dpuyjb7fudzxcyhvrhk\u002Fcheckpoint-last.pth?rlkey=a6i4bo71vhfo4anp33n9ukujb&dl=0) | 2.31    | 281.7           | 208M    |\n| [MAR-L](https:\u002F\u002Fwww.dropbox.com\u002Fscl\u002Ffi\u002Fpxacc5b2mrt3ifw4cah6k\u002Fcheckpoint-last.pth?rlkey=m48ovo6g7ivcbosrbdaz0ehqt&dl=0) | 1.78    | 296.0           | 479M    |\n| [MAR-H](https:\u002F\u002Fwww.dropbox.com\u002Fscl\u002Ffi\u002F1qmfx6fpy3k7j9vcjjs3s\u002Fcheckpoint-last.pth?rlkey=4lae281yzxb406atp32vzc83o&dl=0) | 1.55    | 303.7           | 943M    |\n\n### （可选）缓存 VAE 隐变量\n\n鉴于我们的数据增强仅包括简单的中心裁剪和随机翻转，VAE 隐变量可以预先计算并保存到 `CACHED_PATH`，以节省 MAR 训练过程中的计算量：\n\n```\ntorchrun --nproc_per_node=8 --nnodes=1 --node_rank=0 \\\nmain_cache.py \\\n--img_size 256 --vae_path pretrained_models\u002Fvae\u002Fkl16.ckpt --vae_embed_dim 16 \\\n--batch_size 128 \\\n--data_path ${IMAGENET_PATH} --cached_path ${CACHED_PATH}\n```\n\n## 使用方法\n\n### 演示\n使用 Colab 笔记本运行我们的交互式可视化 [演示](http:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FLTH14\u002Fmar\u002Fblob\u002Fmain\u002Fdemo\u002Frun_mar.ipynb)！\n\n### 本地 Gradio 应用程序\n\n```\npython demo\u002Fgradio_app.py \n```\n\n\n\n### 训练\n默认设置的脚本（MAR-L，具有 3 个模块、宽度为 1024 通道的 DiffLoss MLP，训练 400 个 epoch）：\n\n```\ntorchrun --nproc_per_node=8 --nnodes=4 --node_rank=${NODE_RANK} --master_addr=${MASTER_ADDR} --master_port=${MASTER_PORT} \\\nmain_mar.py \\\n--img_size 256 --vae_path pretrained_models\u002Fvae\u002Fkl16.ckpt --vae_embed_dim 16 --vae_stride 16 --patch_size 1 \\\n--model mar_large --diffloss_d 3 --diffloss_w 1024 \\\n--epochs 400 --warmup_epochs 100 --batch_size 64 --blr 1.0e-4 --diffusion_batch_mul 4 \\\n--output_dir ${OUTPUT_DIR} --resume ${OUTPUT_DIR} \\\n--data_path ${IMAGENET_PATH}\n```\n\n- 在 32 张 H100 GPU 上，使用 `--batch_size 64` 时，训练时间约为 1 天 7 小时。\n- 添加 `--online_eval` 可以在训练过程中评估 FID（每 40 个 epoch 评估一次）。\n- （可选）若要使用缓存的 VAE 隐变量进行训练，可在参数中添加 `--use_cached --cached_path ${CACHED_PATH}`。使用缓存隐变量时，在 16 张 H100 GPU 上，使用 `--batch_size 128` 的训练时间约为 1 天 11 小时（几乎比不使用缓存快 2 倍）。\n- （可选）为了在训练过程中通过梯度检查点节省显存（感谢 @Jiawei-Yang），可在参数中添加 `--grad_checkpointing`。请注意，这可能会略微降低训练速度。\n\n### 评估（ImageNet 256x256）\n\n使用无分类器指导评估 MAR-B（具有 6 个模块、宽度为 1024 通道的 DiffLoss MLP，训练 800 个 epoch）：\n\n```\ntorchrun --nproc_per_node=8 --nnodes=1 --node_rank=0 \\\nmain_mar.py \\\n--model mar_base --diffloss_d 6 --diffloss_w 1024 \\\n--eval_bsz 256 --num_images 50000 \\\n--num_iter 256 --num_sampling_steps 100 --cfg 2.9 --cfg_schedule linear --temperature 1.0 \\\n--output_dir pretrained_models\u002Fmar\u002Fmar_base \\\n--resume pretrained_models\u002Fmar\u002Fmar_base \\\n--data_path ${IMAGENET_PATH} --evaluate\n```\n\n使用无分类器指导评估 MAR-L（具有 8 个模块、宽度为 1280 通道的 DiffLoss MLP，训练 800 个 epoch）：\n\n```\ntorchrun --nproc_per_node=8 --nnodes=1 --node_rank=0 \\\nmain_mar.py \\\n--model mar_large --diffloss_d 8 --diffloss_w 1280 \\\n--eval_bsz 256 --num_images 50000 \\\n--num_iter 256 --num_sampling_steps 100 --cfg 3.0 --cfg_schedule linear --temperature 1.0 \\\n--output_dir pretrained_models\u002Fmar\u002Fmar_large \\\n--resume pretrained_models\u002Fmar\u002Fmar_large \\\n--data_path ${IMAGENET_PATH} --evaluate\n```\n\n使用无分类器指导评估 MAR-H（具有 12 个模块、宽度为 1536 通道的 DiffLoss MLP，训练 800 个 epoch）：\n\n```\ntorchrun --nproc_per_node=8 --nnodes=1 --node_rank=0 \\\nmain_mar.py \\\n--model mar_huge --diffloss_d 12 --diffloss_w 1536 \\\n--eval_bsz 128 --num_images 50000 \\\n--num_iter 256 --num_sampling_steps 100 --cfg 3.2 --cfg_schedule linear --temperature 1.0 \\\n--output_dir pretrained_models\u002Fmar\u002Fmar_huge \\\n--resume pretrained_models\u002Fmar\u002Fmar_huge \\\n--data_path ${IMAGENET_PATH} --evaluate\n```\n\n- 设置 `--cfg 1.0 --temperature 0.95` 可以在没有无分类器指导的情况下进行评估。\n- 通过减少自回归迭代次数（例如 `--num_iter 64`），可以显著提高生成速度。\n\n## 致谢\n我们感谢邓聪悦和陈欣蕾的有益讨论。同时，我们也感谢 Google TPU 研究云（TRC）为我们提供 TPU 使用权限，以及 Google 云平台对 GPU 资源的支持。\n\n本仓库中的大量代码基于 [MAE](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fmae)、[MAGE](https:\u002F\u002Fgithub.com\u002FLTH14\u002Fmage) 和 [DiT](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FDiT)。\n\n## 联系方式\n\n如果您有任何问题，请随时通过电子邮件（tianhong@mit.edu）与我联系。祝您使用愉快！","# MAR 快速上手指南\n\nMAR (Autoregressive Image Generation without Vector Quantization) 是一个基于 PyTorch 的自回归图像生成模型，无需向量量化即可在 ImageNet 256x256 数据集上实现高质量的图像生成。\n\n## 环境准备\n\n*   **系统要求**: Linux 操作系统，配备 NVIDIA GPU（推荐 H100\u002FA100 等高性能显卡以进行训练，推理可使用消费级显卡）。\n*   **前置依赖**:\n    *   Python 3.8+\n    *   [Conda](https:\u002F\u002Fconda.io\u002F) (推荐用于环境管理)\n    *   Git\n    *   CUDA Toolkit (需与 PyTorch 版本匹配)\n*   **数据集**: 需自行下载 [ImageNet](http:\u002F\u002Fimage-net.org\u002Fdownload) 数据集，并记录其路径为 `IMAGENET_PATH`。\n\n> **注意**：国内用户若下载官方源较慢，可尝试使用学术资源镜像或手动下载模型文件后放入指定目录。\n\n## 安装步骤\n\n1.  **克隆代码仓库**\n    ```bash\n    git clone https:\u002F\u002Fgithub.com\u002FLTH14\u002Fmar.git\n    cd mar\n    ```\n\n2.  **创建并激活 Conda 环境**\n    项目提供了 `environment.yaml` 配置文件，可一键安装所需依赖：\n    ```bash\n    conda env create -f environment.yaml\n    conda activate mar\n    ```\n\n3.  **下载预训练模型**\n    运行脚本自动下载预训练的 VAE 和 MAR 模型：\n    ```bash\n    python util\u002Fdownload.py\n    ```\n    *若自动下载失败，可手动从以下地址下载并放入 `pretrained_models` 目录：*\n    *   [MAR-B (208M)](https:\u002F\u002Fwww.dropbox.com\u002Fscl\u002Ffi\u002Ff6dpuyjb7fudzxcyhvrhk\u002Fcheckpoint-last.pth?rlkey=a6i4bo71vhfo4anp33n9ukujb&dl=0)\n    *   [MAR-L (479M)](https:\u002F\u002Fwww.dropbox.com\u002Fscl\u002Ffi\u002Fpxacc5b2mrt3ifw4cah6k\u002Fcheckpoint-last.pth?rlkey=m48ovo6g7ivcbosrbdaz0ehqt&dl=0)\n    *   [MAR-H (943M)](https:\u002F\u002Fwww.dropbox.com\u002Fscl\u002Ffi\u002F1qmfx6fpy3k7j9vcjjs3s\u002Fcheckpoint-last.pth?rlkey=4lae281yzxb406atp32vzc83o&dl=0)\n\n## 基本使用\n\n### 方式一：在线体验 (推荐新手)\n无需本地配置，直接在 Google Colab 中运行交互式 Demo：\n*   [打开 Colab Notebook](http:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FLTH14\u002Fmar\u002Fblob\u002Fmain\u002Fdemo\u002Frun_mar.ipynb)\n\n### 方式二：本地运行 Gradio 演示\n在本地启动一个 Web 界面进行图像生成测试：\n\n```bash\npython demo\u002Fgradio_app.py \n```\n启动后，终端会显示访问地址（通常为 `http:\u002F\u002F127.0.0.1:7860`），在浏览器打开即可选择类别生成图像。\n\n### 方式三：命令行推理 (评估)\n使用预训练的 MAR-L 模型生成 50,000 张图像并评估 FID（需配置好 `IMAGENET_PATH`）：\n\n```bash\ntorchrun --nproc_per_node=8 --nnodes=1 --node_rank=0 \\\nmain_mar.py \\\n--model mar_large --diffloss_d 8 --diffloss_w 1280 \\\n--eval_bsz 256 --num_images 50000 \\\n--num_iter 256 --num_sampling_steps 100 --cfg 3.0 --cfg_schedule linear --temperature 1.0 \\\n--output_dir pretrained_models\u002Fmar\u002Fmar_large \\\n--resume pretrained_models\u002Fmar\u002Fmar_large \\\n--data_path ${IMAGENET_PATH} --evaluate\n```\n\n*   **加速提示**: 若仅需快速查看生成效果，可减少自回归迭代次数，例如添加参数 `--num_iter 64`。\n*   **无分类器引导**: 若不使用 classifier-free guidance，设置 `--cfg 1.0 --temperature 0.95`。","某生成式 AI 初创团队正在为电商客户开发高保真商品图生成系统，急需在有限算力下提升图像生成的清晰度与细节表现力。\n\n### 没有 mar 时\n- 传统自回归模型依赖向量量化（VQ）技术，导致生成的商品纹理出现明显的伪影和块状失真，严重影响视觉质感。\n- 为了缓解量化误差，团队不得不堆叠更复杂的后处理模块或增大模型参数量，导致训练成本高昂且推理速度缓慢。\n- 调整生成质量时往往陷入两难：提高分辨率会加剧量化噪声，而降低噪声又会导致图像模糊，难以兼顾 FID 指标与人眼观感。\n- 现有开源方案大多基于旧架构，缺乏针对连续潜在空间的优化，复现顶级论文效果需要耗费数周进行底层代码重构。\n\n### 使用 mar 后\n- mar 摒弃了向量量化机制，直接在连续潜在空间进行自回归建模，生成的丝绸、金属等复杂材质纹理自然流畅，彻底消除了块状伪影。\n- 借助 mar 内置的 DiffLoss 损失函数，团队在使用中等规模模型（如 MAR-L）时即可达到 SOTA 级别的 FID 分数（1.78），大幅降低了显卡资源消耗。\n- 模型支持端到端的简单训练流程，无需设计繁琐的码本更新策略，开发人员可快速迭代不同类别的商品生成效果。\n- 直接复用官方提供的预训练权重和 Colab 演示脚本，团队在一天内便完成了从环境搭建到首批高质量样图输出的全流程验证。\n\nmar 通过移除向量量化瓶颈，让开发者能以更低的算力和更简单的架构，实现媲美扩散模型的高保真图像生成能力。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FLTH14_mar_a21e5131.png","LTH14","Tianhong Li","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FLTH14_2ccccfb3.jpg","I'm a postdoc at MIT. My recent research interests are generative models and representation learning.",null,"tianhong@mit.edu","http:\u002F\u002Fwww.tianhongli.me\u002F","https:\u002F\u002Fgithub.com\u002FLTH14",[84],{"name":85,"color":86,"percentage":87},"Python","#3572A5",100,1887,120,"2026-04-06T21:11:17","MIT","Linux","必需 NVIDIA GPU。训练推荐：32x H100 (MAR-L, batch_size 64) 或 16x H100 (使用缓存潜变量，batch_size 128)。评估命令示例使用 8x GPU。具体显存大小未说明，但大规模训练需高显存。","未说明",{"notes":96,"python":97,"dependencies":98},"1. 必须使用 conda 创建名为 'mar' 的环境 (environment.yaml)。2. 数据集需准备 ImageNet 256x256。3. 首次运行需下载预训练的 VAE 和 MAR 模型文件。4. 支持可选的 VAE 潜变量缓存以加速训练。5. 训练脚本依赖 torchrun 进行多机多卡分布式训练。","未说明 (通过 environment.yaml 安装)",[99,100,101],"torch","PyTorch DDP","gradio",[15],"2026-03-27T02:49:30.150509","2026-04-07T10:41:28.205703",[],[]]