Skip to content

qwen2-vl 系列无法awq量化 #2649

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

Closed
kratorado opened this issue Dec 13, 2024 · 5 comments
Closed

qwen2-vl 系列无法awq量化 #2649

kratorado opened this issue Dec 13, 2024 · 5 comments

Comments

@kratorado
Copy link

Describe the feature
Please describe the feature requested here(请在这里描述需求)
尝试对finetune后的qwen2-vl-7b-instruct进行awq量化,会报错。错误信息见下方

Paste any useful information
Paste any useful information, including papers, github links, etc.(请在这里描述其他有用的信息,比如相关的论文地址,github链接等)

  File "/data/admin/work/swift-training/swift/swift/cli/export.py", line 5, in <module>
    export_main()
  File "/data/admin/work/swift-training/swift/swift/llm/export/export.py", line 40, in export_main
    return SwiftExport(args).main()
  File "/data/admin/work/swift-training/swift/swift/llm/base.py", line 45, in main
    result = self.run()
  File "/data/admin/work/swift-training/swift/swift/llm/export/export.py", line 25, in run
    quantize_model(args)
  File "/data/admin/work/swift-training/swift/swift/llm/export/quant.py", line 197, in quantize_model
    QuantEngine(args).quantize()
  File "/data/admin/work/swift-training/swift/swift/llm/export/quant.py", line 24, in __init__
    pt_engine, self.template = prepare_pt_engine_template(args, **kwargs)
  File "/data/admin/work/swift-training/swift/swift/llm/infer/utils.py", line 160, in prepare_pt_engine_template
    pt_engine: PtEngine = SwiftInfer.get_infer_engine(args, infer_backend='pt', load_model=load_model, **kwargs)
  File "/data/admin/work/swift-training/swift/swift/llm/infer/infer.py", line 70, in get_infer_engine
    return infer_engine_cls(**kwargs)
  File "/data/admin/work/swift-training/swift/swift/llm/infer/infer_engine/pt_engine.py", line 58, in __init__
    self.model, self.processor = get_model_tokenizer(
  File "/data/admin/work/swift-training/swift/swift/llm/model/register.py", line 494, in get_model_tokenizer
    model, processor = get_function(model_dir, model_info, model_kwargs, load_model, **kwargs)
  File "/data/admin/work/swift-training/swift/swift/llm/model/model/qwen.py", line 499, in get_model_tokenizer_qwen2_vl
    patch_output_clone(model.model.embed_tokens)
  File "/home/admin/miniconda3/envs/swift/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1729, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'Qwen2VLForConditionalGeneration' object has no attribute 'embed_tokens'

Additional context
Add any other context or information here(其他信息可以写在这里)
涉及到的包版本:

swift==git+https://github.com/modelscope/swift.git@66484498f8f3fab31ab5274da1b189a6b59a4dd6#egg=ms_swift
autoawq==0.2.7.post2
autoawq_kernels==0.0.7
transformers==4.47.0

查看了transformers的相应的源码,Qwen2VLForConditionalGeneration确实是没有embed_tokens这个属性的,倒是在 self.model 下有一个,也就是 Qwen2VLModel 有这个属性,不知道嫁接过去能不能行。

另外,qwen2-vl系列是有官方awq量化的,那他们是怎么做的呢

@Jintao-Huang
Copy link
Collaborator

试试gptq呗 我也没跑通

@kratorado
Copy link
Author

试试gptq呗 我也没跑通

行吧

@yfllllll
Copy link

@kratorado 请问你解决了吗

@kratorado
Copy link
Author

@kratorado 请问你解决了吗

没有

@dhhcj1
Copy link

dhhcj1 commented Dec 24, 2024

好像本身就不支持awq, gptq 没问题

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

5 participants