Skip to content
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

微调internXC2报错 #7

Open
yuzeng0-0 opened this issue Jun 12, 2024 · 9 comments
Open

微调internXC2报错 #7

yuzeng0-0 opened this issue Jun 12, 2024 · 9 comments

Comments

@yuzeng0-0
Copy link

File "/home/ma-user/anaconda3/envs/dpo/lib/python3.10/site-packages/transformers/configuration_utils.py", line 264, in getattribute
return super().getattribute(key)
AttributeError: 'InternLMXcomposer2Config' object has no attribute 'image_token_index'

@TideDra
Copy link
Owner

TideDra commented Jun 12, 2024

我们的实现方法加入了单独的image token标记图片位置,这在原模型中是没有的。您需要在模型的config.py文件中添加"image_token_index":92544

@yuzeng0-0
Copy link
Author

感谢

@yuzeng0-0
Copy link
Author

File "/cache/zy/VL-RLHF/src/vlrlhf/models/InternLMXC2/init.py", line 87, in _merge_input_ids_with_image_features
raise ValueError(
ValueError: The input provided to the model are wrong. The number of image tokens is 2 while the number of image given to the model is 2. This prevents correct indexing and breaks batch generation.这个怎么解决

@yuzeng0-0
Copy link
Author

File "/cache/zy/VL-RLHF/src/vlrlhf/models/InternLMXC2/init.py", line 87, in _merge_input_ids_with_image_features raise ValueError( ValueError: The input provided to the model are wrong. The number of image tokens is 2 while the number of image given to the model is 2. This prevents correct indexing and breaks batch generation.这个怎么解决
if image_to_overwrite.sum() != image_features.shape[:-1].numel():条件判断raise ValueError

@TideDra
Copy link
Owner

TideDra commented Jun 12, 2024

我们统一用<image>作为image token,请检查下输入文本中image token的总数量与输入图片的总数量是否一致

@yuzeng0-0
Copy link
Author

我们统一用<image>作为image token,请检查下输入文本中image token的总数量与输入图片的总数量是否一致这个是没问题的。
我猜测是padding的问题,internXC2的pad_token_id是2,对应embedding为零向量,在执行final_embedding[image_to_overwrite] = image_features.contiguous().reshape(-1, embed_dim).to(target_device)的时候报错

@yuzeng0-0
Copy link
Author

方便展示一下internXC2模型的config.py文件吗

@TideDra
Copy link
Owner

TideDra commented Jun 13, 2024

方便展示一下internXC2模型的config.py文件吗

可以参考我们放出的checkpoint: https://huggingface.co/TideDra/internlm-xcomposer2-vl-7b-DPO/blob/main/config.json

@yuzeng0-0
Copy link
Author

internXC2 的DPO代码还是跑不起来,您确定repo里是最新版本的代码吗?是不是repo是之前的版本导致有些bug没有修复

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

No branches or pull requests

2 participants