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

qwen2 vl gdq量化失败,报错 ERROR: Catch exception when Optimizing model: 'input' #159

Open
lijianxing123 opened this issue Jan 25, 2025 · 1 comment

Comments

@lijianxing123
Copy link

lijianxing123 commented Jan 25, 2025

按照教程构建input.json 数据集,进行gdq 量化,报错,
INFO: PyTorch version 2.4.0 available. INFO: rkllm-toolkit version: 1.1.4 The argument trust_remote_codeis to be used with Auto classes. It has no effect here and is ignored.Qwen2VLRotaryEmbeddingcan now be fully parameterized by passing the model config through theconfig argument. All other arguments will be removed in v4.46 Loading checkpoint shards: 100%|██████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 2.55it/s] WARNING: rkllm-toolkit only exports the language model of Qwen2VL! Building model: 100%|█████████████████████████████████████████████████████████████████████████████████████████| 399/399 [00:10<00:00, 37.93it/s] ERROR: Catch exception when Optimizing model: 'input' Build model failed!

以下为量化代码
`import os
from rkllm.api import RKLLM
from datasets import load_dataset
from transformers import AutoTokenizer
from tqdm import tqdm
import torch
from torch import nn

modelpath = "../../../Qwen2-VL-2B-Instruct"
savepath = './Qwen2-VL-2B-Instruct.rkllm'
llm = RKLLM()

ret = llm.load_huggingface(model=modelpath, device='cuda')
if ret != 0:
print('Load model failed!')
exit(ret)

dataset = 'data/inputs.json'

qparams = None
ret = llm.build(do_quantization=True, optimization_level=1, quantized_dtype='w4a16_g64',
quantized_algorithm='gdq', target_platform='rk3576', num_npu_core=2, extra_qparams=qparams, dataset=dataset)

if ret != 0:
print('Build model failed!')
exit(ret)

ret = llm.export_rkllm(savepath)
if ret != 0:
print('Export model failed!')
exit(ret)`

@waydong
Copy link
Collaborator

waydong commented Feb 2, 2025

Hi, 可以把quantized_algorithm改成normal试试。

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