
SWE-agent 多模态运行中 Issue 图片未被处理怎么排查【免费下载链接】SWE-agentSWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]项目地址: https://gitcode.com/GitHub_Trending/sw/SWE-agent用 SWE-agent 跑 SWE-bench Multimodal 实例时预期行为是Issue 中的截图、UI 草图等图片会被下载、转成 base64 markdown随problem_statement一起发给多模态模型。但图片处理失败时SWE-agent 并不会中断运行——它会记一条 warning 并回退到纯文本模式继续跑见 docs/usage/multimodal.md 中 Handles errors gracefully with fallback to text-only processing。所以图片没被处理最常见的表现是任务正常完成只是模型只看到了文字。排查前先明确正常链路长什么样后面每一步检查都对应链路上的一环数据集princeton-nlp/SWE-Bench_Multimodal中的实例带有image_assets字段加载时取其中的problem_statement子项作为图片 URL 列表sweagent/run/batch_instances.py中from_swe_bench带图片的实例被构造为SWEBenchMultimodalProblemStatement运行时逐张下载图片并转成url形式追加到文本后面sweagent/agent/problem_statement.py配置中的image_parsinghistory processor 再把 observation 里的 base64 markdown 解析成多模态消息段模型必须是视觉模型才能消费这些图片段。下面按配置 → 实例数据 → 模型 → 单张图片下载四个方向逐项排查。检查一是否使用了多模态配置图片处理依赖三处配置缺一不可可以直接对照仓库自带的 config/default_mm_with_images.yamlagent.templates.disable_image_processing: false注意 config/default_mm_no_images.yaml 里是true用错配置就会整体禁用agent.history_processors中包含- type: image_parsing用于把 base64 编码图片解析进 observationagent.tools.bundles中包含tools/image_tools让模型可以打开图片文件。对应的启动命令来自 docs/usage/multimodal.mdsweagent run-batch \ --config config/default_mm_with_images.yaml \ --instances.type swe_bench \ --instances.subset multimodal \ --instances.split dev其中instances.subset multimodal会加载princeton-nlp/SWE-Bench_Multimodal数据集。如果你在自己的 YAML 里写了disable_image_processing: true或在命令行传了--agent.templates.disable_image_processingtrue图片处理会被整体跳过此时日志会出现Image processing disabled, returning text-only problem statement看到这行日志即可确认是配置禁用了图片处理而不是下载失败。另外按文档说明当你显式使用--instances.typeswe-bench --instances.subsetmultimodal时多模态处理是自动启用的只有设置disable_image_processingtrue才会关闭。检查二实例本身是否带图片多模态处理只作用于problem_statement类别的图片截图、UI 稿、示意图、报错截图等。这是文档明确的设计选择patch和test_patch类别的图片可能包含解题线索因此不被处理。如果你的实例图片只在这两类里没被处理是预期行为不是故障。同时只有实例数据里带image_assets字段时才会构造带图片的 problem statement不带该字段的实例按纯文本TextProblemStatement处理整条图片链路根本不会触发。文档给出的带图实例示例结构示例结果字段值以实际数据集为准{ instance_id: example__repo-123, problem_statement: Fix the chart rendering bug..., image_assets: { problem_statement: [http://example.com/chart.png] } }排查时可以先确认自己跑的实例属于multimodal子集并且其image_assets.problem_statement非空。检查三模型是否为视觉模型图片段只有发给视觉模型才有意义。docs/usage/multimodal.md 列举的可用模型示例包括 Claude Sonnet 4、o3、o4-mini 和 Gemini 2.5 系列docs/faq.md 中还提到 GPT-4o。如果你当前模型不支持图像输入图片即便成功转码也不会被看见需要换用上述文档列出的视觉模型。检查四单张图片的下载失败看 warning 日志SWEBenchMultimodalProblemStatement对每张图片独立处理失败时记一条 warning 并跳过该图其余图片继续。sweagent/agent/problem_statement.py 中定义了以下可核对的日志{url}为实例中的图片地址日志内容含义Successfully processed image from {url} (N bytes, image/png)该图处理成功日志示例格式Invalid URL format: {url}URL 缺少 scheme 或主机名Unsupported image MIME type {content_type} for URL: {url}. Not encoding image.服务端返回的类型不在支持范围image/png、image/jpeg、image/webpimage/jpg会被归一化为image/jpegImage too large ({n} bytes) for URL: {url}图片超过 10MB 上限content-length 头部或实际下载流任一超界都会触发Empty image data for URL: {url}下载内容为空Timeout downloading image from {url}下载超时请求 timeout 为 30 秒Network error downloading image from {url}: {e}网络错误需检查运行环境到图片 URL 的连通性Unexpected error processing image from {url}: {e}其他未归类异常docs/faq.md 对 Why are my images not being processed? 给出的官方排查要点与此一致确认使用多模态配置如default_mm_with_images.yaml、有互联网连通性、单张图片小于 10MB。结果验证与一个常见误判看到Successfully processed image from {url} (...)即代表该图已转码并入 problem statement看到上表任一条 warning 即代表该图被跳过运行会以纯文本继续。还有一个容易误判的边界图片只进入模型的提示词不会进入容器环境。get_problem_statement_for_env固定返回不含图片的纯文本源码注释为 Images are not supported in the environment见 sweagent/agent/problem_statement.py。因此容器里看不到图片文件不代表图片处理失败。如果排查后发现确实不需要处理图片可选方案是直接改用 config/default_mm_no_images.yamldisable_image_processing: true且未启用image_parsing或在实例级别通过SWEBenchMultimodalProblemStatement(disable_image_processingTrue)跳过单实例的图片处理两者用法见 docs/usage/multimodal.md。【免费下载链接】SWE-agentSWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]项目地址: https://gitcode.com/GitHub_Trending/sw/SWE-agent创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考