[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-zai-org--ImageReward":3,"tool-zai-org--ImageReward":62},[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 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,2,"2026-04-10T11:39:34",[14,15,13],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":32,"last_commit_at":41,"category_tags":42,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[43,13,15,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},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",[52,15,13,14],"语言模型",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":10,"last_commit_at":59,"category_tags":60,"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,61],"视频",{"id":63,"github_repo":64,"name":65,"description_en":66,"description_zh":67,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":77,"owner_location":77,"owner_email":77,"owner_twitter":78,"owner_website":79,"owner_url":80,"languages":81,"stars":90,"forks":91,"last_commit_at":92,"license":93,"difficulty_score":32,"env_os":94,"env_gpu":95,"env_ram":96,"env_deps":97,"category_tags":106,"github_topics":107,"view_count":32,"oss_zip_url":77,"oss_zip_packed_at":77,"status":17,"created_at":112,"updated_at":113,"faqs":114,"releases":145},6253,"zai-org\u002FImageReward","ImageReward","[NeurIPS 2023] ImageReward: Learning and Evaluating Human Preferences for Text-to-image Generation","ImageReward 是一款专为文生图领域打造的通用人类偏好奖励模型，旨在解决当前 AI 绘图结果难以精准匹配人类审美与意图的难题。作为首个基于 13.7 万对专家对比数据训练的模型，它在理解人类对生成图像的偏好方面表现卓越，准确率显著超越 CLIP、Aesthetic 和 BLIP 等现有评分方法。\n\n除了提供高精度的图像质量评分，ImageReward 还引入了独特的“奖励反馈学习”（ReFL）技术。这一功能允许开发者直接利用人类偏好数据对 Stable Diffusion 等扩散模型进行微调优化，实验证明，经 ReFL 调优后的模型在人类评估中胜率大幅提升。\n\n该工具非常适合 AI 研究人员、算法工程师以及希望提升生成内容质量的应用开发者使用。研究人员可利用其评估新算法的性能；开发者则能通过简单的 Python 代码调用，轻松集成图像自动筛选、评分排序或模型微调功能，从而构建更符合用户需求的文生图应用。目前，ImageReward 已封装为便捷的 Python 包，只需几行代码即可快速上手，是优化文生图工作流的有力助手。","# ImageReward\n\n\u003Cp align=\"center\">\n   📃 \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2304.05977\" target=\"_blank\">Paper\u003C\u002Fa> • 🖼 \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FTHUDM\u002FImageRewardDB\" target=\"_blank\">Dataset\u003C\u002Fa> • 🌐 \u003Ca href=\"https:\u002F\u002Fzhuanlan.zhihu.com\u002Fp\u002F639494251\" target=\"_blank\">中文博客\u003C\u002Fa> • 🤗 \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002FTHUDM\u002FImageReward\" target=\"_blank\">HF Repo\u003C\u002Fa> • 🐦 \u003Ca href=\"https:\u002F\u002Ftwitter.com\u002Fthukeg\" target=\"_blank\">Twitter\u003C\u002Fa> \u003Cbr>\n\u003C\u002Fp>\n\n🔥🔥 **News!** ```2024\u002F12\u002F31```: We released the **next generation of model, [VisionReward](https:\u002F\u002Fgithub.com\u002FTHUDM\u002FVisionReward)**, which is a fine-grained and multi-dimensional reward model for stable RLHF for visual generation (text-to-image \u002F text-to-video)!\n\n🔥 **News!** ```2023\u002F9\u002F22```: The paper of ImageReward is accepted by NeurIPS 2023!\n\n**ImageReward: Learning and Evaluating Human Preferences for Text-to-Image Generation**\n\nImageReward is the first general-purpose text-to-image human preference RM, which is trained on in total **137k pairs of expert comparisons**, outperforming existing text-image scoring methods, such as CLIP (by 38.6%), Aesthetic (by 39.6%), and BLIP (by 31.6%), in terms of understanding human preference in text-to-image synthesis.\n\nAdditionally, we introduce Reward Feedback Learning (ReFL) for direct optimizing a text-to-image diffusion model using ImageReward. ReFL-tuned Stable Diffusion wins against untuned version by 58.4% in human evaluation.\n\nBoth ImageReward and ReFL are all packed up to Python `image-reward` package now!\n\n[![PyPI](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fimage-reward)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fimage-reward\u002F) [![Downloads](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fzai-org_ImageReward_readme_f617c87ed07f.png)](https:\u002F\u002Fpepy.tech\u002Fproject\u002Fimage-reward)\n\nTry `image-reward` package in only 3 lines of code for ImageReward scoring!\n\n```python\n# pip install image-reward\nimport ImageReward as RM\nmodel = RM.load(\"ImageReward-v1.0\")\n\nrewards = model.score(\"\u003Cprompt>\", [\"\u003Cimg1_obj_or_path>\", \"\u003Cimg2_obj_or_path>\", ...])\n```\n\nTry `image-reward` package in only 4 lines of code for ReFL fine-tuning!\n\n```python\n# pip install image-reward\n# pip install diffusers==0.16.0 accelerate==0.16.0 datasets==2.11.0\nfrom ImageReward import ReFL\nargs = ReFL.parse_args()\ntrainer = ReFL.Trainer(\"CompVis\u002Fstable-diffusion-v1-4\", \"data\u002Frefl_data.json\", args=args)\ntrainer.train(args=args)\n```\n\nIf you find `ImageReward`'s open-source effort useful, please 🌟 us to encourage our following developement!\n\n\u003Cp align=\"center\">\n    \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fzai-org_ImageReward_readme_29754c09cd23.jpg\" width=\"700px\">\n\u003C\u002Fp>\n\n- [ImageReward](#imagereward)\n  - [Quick Start](#quick-start)\n    - [Install Dependency](#install-dependency)\n    - [Example Use](#example-use)\n  - [ReFL](#refl)\n    - [Install Dependency](#install-dependency-1)\n    - [Example Use](#example-use-1)\n  - [Demos of ImageReward and ReFL](#demos-of-imagereward-and-refl)\n  - [Training code for ImageReward](#training-code-for-imagereward)\n  - [Integration into Stable Diffusion Web UI](#integration-into-stable-diffusion-web-ui)\n    - [Features](#features)\n      - [Score generated images and append to image information](#score-generated-images-and-append-to-image-information)\n        - [Usage](#usage)\n        - [Demo video](#demo-video)\n      - [Automatically filter out images with low scores](#automatically-filter-out-images-with-low-scores)\n        - [Usage](#usage-1)\n        - [Demo video](#demo-video-1)\n      - [View the scores of images that have been scored](#view-the-scores-of-images-that-have-been-scored)\n        - [Usage](#usage-2)\n        - [Example](#example)\n      - [Other Features](#other-features)\n        - [Memory Management](#memory-management)\n    - [FAQ](#faq)\n  - [Reproduce Experiments in Table 1](#reproduce-experiments-in-table-1)\n  - [Reproduce Experiments in Table 3](#reproduce-experiments-in-table-3)\n  - [Citation](#citation)\n\n## Quick Start\n\n### Install Dependency\n\nWe have integrated the whole repository to a single python package `image-reward`. Following the commands below to prepare the environment:\n\n```shell\n# Clone the ImageReward repository (containing data for testing)\ngit clone https:\u002F\u002Fgithub.com\u002FTHUDM\u002FImageReward.git\ncd ImageReward\n\n# Install the integrated package `image-reward`\npip install image-reward\n```\n\n### Example Use\n\nWe provide example images in the [`assets\u002Fimages`](assets\u002Fimages) directory of this repo. The example prompt is:\n\n```text\na painting of an ocean with clouds and birds, day time, low depth field effect\n```\n\nUse the following code to get the human preference scores from ImageReward:\n\n```python\nimport os\nimport torch\nimport ImageReward as RM\n\nif __name__ == \"__main__\":\n    prompt = \"a painting of an ocean with clouds and birds, day time, low depth field effect\"\n    img_prefix = \"assets\u002Fimages\"\n    generations = [f\"{pic_id}.webp\" for pic_id in range(1, 5)]\n    img_list = [os.path.join(img_prefix, img) for img in generations]\n    model = RM.load(\"ImageReward-v1.0\")\n    with torch.no_grad():\n        ranking, rewards = model.inference_rank(prompt, img_list)\n        # Print the result\n        print(\"\\nPreference predictions:\\n\")\n        print(f\"ranking = {ranking}\")\n        print(f\"rewards = {rewards}\")\n        for index in range(len(img_list)):\n            score = model.score(prompt, img_list[index])\n            print(f\"{generations[index]:>16s}: {score:.2f}\")\n\n```\n\nThe output should be like as follow (the exact numbers may be slightly different depending on the compute device):\n\n```\nPreference predictions:\n\nranking = [1, 2, 3, 4]\nrewards = [[0.5811622738838196], [0.2745276093482971], [-1.4131819009780884], [-2.029569625854492]]\n          1.webp: 0.58\n          2.webp: 0.27\n          3.webp: -1.41\n          4.webp: -2.03\n```\n\n\n## ReFL\n\n### Install Dependency\n```shell\npip install diffusers==0.16.0 accelerate==0.16.0 datasets==2.11.0\n```\n\n### Example Use\n\nWe provide example dataset for ReFL in the [`data\u002Frefl_data.json`](data\u002Frefl_data.json) of this repo. Run ReFL as following:\n\n```shell\nbash scripts\u002Ftrain_refl.sh\n```\n\n## Demos of ImageReward and ReFL\n\n\u003Cp align=\"center\">\n    \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fzai-org_ImageReward_readme_eebb34bf24a4.jpg\" width=\"700px\">\n\u003C\u002Fp>\n\n\n## Training code for ImageReward\n\n1. Download data: 🖼 \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FTHUDM\u002FImageRewardDB\" target=\"_blank\">Dataset\u003C\u002Fa>.\n\n2. Make dataset.\n```shell\ncd train\npython src\u002Fmake_dataset.py\n```\n\n3. Set training config: [`train\u002Fsrc\u002Fconfig\u002Fconfig.yaml`](train\u002Fsrc\u002Fconfig\u002Fconfig.yaml)\n\n4. One command to train.\n```shell\nbash scripts\u002Ftrain_one_node.sh\n```\n\n\n## Integration into [Stable Diffusion Web UI](https:\u002F\u002Fgithub.com\u002FAUTOMATIC1111\u002Fstable-diffusion-webui)\n\nWe have developed a **custom script** to integrate ImageReward into SD Web UI for a convenient experience.\n\nThe script is located at [`sdwebui\u002Fimage_reward.py`](sdwebui\u002Fimage_reward.py) in this repository.\n\nThe **usage** of the script is described as follows:\n\n1. **Install**: put the custom script into the [`stable-diffusion-webui\u002Fscripts\u002F`](https:\u002F\u002Fgithub.com\u002FAUTOMATIC1111\u002Fstable-diffusion-webui\u002Ftree\u002Fmaster\u002Fscripts) directory\n2. **Reload**: restart the service, or click the **\"Reload custom script\"** button at the bottom of the settings tab of SD Web UI. (If the button can't be found, try clicking the **\"Show all pages\"** button at the bottom of the left sidebar.)\n3. **Select**: go back to the **\"txt2img\"\u002F\"img2img\"** tab, and select **\"ImageReward - generate human preference scores\"** from the \"**Script\"** dropdown menu in the lower left corner.\n4. **Run**: the specific usage varies depending on the functional requirements, as described in the **\"Features\"** section below.\n\n### Features\n\n#### Score generated images and append to image information\n\n##### Usage\n\n1. **Do not** check the \"Filter out images with low scores\" checkbox.\n2. Click the **\"Generate\"** button to generate images.\n3. Check the ImageReward at the **bottom** of the image information **below the gallery**.\n\n##### Demo video\n\nhttps:\u002F\u002Fgithub.com\u002FTHUDM\u002FImageReward\u002Fassets\u002F98524878\u002F9d8a036d-1583-4978-aac7-4b758edf9b89\n\n#### Automatically filter out images with low scores\n\n##### Usage\n\n1. Check the **\"Filter out images with low scores\"** checkbox.\n2. Enter the score lower limit in **\"Lower score limit\"**. (ImageReward roughly follows the standard normal distribution, with a mean of 0 and a variance of 1.)\n3. Click the **\"Generate\"** button to generate images.\n4. Images with scores below the lower limit will be automatically filtered out and **will not appear in the gallery**.\n5. Check the ImageReward at the **bottom** of the image information **below the gallery**.\n\n##### Demo video\n\nhttps:\u002F\u002Fgithub.com\u002FTHUDM\u002FImageReward\u002Fassets\u002F98524878\u002Fb9f01629-87d6-4c92-9990-fe065711b9c6\n\n#### View the scores of images that have been scored\n\n##### Usage\n\n1. Upload the scored image file in the **\"PNG Info\"** tab\n2. Check the image information on the right with the score of the image at the **bottom**.\n\n##### Example\n\n\u003Cp align=\"center\">\n    \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fzai-org_ImageReward_readme_3b8a1f1dbc4e.jpg\" width=\"700px\">\n\u003C\u002Fp>\n\n#### Other Features\n\n##### Memory Management\n\n- ImageReward model will not be loaded **until first script run**.\n- **\"Reload UI\"** will not reload the model nor unload it, but **reuse**s the currently loaded model (if it exists).\n- A **\"Unload Model\"** button is provided to manually unload the currently loaded model.\n\n### FAQ\n\n#### How to adjust the Python environment used by the SD Web UI (e.g. reinstall a package)?\n\nNote that **SD Web UI has two ways to set up its Python environment**:\n\n- If you **launch with `python launch.py`**, Web UI will use the Python environment **found in your `PATH` (in Linux, you can check its exact path with `which python`)**.\n- If you **launch with a script like `webui-user.bat`**, Web UI creates a new **venv environment** in the directory `stable-diffusion-webui\\venv`.\n    - Generally, you need some other operations to activate this environment. For example, in Windows, you need to enter the `stable-diffusion-webui\\venv\\Scripts` directory, run `activate` or `activate.bat` (if you are using **cmd**) or `activate.ps1` (if you are using **PowerShell**) from .\n    - If you see **the prompt `(venv)` appear at the far left of the command line**, you have successfully activated venv created by the SD Web UI.\n\nAfter activating the right Python environment, just do what you want to do true to form.\n\n## Reproduce Experiments in Table 1\n\n\u003Cp align=\"center\">\n    \u003Cimg alt=\"Table_1_in_paper\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fzai-org_ImageReward_readme_e2deecd6c6e5.png\" width=\"700px\">\n\u003C\u002Fp>\n\n**Note:** The experimental results are produced in an environment that satisfies:\n- (NVIDIA) Driver Version: 515.86.01\n- CUDA Version: 11.7\n- `torch` Version: 1.12.1+cu113\nAccording to our own reproduction experience, reproducing this experiment in other environments may cause the last decimal place to fluctuate, typically within a range of ±0.1.\n\nRun the following script to automatically download data, baseline models, and run experiments:\n\n```bash\nbash .\u002Fscripts\u002Ftest-benchmark.sh\n```\n\nThen you can check the results in **`benchmark\u002Fresults\u002F` or the terminal**.\n\nIf you want to check the raw data files individually:\n\n- Test prompts and corresponding human rankings for images are located in [`benchmark\u002Fbenchmark-prompts.json`](benchmark\u002Fbenchmark-prompts.json).\n- Generated outputs for each prompt (originally from [DiffusionDB](https:\u002F\u002Fgithub.com\u002Fpoloclub\u002Fdiffusiondb)) can be downloaded from [Hugging Face](https:\u002F\u002Fhuggingface.co\u002FTHUDM\u002FImageReward\u002Ftree\u002Fmain\u002Fgenerations) or [Tsinghua Cloud](https:\u002F\u002Fcloud.tsinghua.edu.cn\u002Fd\u002F8048c335cb464220b663\u002F).\n    - Each `\u003Cmodel_name>.zip` contains a directory of the same name, in which there are in total 1000 images generated from 100 prompts of 10 images each.\n    - Every `\u003Cmodel_name>.zip` should be decompressed into `benchmark\u002Fgenerations\u002F` as directory `\u003Cmodel_name>` that contains images.\n\n## Reproduce Experiments in Table 3\n\n\u003Cp align=\"center\">\n    \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fzai-org_ImageReward_readme_cf3596206af2.png\" width=\"700px\">\n\u003C\u002Fp>\n\nRun the following script to automatically download data, baseline models, and run experiments:\n\n```bash\nbash .\u002Fscripts\u002Ftest.sh\n```\n\nIf you want to check the raw data files individually:\n\n* Test prompts and corresponding human rankings for images are located in [`data\u002Ftest.json`](data\u002Ftest.json).\n* Generated outputs for each prompt (originally from [DiffusionDB](https:\u002F\u002Fgithub.com\u002Fpoloclub\u002Fdiffusiondb)) can be downloaded from [Hugging Face](https:\u002F\u002Fhuggingface.co\u002FTHUDM\u002FImageReward\u002Fblob\u002Fmain\u002Ftest_images.zip) or [Tsinghua Cloud](https:\u002F\u002Fcloud.tsinghua.edu.cn\u002Ff\u002F9bd245027652422499f4\u002F?dl=1). It should be decompressed to `data\u002Ftest_images`.\n\n## Citation\n\n```\n@inproceedings{xu2023imagereward,\n  title={ImageReward: learning and evaluating human preferences for text-to-image generation},\n  author={Xu, Jiazheng and Liu, Xiao and Wu, Yuchen and Tong, Yuxuan and Li, Qinkai and Ding, Ming and Tang, Jie and Dong, Yuxiao},\n  booktitle={Proceedings of the 37th International Conference on Neural Information Processing Systems},\n  pages={15903--15935},\n  year={2023}\n}\n```\n","# ImageReward\n\n\u003Cp align=\"center\">\n   📃 \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2304.05977\" target=\"_blank\">论文\u003C\u002Fa> • 🖼 \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FTHUDM\u002FImageRewardDB\" target=\"_blank\">数据集\u003C\u002Fa> • 🌐 \u003Ca href=\"https:\u002F\u002Fzhuanlan.zhihu.com\u002Fp\u002F639494251\" target=\"_blank\">中文博客\u003C\u002Fa> • 🤗 \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002FTHUDM\u002FImageReward\" target=\"_blank\">HF 仓库\u003C\u002Fa> • 🐦 \u003Ca href=\"https:\u002F\u002Ftwitter.com\u002Fthukeg\" target=\"_blank\">Twitter\u003C\u002Fa> \u003Cbr>\n\u003C\u002Fp>\n\n🔥🔥 **新闻！** ```2024\u002F12\u002F31```: 我们发布了**下一代模型，[VisionReward](https:\u002F\u002Fgithub.com\u002FTHUDM\u002FVisionReward)**，这是一种用于视觉生成（文本到图像 \u002F 文本到视频）稳定 RLHF 的细粒度、多维度奖励模型！\n\n🔥 **新闻！** ```2023\u002F9\u002F22```: ImageReward 的论文已被 NeurIPS 2023 接收！\n\n**ImageReward：学习与评估人类对文本到图像生成的偏好**\n\nImageReward 是首个通用的文本到图像人类偏好 RM，共基于**13.7万组专家比较数据**进行训练，在理解文本到图像合成中的人类偏好方面，优于现有的文本-图像评分方法，例如 CLIP（高出 38.6%）、Aesthetic（高出 39.6%）和 BLIP（高出 31.6%）。\n\n此外，我们还引入了奖励反馈学习（ReFL），用于直接使用 ImageReward 优化文本到图像扩散模型。经过 ReFL 微调的 Stable Diffusion 在人工评估中比未微调版本高出 58.4%。\n\n目前，ImageReward 和 ReFL 已全部打包为 Python `image-reward` 包！\n\n[![PyPI](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fimage-reward)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fimage-reward\u002F) [![下载量](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fzai-org_ImageReward_readme_f617c87ed07f.png)](https:\u002F\u002Fpepy.tech\u002Fproject\u002Fimage-reward)\n\n只需三行代码，即可使用 `image-reward` 包进行 ImageReward 评分！\n\n```python\n# pip install image-reward\nimport ImageReward as RM\nmodel = RM.load(\"ImageReward-v1.0\")\n\nrewards = model.score(\"\u003Cprompt>\", [\"\u003Cimg1_obj_or_path>\", \"\u003Cimg2_obj_or_path>\", ...])\n```\n\n只需四行代码，即可使用 `image-reward` 包进行 ReFL 微调！\n\n```python\n# pip install image-reward\n# pip install diffusers==0.16.0 accelerate==0.16.0 datasets==2.11.0\nfrom ImageReward import ReFL\nargs = ReFL.parse_args()\ntrainer = ReFL.Trainer(\"CompVis\u002Fstable-diffusion-v1-4\", \"data\u002Frefl_data.json\", args=args)\ntrainer.train(args=args)\n```\n\n如果您觉得 `ImageReward` 的开源工作很有帮助，请为我们点个星🌟，以鼓励我们继续开发！\n\n\u003Cp align=\"center\">\n    \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fzai-org_ImageReward_readme_29754c09cd23.jpg\" width=\"700px\">\n\u003C\u002Fp>\n\n- [ImageReward](#imagereward)\n  - [快速入门](#quick-start)\n    - [安装依赖](#install-dependency)\n    - [示例用法](#example-use)\n  - [ReFL](#refl)\n    - [安装依赖](#install-dependency-1)\n    - [示例用法](#example-use-1)\n  - [ImageReward 和 ReFL 的演示](#demos-of-imagereward-and-refl)\n  - [ImageReward 的训练代码](#training-code-for-imagereward)\n  - [集成到 Stable Diffusion Web UI](#integration-into-stable-diffusion-web-ui)\n    - [功能](#features)\n      - [为生成的图片打分并附加到图片信息中](#score-generated-images-and-append-to-image-information)\n        - [使用方法](#usage)\n        - [演示视频](#demo-video)\n      - [自动过滤低分图片](#automatically-filter-out-images-with-low-scores)\n        - [使用方法](#usage-1)\n        - [演示视频](#demo-video-1)\n      - [查看已评分图片的分数](#view-the-scores-of-images-that-have-been-scored)\n        - [使用方法](#usage-2)\n        - [示例](#example)\n      - [其他功能](#other-features)\n        - [内存管理](#memory-management)\n    - [常见问题解答](#faq)\n  - [重现表 1 中的实验](#reproduce-experiments-in-table-1)\n  - [重现表 3 中的实验](#reproduce-experiments-in-table-3)\n  - [引用](#citation)\n\n## 快速入门\n\n### 安装依赖\n\n我们将整个仓库整合为一个 Python 包 `image-reward`。请按照以下命令准备环境：\n\n```shell\n# 克隆 ImageReward 仓库（包含测试数据）\ngit clone https:\u002F\u002Fgithub.com\u002FTHUDM\u002FImageReward.git\ncd ImageReward\n\n# 安装整合后的包 `image-reward`\npip install image-reward\n```\n\n### 示例用法\n\n我们在该仓库的 [`assets\u002Fimages`](assets\u002Fimages) 目录中提供了示例图片。示例提示词为：\n\n```text\n一幅描绘海洋、云朵和鸟类的画作，白天场景，浅景深效果\n```\n\n使用以下代码从 ImageReward 获取人类偏好得分：\n\n```python\nimport os\nimport torch\nimport ImageReward as RM\n\nif __name__ == \"__main__\":\n    prompt = \"一幅描绘海洋、云朵和鸟类的画作，白天场景，浅景深效果\"\n    img_prefix = \"assets\u002Fimages\"\n    generations = [f\"{pic_id}.webp\" for pic_id in range(1, 5)]\n    img_list = [os.path.join(img_prefix, img) for img in generations]\n    model = RM.load(\"ImageReward-v1.0\")\n    with torch.no_grad():\n        ranking, rewards = model.inference_rank(prompt, img_list)\n        # 打印结果\n        print(\"\\n偏好预测：\\n\")\n        print(f\"ranking = {ranking}\")\n        print(f\"rewards = {rewards}\")\n        for index in range(len(img_list)):\n            score = model.score(prompt, img_list[index])\n            print(f\"{generations[index]:>16s}: {score:.2f}\")\n\n```\n\n输出应如下所示（具体数值可能因计算设备而略有不同）：\n\n```\n偏好预测：\n\nranking = [1, 2, 3, 4]\nrewards = [[0.5811622738838196], [0.2745276093482971], [-1.4131819009780884], [-2.029569625854492]]\n          1.webp: 0.58\n          2.webp: 0.27\n          3.webp: -1.41\n          4.webp: -2.03\n```\n\n\n## ReFL\n\n### 安装依赖\n```shell\npip install diffusers==0.16.0 accelerate==0.16.0 datasets==2.11.0\n```\n\n### 示例用法\n\n我们在该仓库的 [`data\u002Frefl_data.json`](data\u002Frefl_data.json) 中提供了 ReFL 的示例数据集。按如下方式运行 ReFL：\n\n```shell\nbash scripts\u002Ftrain_refl.sh\n```\n\n## ImageReward 和 ReFL 的演示\n\n\u003Cp align=\"center\">\n    \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fzai-org_ImageReward_readme_eebb34bf24a4.jpg\" width=\"700px\">\n\u003C\u002Fp>\n\n\n## ImageReward 的训练代码\n\n1. 下载数据：🖼 \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FTHUDM\u002FImageRewardDB\" target=\"_blank\">数据集\u003C\u002Fa>。\n\n2. 制作数据集。\n```shell\ncd train\npython src\u002Fmake_dataset.py\n```\n\n3. 设置训练配置：[`train\u002Fsrc\u002Fconfig\u002Fconfig.yaml`](train\u002Fsrc\u002Fconfig\u002Fconfig.yaml)\n\n4. 一条命令即可开始训练。\n```shell\nbash scripts\u002Ftrain_one_node.sh\n```\n\n## 集成到 [Stable Diffusion Web UI](https:\u002F\u002Fgithub.com\u002FAUTOMATIC1111\u002Fstable-diffusion-webui)\n\n我们开发了一个**自定义脚本**，用于将 ImageReward 集成到 SD Web UI 中，以提供便捷的使用体验。\n\n该脚本位于本仓库的 [`sdwebui\u002Fimage_reward.py`](sdwebui\u002Fimage_reward.py) 文件中。\n\n### 脚本的使用方法如下：\n\n1. **安装**：将自定义脚本放入 [`stable-diffusion-webui\u002Fscripts\u002F`](https:\u002F\u002Fgithub.com\u002FAUTOMATIC1111\u002Fstable-diffusion-webui\u002Ftree\u002Fmaster\u002Fscripts) 目录。\n2. **重新加载**：重启服务，或在 SD Web UI 设置页底部点击“重新加载自定义脚本”按钮。（如果找不到该按钮，请尝试点击左侧边栏底部的“显示所有页面”按钮。）\n3. **选择**：返回“txt2img”或“img2img”选项卡，在左下角的“脚本”下拉菜单中选择“ImageReward - 生成人类偏好分数”。\n4. **运行**：具体用法根据功能需求有所不同，详见下方的“功能”部分。\n\n### 功能\n\n#### 为生成的图像打分并附加到图像信息中\n\n##### 使用方法\n\n1. **不要勾选**“过滤低分图像”复选框。\n2. 点击“生成”按钮以生成图像。\n3. 在画廊下方的图像信息**底部**查看 ImageReward 分数。\n\n##### 演示视频\n\nhttps:\u002F\u002Fgithub.com\u002FTHUDM\u002FImageReward\u002Fassets\u002F98524878\u002F9d8a036d-1583-4978-aac7-4b758edf9b89\n\n#### 自动过滤低分图像\n\n##### 使用方法\n\n1. 勾选“过滤低分图像”复选框。\n2. 在“最低分数限制”中输入分数下限。（ImageReward 大致遵循标准正态分布，均值为 0，方差为 1。）\n3. 点击“生成”按钮以生成图像。\n4. 分数低于下限的图像将被自动过滤掉，并且**不会出现在画廊中**。\n5. 在画廊下方的图像信息**底部**查看 ImageReward 分数。\n\n##### 演示视频\n\nhttps:\u002F\u002Fgithub.com\u002FTHUDM\u002FImageReward\u002Fassets\u002F98524878\u002Fb9f01629-87d6-4c92-9990-fe065711b9c6\n\n#### 查看已评分图像的分数\n\n##### 使用方法\n\n1. 在“PNG 信息”选项卡中上传已评分的图像文件。\n2. 在右侧查看图像信息，图像分数位于**底部**。\n\n##### 示例\n\n\u003Cp align=\"center\">\n    \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fzai-org_ImageReward_readme_3b8a1f1dbc4e.jpg\" width=\"700px\">\n\u003C\u002Fp>\n\n#### 其他功能\n\n##### 内存管理\n\n- ImageReward 模型仅在**首次运行脚本时**才会被加载。\n- “重新加载 UI”不会重新加载或卸载模型，而是会**复用**当前已加载的模型（如果存在）。\n- 提供了“卸载模型”按钮，可手动卸载当前加载的模型。\n\n### 常见问题解答\n\n#### 如何调整 SD Web UI 使用的 Python 环境（例如重新安装某个包）？\n\n请注意，**SD Web UI 有两种设置 Python 环境的方式**：\n\n- 如果您使用 `python launch.py` 启动，Web UI 将使用您 `PATH` 中找到的 Python 环境（在 Linux 中，您可以使用 `which python` 查看其确切路径）。\n- 如果您使用类似 `webui-user.bat` 的脚本启动，Web UI 会在 `stable-diffusion-webui\\venv` 目录下创建一个新的 **venv 环境**。\n    - 通常，您还需要执行一些操作来激活此环境。例如，在 Windows 中，您需要进入 `stable-diffusion-webui\\venv\\Scripts` 目录，运行 `activate` 或 `activate.bat`（如果您使用的是 **cmd**），或者运行 `activate.ps1`（如果您使用的是 **PowerShell**）。\n    - 如果您看到命令行最左侧出现 **`(venv)` 提示符**，则表示您已成功激活 SD Web UI 创建的 venv 环境。\n\n激活正确的 Python 环境后，您就可以按照常规方式执行所需操作了。\n\n## 复现表 1 中的实验\n\n\u003Cp align=\"center\">\n    \u003Cimg alt=\"Table_1_in_paper\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fzai-org_ImageReward_readme_e2deecd6c6e5.png\" width=\"700px\">\n\u003C\u002Fp>\n\n**注意**：实验结果是在以下环境中产生的：\n- (NVIDIA) 驱动版本：515.86.01\n- CUDA 版本：11.7\n- `torch` 版本：1.12.1+cu113\n\n根据我们的复现实验经验，在其他环境中复现该实验可能会导致最后一位小数出现波动，通常在 ±0.1 的范围内。\n\n运行以下脚本可自动下载数据、基线模型并运行实验：\n\n```bash\nbash .\u002Fscripts\u002Ftest-benchmark.sh\n```\n\n然后您可以在 **`benchmark\u002Fresults\u002F` 或终端** 中查看结果。\n\n如果您想单独查看原始数据文件：\n\n- 测试提示词及对应的图像人类评分位于 [`benchmark\u002Fbenchmark-prompts.json`](benchmark\u002Fbenchmark-prompts.json)。\n- 每个提示词的生成结果（最初来自 [DiffusionDB](https:\u002F\u002Fgithub.com\u002Fpoloclub\u002Fdiffusiondb)）可以从 [Hugging Face](https:\u002F\u002Fhuggingface.co\u002FTHUDM\u002FImageReward\u002Ftree\u002Fmain\u002Fgenerations) 或 [清华大学云盘](https:\u002F\u002Fcloud.tsinghua.edu.cn\u002Fd\u002F8048c335cb464220b663\u002F) 下载。\n    - 每个 `\u003Cmodel_name>.zip` 文件包含一个同名目录，其中共有 1000 张图像，由 100 个提示词各生成 10 张图像。\n    - 每个 `\u003Cmodel_name>.zip` 文件都应解压到 `benchmark\u002Fgenerations\u002F` 目录中，形成名为 `\u003Cmodel_name>` 的子目录，存放这些图像。\n\n## 复现表 3 中的实验\n\n\u003Cp align=\"center\">\n    \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fzai-org_ImageReward_readme_cf3596206af2.png\" width=\"700px\">\n\u003C\u002Fp>\n\n运行以下脚本可自动下载数据、基线模型并运行实验：\n\n```bash\nbash .\u002Fscripts\u002Ftest.sh\n```\n\n如果您想单独查看原始数据文件：\n\n- 测试提示词及对应的图像人类评分位于 [`data\u002Ftest.json`](data\u002Ftest.json)。\n- 每个提示词的生成结果（最初来自 [DiffusionDB](https:\u002F\u002Fgithub.com\u002Fpoloclub\u002Fdiffusiondb)）可以从 [Hugging Face](https:\u002F\u002Fhuggingface.co\u002FTHUDM\u002FImageReward\u002Fblob\u002Fmain\u002Ftest_images.zip) 或 [清华大学云盘](https:\u002F\u002Fcloud.tsinghua.edu.cn\u002Ff\u002F9bd245027652422499f4\u002F?dl=1) 下载。下载后应解压至 `data\u002Ftest_images` 目录。\n\n## 引用\n\n```\n@inproceedings{xu2023imagereward,\n  title={ImageReward: learning and evaluating human preferences for text-to-image generation},\n  author={Xu, Jiazheng and Liu, Xiao and Wu, Yuchen and Tong, Yuxuan and Li, Qinkai and Ding, Ming and Tang, Jie and Dong, Yuxiao},\n  booktitle={Proceedings of the 37th International Conference on Neural Information Processing Systems},\n  pages={15903--15935},\n  year={2023}\n}\n```","# ImageReward 快速上手指南\n\nImageReward 是首个通用的文生图（Text-to-Image）人类偏好奖励模型。它基于 13.7 万对专家比较数据训练而成，能够准确评估生成图像是否符合人类审美偏好，并支持通过 ReFL 技术直接优化扩散模型。\n\n## 环境准备\n\n*   **操作系统**: Linux \u002F macOS \u002F Windows\n*   **Python**: 建议 Python 3.8+\n*   **依赖库**: `torch`, `transformers` (安装主包时会自动处理)\n*   **可选依赖 (用于 ReFL 微调)**: `diffusers==0.16.0`, `accelerate==0.16.0`, `datasets==2.11.0`\n\n> **提示**：本指南优先使用官方 PyPI 源。若下载速度较慢，可添加 `-i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple` 使用清华镜像源加速安装。\n\n## 安装步骤\n\nImageReward 已封装为独立的 Python 包 `image-reward`，安装非常简单。\n\n1.  **克隆仓库（可选，仅用于获取测试图片示例）**：\n    ```bash\n    git clone https:\u002F\u002Fgithub.com\u002FTHUDM\u002FImageReward.git\n    cd ImageReward\n    ```\n\n2.  **安装核心包**：\n    ```bash\n    pip install image-reward\n    ```\n    *国内用户加速安装命令：*\n    ```bash\n    pip install image-reward -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n    ```\n\n3.  **安装 ReFL 微调所需依赖（如需进行模型微调）**：\n    ```bash\n    pip install diffusers==0.16.0 accelerate==0.16.0 datasets==2.11.0\n    ```\n\n## 基本使用\n\n以下示例展示如何加载预训练模型并对生成的图像进行打分和排序。\n\n### 代码示例\n\n假设你有一组由提示词生成的图片，想要知道哪张最符合人类偏好：\n\n```python\nimport os\nimport torch\nimport ImageReward as RM\n\nif __name__ == \"__main__\":\n    # 定义提示词\n    prompt = \"a painting of an ocean with clouds and birds, day time, low depth field effect\"\n    \n    # 定义图片路径列表 (请替换为你自己的图片路径)\n    # 这里假设当前目录下有 1.webp 到 4.webp\n    img_list = [\"1.webp\", \"2.webp\", \"3.webp\", \"4.webp\"]\n    \n    # 加载预训练模型\n    model = RM.load(\"ImageReward-v1.0\")\n    \n    # 方法一：获取排序结果和具体奖励分数\n    with torch.no_grad():\n        ranking, rewards = model.inference_rank(prompt, img_list)\n        \n        print(\"\\n偏好预测结果:\\n\")\n        print(f\"排序索引 (从优到劣): {ranking}\")\n        print(f\"对应奖励分数: {rewards}\")\n        \n        # 方法二：单独获取某张图片的分数\n        for index, img_path in enumerate(img_list):\n            score = model.score(prompt, img_path)\n            print(f\"{img_path}: {score:.2f}\")\n```\n\n### 输出说明\n\n运行上述代码后，你将得到类似以下的输出。分数越高代表图像越符合人类偏好（通常服从标准正态分布，均值为 0）：\n\n```text\n偏好预测结果:\n\n排序索引 (从优到劣): [1, 2, 3, 4]\n对应奖励分数: [[0.58], [0.27], [-1.41], [-2.03]]\n1.webp: 0.58\n2.webp: 0.27\n3.webp: -1.41\n4.webp: -2.03\n```\n\n### 进阶：ReFL 微调 (可选)\n\n如果你希望使用 ImageReward 作为奖励信号来微调 Stable Diffusion 模型，可以使用以下极简代码启动训练：\n\n```python\nfrom ImageReward import ReFL\n\n# 解析参数\nargs = ReFL.parse_args()\n\n# 初始化训练器 (指定基础模型和数据集路径)\ntrainer = ReFL.Trainer(\"CompVis\u002Fstable-diffusion-v1-4\", \"data\u002Frefl_data.json\", args=args)\n\n# 开始训练\ntrainer.train(args=args)\n```","某电商设计团队正在利用 Stable Diffusion 批量生成节日促销海报背景，需要在短时间内从数百张候选图中筛选出最符合人类审美且紧扣文案的高质量图片。\n\n### 没有 ImageReward 时\n- **筛选效率低下**：设计师只能依靠肉眼逐张检查，面对海量生成结果耗时耗力，严重拖慢项目进度。\n- **主观标准不一**：不同成员对“好图”的定义存在偏差，导致选图结果缺乏一致性，反复沟通成本高。\n- **图文匹配度难控**：传统指标（如 CLIP 分数）往往无法精准捕捉人类对画面美感与提示词契合度的真实偏好，常选出“分高但丑”的图片。\n- **模型优化盲目**：缺乏有效的自动化反馈信号，难以直接针对人类喜好微调生成模型，迭代效果全靠运气。\n\n### 使用 ImageReward 后\n- **自动化高分初筛**：利用 ImageReward 的评分接口，几行代码即可瞬间为所有生成图打分，自动过滤掉低分劣质图，仅保留顶部候选供人工复核。\n- **对齐人类审美偏好**：基于 13.7 万组专家对比数据训练，ImageReward 的评分逻辑高度模拟人类判断，能精准识别出构图精美、风格恰当的图像。\n- **量化评估更客观**：将模糊的“好看”转化为具体数值，团队可依据统一标准快速决策，大幅减少因主观差异产生的争议。\n- **驱动模型定向进化**：通过 ReFL 技术将 ImageReward 作为奖励函数直接微调 Stable Diffusion，让模型学会“自我修正”，生成的图片越来越符合业务需求。\n\nImageReward 通过将抽象的人类审美转化为可计算的奖励信号，彻底解决了文生图应用中“生成易、精选难”的核心痛点，实现了从人工海选到智能优选的效率飞跃。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fzai-org_ImageReward_eebb34bf.jpg","zai-org","Z.ai","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fzai-org_f0d5ae80.png","ChatGLM, GLM-4.5, CogVLM, CodeGeeX, CogView, CogVideoX | CogDL, AMiner | Zhipu.ai (Z.ai)",null,"Zai_org","https:\u002F\u002Fwww.zhipuai.cn\u002Fen","https:\u002F\u002Fgithub.com\u002Fzai-org",[82,86],{"name":83,"color":84,"percentage":85},"Python","#3572A5",99.1,{"name":87,"color":88,"percentage":89},"Shell","#89e051",0.9,1659,91,"2026-04-06T14:21:53","Apache-2.0","Linux, Windows, macOS","需要 NVIDIA GPU（用于复现实验推荐 CUDA 11.7，驱动版本 515.86.01+），具体显存需求未说明但建议 8GB+ 以运行扩散模型微调","未说明",{"notes":98,"python":99,"dependencies":100},"1. 核心功能已封装为 `image-reward` Python 包，可直接 pip 安装。2. 若进行 ReFL 微调训练，需严格安装指定版本的 diffusers、accelerate 和 datasets。3. 集成到 Stable Diffusion Web UI 时需注意其虚拟环境激活方式（venv 或系统 PATH）。4. 官方基准测试在 CUDA 11.7 和 torch 1.12.1 环境下进行，其他环境可能导致结果小数位波动。5. 首次运行需下载模型权重文件。","未说明 (需兼容 torch 1.12.1+cu113 的环境)",[101,102,103,104,105],"torch>=1.12.1","image-reward","diffusers==0.16.0","accelerate==0.16.0","datasets==2.11.0",[15],[108,109,110,111],"diffusion-models","generative-model","rlhf","human-preferences","2026-03-27T02:49:30.150509","2026-04-10T20:32:38.058773",[115,120,125,130,135,140],{"id":116,"question_zh":117,"answer_zh":118,"source_url":119},28292,"如何在 SD WebUI 中解决 'ModuleNotFoundError: No module named ImageReward' 错误？","该问题通常是因为 SD WebUI 使用了独立的虚拟环境（venv），而您在全局环境中安装了 image-reward。解决方法是激活 SD WebUI 的虚拟环境并重新安装：\n1. 找到 SD WebUI 的 venv 路径（通常在 stable-diffusion-webui\u002Fvenv）。\n2. 激活该环境：在 Windows 上运行 `venv\\Scripts\\activate`，Linux\u002FMac 上运行 `source venv\u002Fbin\u002Factivate`。\n3. 在激活的环境中重新安装：`pip install image-reward`。\n注意：如果您通过 `webui-user.bat` 启动，WebUI 会自动创建并使用内部的 venv，此时全局安装的包无法被识别。","https:\u002F\u002Fgithub.com\u002Fzai-org\u002FImageReward\u002Fissues\u002F56",{"id":121,"question_zh":122,"answer_zh":123,"source_url":124},28293,"如何使用自定义偏好数据微调 ImageReward 模型？","您可以基于 ImageReward v1.0 的检查点进行微调，这样效果更佳。注意事项包括：\n1. 训练过程对超参数（如固定率 fix rate、学习率、批次大小）非常敏感，建议调整这些参数以优化训练。\n2. 训练初期损失值可能暂时不变，这是正常现象，请延长训练时间观察是否自行恢复。\n3. 对于数据集，可以使用类似 test.json 格式的偏好数据（包含训练、验证和测试集）。\n4. 有用户反馈使用约 20,000 对图像数据时，测试准确率大约在 4 个 epoch 后收敛。","https:\u002F\u002Fgithub.com\u002Fzai-org\u002FImageReward\u002Fissues\u002F45",{"id":126,"question_zh":127,"answer_zh":128,"source_url":129},28294,"ImageReward 输出的奖励分数范围是多少？代码中的 mean 和 std 是什么意思？","代码中使用的均值（mean: 0.16717362830052426）和标准差（std: 1.0333394966054072）是基于测试集的奖励计算得出的。其目的是对原始奖励进行标准化处理，使其均值为 0，标准差为 1，以便于模型评估和比较。这些统计量并非来自训练集，而是基于测试集计算得到的。","https:\u002F\u002Fgithub.com\u002Fzai-org\u002FImageReward\u002Fissues\u002F5",{"id":131,"question_zh":132,"answer_zh":133,"source_url":134},28295,"如何复现 ImageReward 的微调（ReFL）结果？","请参考官方 README 中的训练代码部分：https:\u002F\u002Fgithub.com\u002FTHUDM\u002FImageReward#training-code-for-imagereward。\n如果您想添加自己的预训练数据，基本逻辑是先计算预训练损失并更新 UNet，再计算 ReFL 损失并更新 UNet。若不使用梯度累积，伪代码如下：\n1. `train_loss.backward()` -> `optimizer.step()` -> `lr_scheduler.step()` -> `optimizer.zero_grad()`\n2. `refl_loss.backward()` -> `optimizer.step()` -> `lr_scheduler.step()` -> `optimizer.zero_grad()`\n如需使用梯度累积，请结合 `accelerator.accumulate(unet)` 上下文管理器包裹上述步骤。","https:\u002F\u002Fgithub.com\u002Fzai-org\u002FImageReward\u002Fissues\u002F34",{"id":136,"question_zh":137,"answer_zh":138,"source_url":139},28296,"为什么在 SD WebUI 中加载 image_reward.py 脚本时报错找不到模块？","这是因为 SD WebUI 启动时使用的是其自带的虚拟环境，而 `image-reward` 包可能被安装在了系统全局 Python 环境中。解决方案是：\n1. 确认 SD WebUI 使用的 Python 环境路径（通常在 webui 目录下的 venv 文件夹）。\n2. 激活该虚拟环境。\n3. 在该环境中执行 `pip install image-reward` 重新安装。\n这能确保 WebUI 加载脚本时能找到正确的模块。","https:\u002F\u002Fgithub.com\u002Fzai-org\u002FImageReward\u002Fissues\u002F16",{"id":141,"question_zh":142,"answer_zh":143,"source_url":144},28297,"ReFL.py 代码中第 730-737 行的变量设置是否有误？","是的，社区用户指出该处存在笔误。具体而言，变量 `t` 应该等于 `timesteps[mid_timestep-1]`，而不是直接等于 `mid_timestep`。同时，传入 UNet 的参数也应是 `timesteps[mid_timestep]` 对应的时间步。维护者已确认这是一个 typo 并感谢用户的指正。在复现代码或进行二次开发时请注意修正此逻辑。","https:\u002F\u002Fgithub.com\u002Fzai-org\u002FImageReward\u002Fissues\u002F32",[]]