LightCompress icon indicating copy to clipboard operation
LightCompress copied to clipboard

使用Qwen2.5-VL时模型属性不对应的问题

Open EustiaAstraea opened this issue 4 months ago • 1 comments

试了一下在qwen2.5模型上用visionzip方法校准自定义数据集,

脚本运行后报错AttributeError: 'Qwen2_5_VLModel' object has no attribute 'layers'

看了一下代码,项目model里的qwen2.5VL没有def find_blocks,是继承qwen2VL的,而qwen2VL的find_blocks在接入language 时,继承的是qwen2的方法。

qwen2的find_blocks调用的是self.model.model.layers ,而 https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py 的代码中的模型结构不一样,self.model.model 是 class Qwen2_5_VLModel 的attribute,再往下还有一个 class Qwen2_5_VLTextModel ,这个 class 才有 layer。不知道是不是这个问题?

试图修改代码,在qwen2.5VL的代码中定义一个新的self.blocks = self.model.model.language_model.layers,但继续运行脚本还是会碰到其他embed_tokens等等一系列的AttributeError问题,是否是普遍情况呢?

EustiaAstraea avatar Aug 20 '25 16:08 EustiaAstraea

同问

fengdifu24 avatar Nov 15 '25 11:11 fengdifu24