Skip to content

Conversation

@zsxm1998
Copy link
Contributor

@zsxm1998 zsxm1998 commented Mar 26, 2025

PR type

  • Bug Fix
  • New Feature
  • Document Updates
  • More Models or Datasets Support

PR information

在一次GRPO训练中程序意外中断于 此处,原因是模型生成了<img>乱七八糟的内容</img>这样的文本,_replace_image_tags函数未加检查地错误地提取了其中内容,然后和数据中原始的images冲突。

本次PR更新了_replace_image_tags,主要实现两个逻辑。

  1. <img></img>包裹的内容进行判断,若为合法的图像(如url、本地路径、base64等),才提取并compat <img></img><image>,否则不处理。
  2. 在原来有<image> tag且inputs.images有相应图像的情况下,保证<img></img>插入inputs.images的正确位置。

Experiment results

经过测试可以忽略<img></img>内非图片内容,且对后续<image>和image文件的处理没有影响,能够正常训练。

原始数据中若inputs.images和<image>数量匹配,则没有问题。若inputs.images数量比原始<image>多,则由后续_add_default_tags函数处理。若inputs.images数量比原始<image>少,且在有效<img></img>前面有没有图像对应的<image> tag,则会造成图像错位,但实际上可能会因为最终<image>和inputs.images数量不匹配,在后续模型中报错(如llava)。

@Jintao-Huang
Copy link
Collaborator

感谢PR,这个问题我想个别的方法修复一下❤️

@Jintao-Huang
Copy link
Collaborator

该问题将在这个PR中被修复:#3704

@zsxm1998
Copy link
Contributor Author

okok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants