[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-allenai--visprog":3,"tool-allenai--visprog":64},[4,17,27,35,43,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},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,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",140436,2,"2026-04-05T23:32:43",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"status":16},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 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":23,"last_commit_at":41,"category_tags":42,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":44,"name":45,"github_repo":46,"description_zh":47,"stars":48,"difficulty_score":23,"last_commit_at":49,"category_tags":50,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,51,52,53,15,54,26,13,55],"数据工具","视频","插件","其他","音频",{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":10,"last_commit_at":62,"category_tags":63,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,"2026-04-04T04:44:48",[15,14,13,26,54],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":70,"readme_en":71,"readme_zh":72,"quickstart_zh":73,"use_case_zh":74,"hero_image_url":75,"owner_login":76,"owner_name":77,"owner_avatar_url":78,"owner_bio":79,"owner_company":80,"owner_location":80,"owner_email":81,"owner_twitter":80,"owner_website":82,"owner_url":83,"languages":84,"stars":93,"forks":94,"last_commit_at":95,"license":96,"difficulty_score":23,"env_os":97,"env_gpu":98,"env_ram":97,"env_deps":99,"category_tags":106,"github_topics":80,"view_count":23,"oss_zip_url":80,"oss_zip_packed_at":80,"status":16,"created_at":107,"updated_at":108,"faqs":109,"releases":140},2390,"allenai\u002Fvisprog","visprog","Official code for VisProg (CVPR 2023 Best Paper!)","VisProg 是一个荣获 CVPR 2023 最佳论文奖的神经符号系统，旨在无需额外训练即可解决复杂的组合式视觉任务。它利用大语言模型（如 GPT-3）的上下文学习能力，将自然语言指令自动转化为可执行的 Python 程序。通过逐行调用现成的计算机视觉模型、图像处理 routine 或通用函数，VisProg 不仅能输出最终结果，还能生成清晰、可解释的推理过程，有效解决了传统黑盒模型在复杂视觉推理中缺乏透明度和灵活性的难题。\n\n该工具特别适合研究人员和开发者使用，尤其是那些希望探索视觉推理新范式、快速原型化多模态任务，或需要可解释性 AI 解决方案的专业人士。其代码库设计极简且模块化，用户只需在 Jupyter Notebook 中配置 API 密钥即可运行涵盖物体检测、图像编辑及视觉问答等多种任务的示例。\n\nVisProg 的核心亮点在于“视觉编程”理念：它将复杂的视觉问题分解为一系列可编程步骤，结合符号系统的逻辑性与神经网络的感知能力。虽然官方已推出功能更强大的继任者 CodeNav，但 VisProg 作为开创性工作，仍为理解如何在不训练专用模型的情况下实现高级视觉推理提供了宝","VisProg 是一个荣获 CVPR 2023 最佳论文奖的神经符号系统，旨在无需额外训练即可解决复杂的组合式视觉任务。它利用大语言模型（如 GPT-3）的上下文学习能力，将自然语言指令自动转化为可执行的 Python 程序。通过逐行调用现成的计算机视觉模型、图像处理 routine 或通用函数，VisProg 不仅能输出最终结果，还能生成清晰、可解释的推理过程，有效解决了传统黑盒模型在复杂视觉推理中缺乏透明度和灵活性的难题。\n\n该工具特别适合研究人员和开发者使用，尤其是那些希望探索视觉推理新范式、快速原型化多模态任务，或需要可解释性 AI 解决方案的专业人士。其代码库设计极简且模块化，用户只需在 Jupyter Notebook 中配置 API 密钥即可运行涵盖物体检测、图像编辑及视觉问答等多种任务的示例。\n\nVisProg 的核心亮点在于“视觉编程”理念：它将复杂的视觉问题分解为一系列可编程步骤，结合符号系统的逻辑性与神经网络的感知能力。虽然官方已推出功能更强大的继任者 CodeNav，但 VisProg 作为开创性工作，仍为理解如何在不训练专用模型的情况下实现高级视觉推理提供了宝贵的参考基准。","🔥 Checkout our new work [CodeNav](https:\u002F\u002Fgithub.com\u002Fallenai\u002Fcodenav) which addresses many limitations of VisProg and generalizes it further: 🔥 \u003Cbr>\n\n✅ ~~Write tool descriptions~~ Point to the codebase which you want the CodeNav agent to use - that's right, the raw source code! - CodeNav will index and search the source code directly \u003Cbr>\n✅ ~~Generate the whole program at once~~ CodeNav iteratively generates code (which imports and invokes functions and classes from your codebase), executes it, and then decides the next step based on the execution output. The next step could be searching in the codebase or writing more code \u003Cbr>\n✅ ~~Generate one function call per line~~ CodeNav generates free-form code - think of it similar to writing a code cell in an ipython notebook. While executing the current code block, CodeNav has access to global variables created while executing previous code blocks \u003Cbr>\n✅ ~~Give up if there's an execution error~~ CodeNav will look at execution results including errors, new variables created, and STDOUT, and will try to fix errors in the next step \u003Cbr>\n✅ ~~Implement tools as simple function calls~~ CodeNav gives you, as the developer of tools, flexibility to build a full-fledged codebase as you see fit - use abstractions, use object-oriented programming - just generally follow good software development practices (meaningful class\u002Ffunction\u002Fvariable names, docstrics, specifying argument types in your code help)\n\n\n\n# Visual Programming: Compositional visual reasoning without training (CVPR 2023 Best Paper!)\nBy [Tanmay Gupta](http:\u002F\u002Ftanmaygupta.info\u002F) and  [Aniruddha Kembhavi](https:\u002F\u002Fanikem.github.io\u002F)\n\n[ [Project Page](https:\u002F\u002Fprior.allenai.org\u002Fprojects\u002Fvisprog) | [Arxiv Paper](https:\u002F\u002Farxiv.org\u002Fabs\u002F2211.11559) | [Blog](https:\u002F\u002Fblog.allenai.org\u002Fvisual-programming-ca58c7af51cd) ]\n\n![teaser](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fallenai_visprog_readme_cfdc09ed13e8.png)\n\nThis repository contains the official code for VisProg - a neuro-symbolic system that solves complex and compositional visual tasks given natural language instructions. VisProg uses the in-context learning ability of GPT3 to generate python programs which are then executed to get both the solution and a comprehensive and interpretable rationale. Each line of the generated program may invoke one of several off-the-shelf computer vision models, image processing routines, or python functions to produce intermediate outputs that may be consumed by subsequent parts of the program.\n\nThis code base has been designed to be:\n\n:white_check_mark: easy to use (a simple ipynb per task) \u003Cbr>\n:white_check_mark: easy to extend with *new functionality* by adding new modules to VisProg \u003Cbr>\n:white_check_mark: easy to extend to *new tasks* by adding in-context examples for these tasks \u003Cbr>\n:white_check_mark: minimal and modular to make it easy to dig into and build upon\n\n# Install Dependencies\n```\nconda env create -f environment.yaml\nconda activate visprog\n```\n\n# Running the notebooks\nHaving setup and activated the conda environment, you should be all set to run the notebooks in the `notebooks\u002F` folder. If you use an editor like VSCode, openning the `.ipynb`s within VSCode might be the easiest way to get started. \n\nYou will find a notebook for each of the following tasks, but they are quite similar in structure:\n- Outside knowledge object tagging: [`notebooks\u002Fok_det.ipynb`](notebooks\u002Fok_det.ipynb)\n- Natural language image editing: [`notebooks\u002Fimage_editing.ipynb`](notebooks\u002Fimage_editing.ipynb)\n- NLVR: [`notebooks\u002Fnlvr.ipynb`](notebooks\u002Fnlvr.ipynb)\n- GQA: [`notebooks\u002Fgqa.ipynb`](notebooks\u002Fgqa.ipynb)\n\nSimply, enter your OpenAI API key in the cell that currently reads `\u003CEnter your key here>` and run the notebook. The notebooks are designed to be self-contained and should run end-to-end without any additional setup.\n\nThe basic structure of the notebooks is as follows:\n- Setup paths\n- Set OPENAI_API_KEY environment variable to use GPT3\n- Import `ProgramGenerator` and `ProgramInterpreter` classes\n- Import `PROMPT` (a text string containing in-context examples) or `create_prompt` (a function that creates the prompt on the fly)\n- Create the `ProgramGenerator` and `ProgramInterpreter` objects\n- Load the image or images to perform inference on\n- Specify the natural language question \u002F statement \u002F instruction\n- Generate program from the specified instruction using `ProgramGenerator`\n- Interpret and execute program using `ProgramInterpreter`\n- Visualize the returned result and visual rationale (execution trace)\n\n# Example Output\nWe have tried to make it easy to visualize each step of the execution trace. \n\nFor instance, when running the `gqa` notebook for the instruction `How many people or animals are in the image?` on `assets\u002Fcamel1.png`, you should see the following outputs:\n\n### Program\n```python\nBOX0=LOC(image=IMAGE,object='people')\nBOX1=LOC(image=IMAGE,object='animals')\nANSWER0=COUNT(box=BOX0)\nANSWER1=COUNT(box=BOX1)\nANSWER2=EVAL(expr=\"{ANSWER0} + {ANSWER1}\")\nFINAL_RESULT=RESULT(var=ANSWER2)\n```\n\n### Visual Rationale\n![https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fallenai_visprog_readme_254f085c1b79.png](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fallenai_visprog_readme_254f085c1b79.png)\n\n# What if VisProg doesn't solve your task?\nIt is possible that the instruction you provide is not solved correctly by VisProg. This can happen for a few reasons:\n1. The instruction is very different from in-context examples that VisProg has seen before. In this case, even though the current set of modules may be adequate for solving the task, VisProg failed because of incorrect program generation. In this case, see if you can write a program using VisProg's modules that solves the task. If you can, then you may add this program to the in-context examples and re-run the notebook to handle similar instructions.\n2. The problem is not solvable with the current set of modules in VisProg. If this is the case, you can add new modules to VisProg to solve this task. See the next section for details.\n\n# Adding new functionality and ability to solve new tasks\n- Add new modules for enabling these functionalities to [`engine\u002Fstep_interpreters.py`](engine\u002Fstep_interpreters.py). Don't forget to register these modules in `register_step_interpreters` function in the same file. Here's the step interpreter for the COUNT module. All modules have a similar structure with a `parse`, `html`, and `execute` function. The `parse` function parses the program string to extract the arguments and output variable. The `html` function generates the html representation for the execution trace. The `execute` function executes the module and returns the output and the html (if `inspect=True`) for the execution trace.\n\n    ```python\n    class CountInterpreter():\n        step_name = 'COUNT'\n\n        def __init__(self):\n            print(f'Registering {self.step_name} step')\n\n        def parse(self,prog_step):\n            parse_result = parse_step(prog_step.prog_str)\n            step_name = parse_result['step_name']\n            box_var = parse_result['args']['box']\n            output_var = parse_result['output_var']\n            assert(step_name==self.step_name)\n            return box_var,output_var\n\n        def html(self,box_img,output_var,count):\n            step_name = html_step_name(self.step_name)\n            output_var = html_var_name(output_var)\n            box_arg = html_arg_name('bbox')\n            box_img = html_embed_image(box_img)\n            output = html_output(count)\n            return f\"\"\"\u003Cdiv>{output_var}={step_name}({box_arg}={box_img})={output}\u003C\u002Fdiv>\"\"\"\n\n        def execute(self,prog_step,inspect=False):\n            box_var,output_var = self.parse(prog_step)\n            boxes = prog_step.state[box_var]\n            count = len(boxes)\n            prog_step.state[output_var] = count\n            if inspect:\n                box_img = prog_step.state[box_var+'_IMAGE']\n                html_str = self.html(box_img, output_var, count)\n                return count, html_str\n\n            return count\n    ```\n- Add your in-context examples to a new file `prompts\u002Fyour_task_or_dataset_name.py`. Note that instead of using in-context examples to generate programs, you may experiment with different ways of prompting such as providing function signatures and docstrings without needing to change the code at all!\n- You can now play with examples from this dataset using a notebook similar to those in the `notebooks\u002F` folder or create a python script to run inference on a large number of examples.\n\n# Here's what VisProg can do today\n![https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fallenai_visprog_readme_a6c8b2335b4d.png](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fallenai_visprog_readme_a6c8b2335b4d.png)\n\n# A summary of currently available modules\n![https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fallenai_visprog_readme_75308ddaa0d4.png](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fallenai_visprog_readme_75308ddaa0d4.png)\n\n*Note that we have replaced ViLT for VQA with a more performant model called BLIP which was recently made available on Huggingface. This shows how easy it is to swap out or upgrade modules in VisProg.\n\n# Changes since the version used in the CVPR paper\n- GPT3 upgraded to `text-davinci-003` from `text-davinci-002`\n- VQA module upgraded from ViLT to the more performant BLIP\n\n# Citation\nIf you find this code useful in your research, please consider citing:\n```\n@article{Gupta2022VisProg,\n  title={Visual Programming: Compositional visual reasoning without training},\n  author={Tanmay Gupta and Aniruddha Kembhavi},\n  journal={ArXiv},\n  year={2022},\n  volume={abs\u002F2211.11559}\n}\n```\n","🔥 请查看我们的新作 [CodeNav](https:\u002F\u002Fgithub.com\u002Fallenai\u002Fcodenav)，它克服了 VisProg 的诸多局限，并对其进行了进一步的泛化：🔥 \u003Cbr>\n\n✅ ~~编写工具描述~~ 直接指向你希望 CodeNav 代理使用的代码库——没错，就是原始源代码！——CodeNav 会直接对源代码进行索引和搜索 \u003Cbr>\n✅ ~~一次性生成整个程序~~ CodeNav 会迭代式地生成代码（这些代码会从你的代码库中导入并调用函数和类），执行后根据执行结果决定下一步操作。下一步可能是继续在代码库中搜索，或者编写更多代码 \u003Cbr>\n✅ ~~每行只生成一个函数调用~~ CodeNav 可以生成自由格式的代码——你可以把它想象成在 IPython 笔记本中编写代码单元格一样。在执行当前代码块时，CodeNav 能够访问之前代码块执行过程中创建的全局变量 \u003Cbr>\n✅ ~~遇到执行错误就放弃~~ CodeNav 会查看包括错误、新创建的变量以及 STDOUT 在内的执行结果，并尝试在下一步修复错误 \u003Cbr>\n✅ ~~将工具实现为简单的函数调用~~ CodeNav 为工具开发者提供了极大的灵活性，可以根据需要构建功能完善的代码库——可以使用抽象、面向对象编程等方法——总之，遵循良好的软件开发实践即可（有意义的类\u002F函数\u002F变量名、文档字符串、在代码中明确指定参数类型都有帮助）\n\n\n\n# 视觉编程：无需训练的组合式视觉推理（CVPR 2023 年最佳论文！）\n作者：[Tanmay Gupta](http:\u002F\u002Ftanmaygupta.info\u002F) 和 [Aniruddha Kembhavi](https:\u002F\u002Fanikem.github.io\u002F)\n\n[ [项目页面](https:\u002F\u002Fprior.allenai.org\u002Fprojects\u002Fvisprog) | [Arxiv 论文](https:\u002F\u002Farxiv.org\u002Fabs\u002F2211.11559) | [博客](https:\u002F\u002Fblog.allenai.org\u002Fvisual-programming-ca58c7af51cd) ]\n\n![teaser](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fallenai_visprog_readme_cfdc09ed13e8.png)\n\n本仓库包含 VisProg 的官方代码——这是一种神经符号系统，能够根据自然语言指令解决复杂且具有组合性的视觉任务。VisProg 利用 GPT-3 的上下文学习能力生成 Python 程序，然后执行这些程序以获得解决方案以及全面且可解释的推理过程。生成的每一行程序都可能调用现成的计算机视觉模型、图像处理例程或 Python 函数，从而产生中间输出，供程序后续部分使用。\n\n该代码库的设计目标是：\n\n:white_check_mark: 易于使用（每个任务只需一个简单的 ipynb 文件） \u003Cbr>\n:white_check_mark: 易于扩展 *新功能* ——只需向 VisProg 添加新模块即可 \u003Cbr>\n:white_check_mark: 易于扩展到 *新任务* ——只需添加针对这些任务的上下文示例即可 \u003Cbr>\n:white_check_mark: 极简且模块化，便于深入研究和在此基础上进一步开发\n\n# 安装依赖\n```\nconda env create -f environment.yaml\nconda activate visprog\n```\n\n# 运行笔记本\n设置并激活 Conda 环境后，你就可以开始运行 `notebooks\u002F` 文件夹中的笔记本了。如果你使用 VSCode 等编辑器，在 VSCode 中直接打开 `.ipynb` 文件可能是最简便的入门方式。\n\n你会发现以下每个任务都有对应的笔记本，但它们的结构非常相似：\n- 外部知识物体标注：[`notebooks\u002Fok_det.ipynb`](notebooks\u002Fok_det.ipynb)\n- 自然语言图像编辑：[`notebooks\u002Fimage_editing.ipynb`](notebooks\u002Fimage_editing.ipynb)\n- NLVR：[`notebooks\u002Fnlvr.ipynb`](notebooks\u002Fnlvr.ipynb)\n- GQA：[`notebooks\u002Fgqa.ipynb`](notebooks\u002Fgqa.ipynb)\n\n只需在当前写着 `\u003CEnter your key here>` 的单元格中输入你的 OpenAI API 密钥，然后运行笔记本即可。这些笔记本都是自包含的，应该能够从头到尾顺利运行，无需额外设置。\n\n笔记本的基本结构如下：\n- 设置路径\n- 将 OPENAI_API_KEY 环境变量设置为使用 GPT-3\n- 导入 `ProgramGenerator` 和 `ProgramInterpreter` 类\n- 导入 `PROMPT`（包含上下文示例的文本字符串）或 `create_prompt`（动态生成提示语的函数）\n- 创建 `ProgramGenerator` 和 `ProgramInterpreter` 对象\n- 加载用于推理的图像或图像集\n- 指定自然语言问题\u002F陈述\u002F指令\n- 使用 `ProgramGenerator` 根据指定指令生成程序\n- 使用 `ProgramInterpreter` 解释并执行程序\n- 可视化返回的结果及可视化推理过程（执行轨迹）\n\n# 示例输出\n我们尽量让执行轨迹的每一步都易于可视化。\n\n例如，当你在 `assets\u002Fcamel1.png` 上运行 `gqa` 笔记本，指令为“图片中有多少人或动物？”时，你应该会看到以下输出：\n\n### 程序\n```python\nBOX0=LOC(image=IMAGE,object='people')\nBOX1=LOC(image=IMAGE,object='animals')\nANSWER0=COUNT(box=BOX0)\nANSWER1=COUNT(box=BOX1)\nANSWER2=EVAL(expr=\"{ANSWER0} + {ANSWER1}\")\nFINAL_RESULT=RESULT(var=ANSWER2)\n```\n\n### 可视化推理过程\n![https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fallenai_visprog_readme_254f085c1b79.png](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fallenai_visprog_readme_254f085c1b79.png)\n\n# 如果 VisProg 无法解决你的任务怎么办？\n有可能你提供的指令无法被 VisProg 正确解决。这可能有以下几个原因：\n1. 你的指令与 VisProg 之前见过的上下文示例差异较大。在这种情况下，即使当前的模块集合足以解决问题，VisProg 也可能因为程序生成不正确而失败。此时，你可以尝试使用 VisProg 的模块手动编写一个能解决问题的程序。如果成功，可以将这个程序加入上下文示例中，然后重新运行笔记本以处理类似的指令。\n2. 当前 VisProg 中的模块集合无法解决该问题。如果是这种情况，你可以向 VisProg 添加新的模块来解决这个问题。详情请参阅下一节。\n\n# 添加新功能及解决新任务的能力\n- 在 [`engine\u002Fstep_interpreters.py`](engine\u002Fstep_interpreters.py) 中添加用于实现这些功能的新模块。别忘了在同一文件中的 `register_step_interpreters` 函数中注册这些模块。以下是 COUNT 模块的步骤解释器。所有模块都具有类似的结构，包含 `parse`、`html` 和 `execute` 三个函数。`parse` 函数解析程序字符串，提取参数和输出变量；`html` 函数生成执行轨迹的 HTML 表示；`execute` 函数执行模块，并返回输出结果以及（若 `inspect=True`）执行轨迹的 HTML。\n\n    ```python\n    class CountInterpreter():\n        step_name = 'COUNT'\n\n        def __init__(self):\n            print(f'注册 {self.step_name} 步骤')\n\n        def parse(self,prog_step):\n            parse_result = parse_step(prog_step.prog_str)\n            step_name = parse_result['step_name']\n            box_var = parse_result['args']['box']\n            output_var = parse_result['output_var']\n            assert(step_name==self.step_name)\n            return box_var,output_var\n\n        def html(self,box_img,output_var,count):\n            step_name = html_step_name(self.step_name)\n            output_var = html_var_name(output_var)\n            box_arg = html_arg_name('bbox')\n            box_img = html_embed_image(box_img)\n            output = html_output(count)\n            return f\"\"\"\u003Cdiv>{output_var}={step_name}({box_arg}={box_img})={output}\u003C\u002Fdiv>\"\"\"\n\n        def execute(self,prog_step,inspect=False):\n            box_var,output_var = self.parse(prog_step)\n            boxes = prog_step.state[box_var]\n            count = len(boxes)\n            prog_step.state[output_var] = count\n            if inspect:\n                box_img = prog_step.state[box_var+'_IMAGE']\n                html_str = self.html(box_img, output_var, count)\n                return count, html_str\n\n            return count\n    ```\n- 将你的上下文示例添加到新文件 `prompts\u002Fyour_task_or_dataset_name.py` 中。请注意，除了使用上下文示例来生成程序之外，你还可以尝试其他提示方式，例如提供函数签名和文档字符串，而无需对代码进行任何更改！\n- 现在你可以使用类似于 `notebooks\u002F` 文件夹中的笔记本，来玩转该数据集中的示例，或者编写一个 Python 脚本来对大量示例进行推理。\n\n# 这就是 VisProg 目前能够做到的\n![https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fallenai_visprog_readme_a6c8b2335b4d.png](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fallenai_visprog_readme_a6c8b2335b4d.png)\n\n# 当前可用模块概览\n![https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fallenai_visprog_readme_75308ddaa0d4.png](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fallenai_visprog_readme_75308ddaa0d4.png)\n\n*请注意，我们已将用于 VQA 的 ViLT 替换为性能更优的 BLIP 模型，该模型最近已在 Huggingface 上发布。这表明在 VisProg 中替换或升级模块是多么容易。\n\n# 自 CVPR 论文所用版本以来的变更\n- GPT3 从 `text-davinci-002` 升级到 `text-davinci-003`\n- VQA 模块从 ViLT 升级为性能更强的 BLIP\n\n# 引用\n如果你的研究中使用了这段代码，请考虑引用以下文献：\n```\n@article{Gupta2022VisProg,\n  title={Visual Programming: Compositional visual reasoning without training},\n  author={Tanmay Gupta and Aniruddha Kembhavi},\n  journal={ArXiv},\n  year={2022},\n  volume={abs\u002F2211.11559}\n}\n```","# VisProg 快速上手指南\n\nVisProg 是一个神经符号系统，能够利用 GPT-3 的上下文学习能力，根据自然语言指令生成并执行 Python 程序，从而解决复杂的组合式视觉任务（如视觉问答、图像编辑等）。无需额外训练即可使用。\n\n## 环境准备\n\n*   **操作系统**: Linux \u002F macOS (Windows 需使用 WSL)\n*   **Python 版本**: 推荐 Python 3.8+\n*   **前置依赖**:\n    *   [Conda](https:\u002F\u002Fdocs.conda.io\u002F) (推荐使用 Miniconda 或 Anaconda)\n    *   OpenAI API Key (用于调用 GPT-3 模型)\n*   **网络要求**: 由于需要连接 OpenAI API 和 Hugging Face 下载模型，请确保网络通畅。国内用户建议配置代理或使用加速镜像。\n\n## 安装步骤\n\n1.  **克隆仓库**\n    ```bash\n    git clone https:\u002F\u002Fgithub.com\u002Fallenai\u002Fvisprog.git\n    cd visprog\n    ```\n\n2.  **创建并激活 Conda 环境**\n    项目提供了 `environment.yaml` 文件以自动安装所有依赖（包括 PyTorch, Transformers, BLIP 等）。\n    ```bash\n    conda env create -f environment.yaml\n    conda activate visprog\n    ```\n    > **提示**: 如果 `conda env create` 速度较慢，国内用户可尝试指定清华源：\n    > `conda env create -f environment.yaml --channel https:\u002F\u002Fmirrors.tuna.tsinghua.edu.cn\u002Fanaconda\u002Fpkgs\u002Fmain\u002F`\n\n## 基本使用\n\nVisProg 的设计初衷是“开箱即用”，每个任务都对应一个独立的 Jupyter Notebook。以下以 **GQA (视觉问答)** 任务为例：\n\n### 1. 启动 Notebook\n在激活 `visprog` 环境后，使用 Jupyter Lab 或 VS Code 打开对应的笔记本文件：\n```bash\njupyter notebook notebooks\u002Fgqa.ipynb\n```\n*(其他可用任务见 `notebooks\u002F` 目录，如 `image_editing.ipynb`, `nlvr.ipynb` 等)*\n\n### 2. 配置 API Key\n在 Notebook 中找到标记为 `\u003CEnter your key here>` 的代码单元格，填入你的 OpenAI API Key：\n```python\nimport os\nos.environ[\"OPENAI_API_KEY\"] = \"sk-...\" # 在此处填入你的密钥\n```\n\n### 3. 运行流程\n按顺序执行 Notebook 中的单元格，核心流程如下：\n\n1.  **初始化**: 导入 `ProgramGenerator` 和 `ProgramInterpreter` 类。\n2.  **加载数据**: 加载目标图片（例如 `assets\u002Fcamel1.png`）。\n3.  **输入指令**: 定义自然语言问题，例如：\n    ```python\n    instruction = \"How many people or animals are in the image?\"\n    ```\n4.  **生成程序**: 调用 `ProgramGenerator` 将指令转化为可执行的 Python 代码序列。\n    *   *生成的示例代码*:\n        ```python\n        BOX0=LOC(image=IMAGE,object='people')\n        BOX1=LOC(image=IMAGE,object='animals')\n        ANSWER0=COUNT(box=BOX0)\n        ANSWER1=COUNT(box=BOX1)\n        ANSWER2=EVAL(expr=\"{ANSWER0} + {ANSWER1}\")\n        FINAL_RESULT=RESULT(var=ANSWER2)\n        ```\n5.  **执行与可视化**: 调用 `ProgramInterpreter` 执行上述代码，系统将自动调用视觉模型（如 BLIP, Detectron2 等）并输出最终答案及可视化的推理过程（Visual Rationale）。\n\n### 4. 查看结果\n执行完毕后，Notebook 将直接显示：\n*   **最终答案**: 问题的直接回答。\n*   **推理轨迹**: 每一步操作的中间结果（如检测框、计数值）及其对应的可视化图像，帮助理解模型的决策过程。\n\n---\n*注：若需扩展新功能或适配新任务，可参考原文档中关于添加模块 (`engine\u002Fstep_interpreters.py`) 和提示词 (`prompts\u002F`) 的说明。*","某电商运营团队需要批量处理数千张商品图，根据自然语言指令（如“找出所有穿红裙子的模特并裁剪出裙子区域”）自动完成复杂的视觉分析与编辑任务。\n\n### 没有 visprog 时\n- 开发人员必须为每个新需求硬编码专用脚本，一旦指令逻辑变化（如从“红裙子”变为“蓝衬衫”），就需要重新编写和调试代码，效率极低。\n- 面对多步骤任务（先检测人、再识别衣物颜色、最后分割特定区域），传统流水线难以灵活组合不同的 CV 模型，中间结果无法直观验证。\n- 非技术背景的运营人员无法直接下达复杂指令，必须依赖技术人员作为“翻译”中介，沟通成本高且容易出错。\n- 缺乏可解释性，当处理结果错误时，很难定位是检测模型失效还是逻辑判断失误，排查问题如同黑盒摸索。\n\n### 使用 visprog 后\n- 运营人员直接输入自然语言指令，visprog 利用 GPT-3 的上下文学习能力自动生成可执行的 Python 程序，无需人工编写任何代码即可适配新需求。\n- 系统将复杂任务拆解为可视化的程序步骤，依次调用现成的目标检测、图像分割等模块，每一步的中间输出都清晰可见，逻辑透明可控。\n- 业务方直接与系统交互，visprog 自动将模糊的自然语言转化为精确的视觉操作序列，彻底消除了技术与业务之间的沟通壁垒。\n- 生成的程序本身就是详细的推理依据（Rationale），若结果有误，团队可直接查看哪一行代码调用的模型出了问题，快速修正提示词或替换模块。\n\nvisprog 的核心价值在于将自然语言直接转化为可执行、可解释的视觉程序，让复杂的组合式视觉推理无需训练即可按需定制。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fallenai_visprog_cfdc09ed.png","allenai","Ai2","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fallenai_65c450d5.png","",null,"ai2-info@allenai.org","http:\u002F\u002Fwww.allenai.org","https:\u002F\u002Fgithub.com\u002Fallenai",[85,89],{"name":86,"color":87,"percentage":88},"Python","#3572A5",85.2,{"name":90,"color":91,"percentage":92},"Jupyter Notebook","#DA5B0B",14.8,764,69,"2026-03-30T08:36:50","Apache-2.0","未说明","未说明 (依赖 BLIP 等视觉模型，通常建议配备 NVIDIA GPU)",{"notes":100,"python":101,"dependencies":102},"1. 项目通过 'conda env create -f environment.yaml' 安装依赖，具体版本需查看该文件。\n2. 必须配置 OPENAI_API_KEY 环境变量以调用 GPT-3 生成程序。\n3. 核心功能依赖于外部 API (OpenAI) 和本地视觉模型 (如 BLIP)，无需训练即可运行。\n4. 代码主要在 Jupyter Notebook (.ipynb) 环境中运行。","未说明 (需通过 environment.yaml 创建 Conda 环境)",[103,104,105],"OpenAI API (text-davinci-003)","BLIP (Huggingface)","Conda",[26,14,15,54],"2026-03-27T02:49:30.150509","2026-04-06T08:40:44.302948",[110,115,120,125,130,135],{"id":111,"question_zh":112,"answer_zh":113,"source_url":114},11001,"是否尝试过使用开源大语言模型（如 LLaMA, MPT）？效果如何？","在项目初期曾尝试过当时可用的开源大模型，但发现 GPT-3 的效果明显更好。虽然近期未对新的开源模型进行测试，但值得用户自行尝试。此外，论文中展示了性能随上下文示例数量变化的情况，可作为参考。","https:\u002F\u002Fgithub.com\u002Fallenai\u002Fvisprog\u002Fissues\u002F4",{"id":116,"question_zh":117,"answer_zh":118,"source_url":119},10997,"运行代码时遇到 ImportError: failed to find libmagic 错误怎么办？","这是由于 python-magic 库在 Windows 上兼容性问题导致的。可以通过以下命令修复：\n1. 卸载当前的 python-magic：pip uninstall python-magic\n2. 安装适用于 Windows 的二进制版本：pip install python-magic-bin==0.4.14","https:\u002F\u002Fgithub.com\u002Fallenai\u002Fvisprog\u002Fissues\u002F3",{"id":121,"question_zh":122,"answer_zh":123,"source_url":124},10998,"执行图像编辑任务中的 'REPLACE' 指令时出现 TypeError 错误如何解决？","这是 diffusers 库中的一个已知问题。需要手动修改本地安装的源代码文件：\n找到文件：~\\anaconda3\\Lib\\site-packages\\diffusers\\pipelines\\stable_diffusion\\pipeline_stable_diffusion_inpaint.py\n定位到第 1444 行，将代码：\ndo_denormalize = [not has_nsfw for has_nsfw in has_nsfw_concept]\n修改为：\ndo_denormalize = [not has_nsfw_concept]","https:\u002F\u002Fgithub.com\u002Fallenai\u002Fvisprog\u002Fissues\u002F17",{"id":126,"question_zh":127,"answer_zh":128,"source_url":129},10999,"程序生成器有时会生成无效的编程指令（如调用不存在的模块），该如何处理？","这种情况偶尔会发生，建议采用以下几种策略处理：\n1. 在执行时使用 try-except 块捕获错误，将其计为失败，或在实际应用中回退到 VQA 模型。\n2. 优化程序生成的提示词（Prompt），添加可用函数列表或函数文档字符串，让模型更清楚可用的功能。\n3. 尝试生成多个程序方案，然后过滤掉调用无效模块的方案。","https:\u002F\u002Fgithub.com\u002Fallenai\u002Fvisprog\u002Fissues\u002F1",{"id":131,"question_zh":132,"answer_zh":133,"source_url":134},11000,"项目是否会发布自行标注的数据集（如图像编辑和事实知识对象标记数据）以便复现结果？","由于版权限制，作者无法发布自行标注的评估数据集以及从 GQA\u002FNLVRv2 中采样的子集。因此，用户无法直接获取这些数据来完全复现论文中的部分结果。","https:\u002F\u002Fgithub.com\u002Fallenai\u002Fvisprog\u002Fissues\u002F2",{"id":136,"question_zh":137,"answer_zh":138,"source_url":139},11002,"遇到 Torch 未编译启用 CUDA 的支持问题怎么办？","该问题通常是因为安装的 PyTorch 版本不包含 CUDA 支持。请检查您的 PyTorch 安装环境，确保下载并安装了带有 CUDA 支持的 PyTorch 版本（例如通过官网选择对应的 CUDA 版本进行安装），而不是仅支持 CPU 的版本。","https:\u002F\u002Fgithub.com\u002Fallenai\u002Fvisprog\u002Fissues\u002F12",[]]