InternVL
InternVL copied to clipboard
image_flags 的作用
请问modeling文件中的
`
image_flags = image_flags.squeeze(-1)
input_embeds = self.language_model.get_input_embeddings()(input_ids).clone()
vit_embeds = self.extract_feature(pixel_values)
vit_embeds = vit_embeds[image_flags == 1]
vit_batch_size = pixel_values.shape[0]
vit_embeds = vit_embeds[image_flags == 1]的作用是什么呢
训练过程中为了保证ViT部分总是能有梯度(否则参数更新时做通信时会卡住),我们会给纯文本数据补一张空白图像(当然这张图像不会真的输入给LLM),从而在纯文本数据上,ViT部分可以有一个全0的梯度,这里的image_flags就是为了抽出这些空白图像,防止输入给LLM