-
Notifications
You must be signed in to change notification settings - Fork 572
添加多图训练和推理过程 #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
添加多图训练和推理过程 #19
Conversation
update readme
|
训练数据集以及部分文件已放入Huggingface。后续也会持续更新。 |
|
@xinyanghuang7 由于体量不小,review了一大会儿 现在有几个地方需要确认一下: 1.注意到 2.
# 如果此时有图像编码
if image_encoders is not None:
vision_proj = self.vision_proj(image_encoders)
vision_proj = vision_proj.unsqueeze(0) if len(vision_proj.shape) == 3 else vision_proj
if image_indices is not None:
# 创建一个新的张量来存储拼接后的结果
new_h = []
for i in range(h.size(0)):
# i即为current_batch_idx索引
img_idx = 0
for batch_idx, start_idx, end_idx in image_indices:
if batch_idx == i:
# 插入vision_proj特征
before = h[i][:start_idx, :]
after = h[i][end_idx + 1:, :]
# 拼接 before, vision_proj, after
h[i] = torch.cat((before, vision_proj[i][img_idx], after), dim=0)[:seqlen]
img_idx += 1
new_h.append(h[i])
# 将所有拼接后的结果重新堆叠起来
new_h = torch.stack(new_h, dim=0) # torch.Size([32, 511, 512])
return new_h3.① readme中有一些冲突标记可能忘记被解决 4.由于PR包含新模型的训练,因此训练过程/数据集/效果评估等我不做新的复现 完成以上后会马上merge此PR,期待进一步交流,谢谢!!! |
|
非常感谢您的及时回复以及建议! multi-images training 1.0目前已经根据您的建议修改了大部分内容,辛苦您再次审阅。 后续会逐步添加预训练的权重和更详细的评估分析。 感谢您的认可! 期待和您以后更多的交流! |
jingyaogong
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good
非常感谢您实现了这个精彩的仓库。
我希望在您的基础上添加一些小功能,共同维护这个仓库,同时也推动我了解和学习多模态大模型的知识。
这次更新添加了在新的数据集上进行多图训练和推理的过程。
主要就是添加了dataloader和修改了模型替换图像标识符的策略。
虽然效果很一般,但我希望能为多图推理训练提供一种思路。
后续也希望和您一起不断完善这个仓库,共同维护和优化。
如果您对我有任何建议,您可以随时联系我,我会给你及时的回复。