- 系统&软件:Ubuntu 20.04 + GTX 3090 + CUDA 11.8 + Python 3.10
安装以下依赖库
accelerate==1.4.0
aiohappyeyeballs==2.4.6
aiohttp==3.11.13
aiosignal==1.3.2
async-timeout==5.0.1
attrs==25.1.0
av==14.2.0
certifi==2025.1.31
charset-normalizer==3.4.1
datasets==3.3.2
decord==0.6.0
device-smi==0.4.0
dill==0.3.8
einops==0.8.1
filelock==3.17.0
flash-attn==2.7.3 # flash_attn-2.7.3+cu11torch2.4cxx11abiFALSE-cp310-cp310-linux_x86_64.whl
frozenlist==1.5.0
fsspec==2024.12.0
gptqmodel==1.9.0+cu118torch2.4 # gptqmodel-1.9.0+cu118torch2.4-cp310-cp310-linux_x86_64.whl
huggingface-hub==0.29.1
idna==3.10
Jinja2==3.1.5
MarkupSafe==3.0.2
mpmath==1.3.0
multidict==6.1.0
multiprocess==0.70.16
networkx==3.4.2
numpy==2.2.3
nvidia-cublas-cu11==11.11.3.6
nvidia-cuda-cupti-cu11==11.8.87
nvidia-cuda-nvrtc-cu11==11.8.89
nvidia-cuda-runtime-cu11==11.8.89
nvidia-cudnn-cu11==9.1.0.70
nvidia-cufft-cu11==10.9.0.58
nvidia-curand-cu11==10.3.0.86
nvidia-cusolver-cu11==11.4.1.48
nvidia-cusparse-cu11==11.7.5.86
nvidia-nccl-cu11==2.20.5
nvidia-nvtx-cu11==11.8.86
optimum==1.24.0
packaging==24.2
pandas==2.2.3
pillow==11.1.0
propcache==0.3.0
psutil==7.0.0
pyarrow==19.0.1
python-dateutil==2.9.0.post0
pytz==2025.1
PyYAML==6.0.2
qwen-vl-utils==0.0.8
regex==2024.11.6
requests==2.32.3
safetensors==0.5.3
six==1.17.0
sympy==1.13.3
threadpoolctl==3.5.0
tokenicer==0.0.4
tokenizers==0.21.0
torch==2.4.1+cu118 # torch-2.4.1+cu118-cp310-cp310-linux_x86_64.whl
torchaudio=2.4.1+cu118 # torchaudio-2.4.1+cu118-cp310-cp310-linux_x86_64.whl
torchvision=0.19.1+cu118 # torchvision-0.19.1+cu118-cp310-cp310-linux_x86_64.whl
tqdm==4.67.1
transformers==4.49.0
triton==3.0.0
typing_extensions==4.12.2
tzdata==2025.1
urllib3==2.3.0
xxhash==3.5.0
yarl==1.18.3
diff --git a/gptqmodel/models/_const.py b/gptqmodel/models/_const.py
index 08341897..c851d3f0 100644
--- a/gptqmodel/models/_const.py
+++ b/gptqmodel/models/_const.py
@@ -160,6 +160,7 @@ SUPPORTED_MODELS = [
"minicpm3",
"qwen2_moe",
"qwen2_vl",
+ "qwen2_5_vl",
"dbrx_converted",
"deepseek_v2",
"deepseek_v3",
diff --git a/gptqmodel/models/auto.py b/gptqmodel/models/auto.py
index 1a5bd65c..6dd7f949 100644
--- a/gptqmodel/models/auto.py
+++ b/gptqmodel/models/auto.py
@@ -100,6 +100,7 @@ from .definitions.qwen import QwenGPTQ # noqa: E402
from .definitions.qwen2 import Qwen2GPTQ # noqa: E402
from .definitions.qwen2_moe import Qwen2MoeGPTQ # noqa: E402
from .definitions.qwen2_vl import Qwen2VLGPTQ # noqa: E402
+from .definitions.qwen2_5_vl import Qwen2_5_VLGPTQ # noqa: E402
from .definitions.rw import RWGPTQ # noqa: E402
from .definitions.stablelmepoch import StableLMEpochGPTQ # noqa: E402
from .definitions.starcoder2 import Starcoder2GPTQ # noqa: E402
@@ -153,6 +154,7 @@ MODEL_MAP = {
"minicpm3": MiniCPM3GPTQ,
"qwen2_moe": Qwen2MoeGPTQ,
"qwen2_vl": Qwen2VLGPTQ,
+ "qwen2_5_vl": Qwen2_5_VLGPTQ,
"dbrx": DbrxGPTQ,
"dbrx_converted": DbrxConvertedGPTQ,
"deepseek_v2": DeepSeekV2GPTQ,
diff --git a/gptqmodel/models/definitions/__init__.py b/gptqmodel/models/definitions/__init__.py
index 922e15b4..1ce3bc9d 100644
--- a/gptqmodel/models/definitions/__init__.py
+++ b/gptqmodel/models/definitions/__init__.py
@@ -56,6 +56,7 @@ from .qwen import QwenGPTQ
from .qwen2 import Qwen2GPTQ
from .qwen2_moe import Qwen2MoeGPTQ
from .qwen2_vl import Qwen2VLGPTQ
+from .qwen2_5_vl import Qwen2_5_VLGPTQ
from .rw import RWGPTQ
from .stablelmepoch import StableLMEpochGPTQ
from .starcoder2 import Starcoder2GPTQ
diff --git a/tests/models/ovis/image_to_test_dataset.py b/tests/models/ovis/image_to_test_dataset.py
index 63ad09b0..e8daa43b 100644
## 以下只针对GPTQModel v1.9.0的源码
--- a/tests/models/ovis/image_to_test_dataset.py
+++ b/tests/models/ovis/image_to_test_dataset.py
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from gptqmodel.models import OvisGPTQ, Qwen2VLGPTQ
+from gptqmodel.models import OvisGPTQ, Qwen2VLGPTQ, Qwen2_5_VLGPTQ
def format_ovis_dataset(image, assistant):
@@ -65,4 +65,7 @@ def get_calib_dataset(model):
if isinstance(model, Qwen2VLGPTQ):
return prepare_dataset(format_qwen2_vl_dataset, n_sample=1)
+ if isinstance(model, Qwen2_5_VLGPTQ):
+ return prepare_dataset(format_qwen2_vl_dataset, n_sample=1)
+
raise NotImplementedError(f"Unsupported MODEL: {model.__class__}")
将qwen2_5_vl.py
拷贝到XXXXX/python3.10/site-packages/gptqmodel/models/definitions
目录下面
- 量化数据
coco2017
├── val2017
├── val.csv
其中val.csv
内容如下:
...
val2017/000000037777.jpg,"a kitchen with wooden cabinets on the walls, a stove, multiple drawers, a refrigerator, a counter with fruits, and a well-organized layout for cooking and storage needs."
val2017/000000087038.jpg, "multiple people wearing sweatshirts, a person on a bicycle performing tricks, and another person mid-jump off a skateboarding ramp. The backdrop consists of buildings with graffiti artworks, adding a vibrant feel to the urban setting. The image appears to be set in an urban skate park or a designated area for extreme sports within a city."
...
- 开始量化
python quant_qwenvl_gptqmodel.py Qwen/Qwen2.5-VL-3B-Instruct 8 dataset/coco2017/val.csv
python demo_qwen_vl.py Qwen/Qwen2.5-VL-3B-Instruct-GPTQModel-jnulzl-int4
qwen2_5_vl-py基于qwen2_vl.py略微修改而来