Skip to content

Commit

Permalink
[Misc] Update config loading for Qwen2-VL and remove Granite (#8837)
Browse files Browse the repository at this point in the history
  • Loading branch information
ywang96 authored Sep 26, 2024
1 parent 7193774 commit 4bb98f2
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 224 deletions.
11 changes: 1 addition & 10 deletions docs/source/models/supported_models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ Multimodal Language Models
- :code:`Qwen/Qwen-VL`, :code:`Qwen/Qwen-VL-Chat`, etc.
-
* - :code:`Qwen2VLForConditionalGeneration`
- Qwen2-VL (see note)
- Qwen2-VL
- Image\ :sup:`+` / Video\ :sup:`+`
- :code:`Qwen/Qwen2-VL-2B-Instruct`, :code:`Qwen/Qwen2-VL-7B-Instruct`, :code:`Qwen/Qwen2-VL-72B-Instruct`, etc.
-
Expand All @@ -297,15 +297,6 @@ Multimodal Language Models
For :code:`openbmb/MiniCPM-V-2`, the official repo doesn't work yet, so we need to use a fork (:code:`HwwwH/MiniCPM-V-2`) for now.
For more details, please see: https://github.com/vllm-project/vllm/pull/4087#issuecomment-2250397630

.. note::
For :code:`Qwen2-VL`, the latest release of :code:`huggingface/transformers` doesn't work yet, so we need to use a developer version (:code:`21fac7abba2a37fae86106f87fcf9974fd1e3830`) for now.
This can be installed by running the following command:

.. code-block:: bash
pip install git+https://github.com/huggingface/transformers.git@21fac7abba2a37fae86106f87fcf9974fd1e3830
----

If your model uses one of the above model architectures, you can seamlessly run your model with vLLM.
Otherwise, please refer to :ref:`Adding a New Model <adding_a_new_model>` and :ref:`Enabling Multimodal Inputs <enabling_multimodal_inputs>`
Expand Down
2 changes: 1 addition & 1 deletion vllm/model_executor/models/granite.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import torch
from torch import nn
from transformers import GraniteConfig

from vllm.attention import Attention, AttentionMetadata
from vllm.config import CacheConfig, LoRAConfig
Expand All @@ -48,7 +49,6 @@
default_weight_loader, kv_cache_scales_loader, maybe_remap_kv_scale_name)
from vllm.model_executor.sampling_metadata import SamplingMetadata
from vllm.sequence import IntermediateTensors
from vllm.transformers_utils.configs.granite import GraniteConfig
from vllm.utils import is_hip

from .interfaces import SupportsLoRA
Expand Down
5 changes: 2 additions & 3 deletions vllm/model_executor/models/qwen2_vl.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,9 @@
import torch.nn.functional as F
from einops import rearrange, repeat
from PIL import Image
from transformers import Qwen2VLConfig
from transformers.image_utils import (get_image_size,
infer_channel_dimension_format,
to_numpy_array)
from transformers.models.qwen2_vl.configuration_qwen2_vl import (
Qwen2VLVisionConfig)
from transformers.models.qwen2_vl.image_processing_qwen2_vl import (
make_batched_images, make_batched_videos, smart_resize)

Expand Down Expand Up @@ -66,6 +63,8 @@
from vllm.multimodal.image import cached_get_image_processor
from vllm.platforms import current_platform
from vllm.sequence import IntermediateTensors, SequenceData
from vllm.transformers_utils.configs.qwen2vl import (Qwen2VLConfig,
Qwen2VLVisionConfig)
from vllm.transformers_utils.processor import get_processor
from vllm.utils import is_cpu

Expand Down
12 changes: 5 additions & 7 deletions vllm/transformers_utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
# yapf: disable
from vllm.transformers_utils.configs import (ChatGLMConfig, DbrxConfig,
EAGLEConfig, ExaoneConfig,
GraniteConfig, InternVLChatConfig,
JAISConfig, MedusaConfig,
MllamaConfig, MLPSpeculatorConfig,
MPTConfig, NemotronConfig,
InternVLChatConfig, JAISConfig,
MedusaConfig, MllamaConfig,
MLPSpeculatorConfig, MPTConfig,
NemotronConfig, Qwen2VLConfig,
RWConfig, SolarConfig,
UltravoxConfig)
# yapf: enable
Expand Down Expand Up @@ -57,9 +57,7 @@
"nemotron": NemotronConfig,
"solar": SolarConfig,
"ultravox": UltravoxConfig,
# Granite can be removed from here once we have upgraded to
# transformers 4.45+
"granite": GraniteConfig,
"qwen2_vl": Qwen2VLConfig,
**_CONFIG_REGISTRY_OVERRIDE_HF
}

Expand Down
8 changes: 4 additions & 4 deletions vllm/transformers_utils/configs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
# tiiuae/falcon-7b(-instruct) models. Newer Falcon models will use the
# `FalconConfig` class from the official HuggingFace transformers library.
from vllm.transformers_utils.configs.falcon import RWConfig
from vllm.transformers_utils.configs.granite import GraniteConfig
from vllm.transformers_utils.configs.internvl import InternVLChatConfig
from vllm.transformers_utils.configs.jais import JAISConfig
from vllm.transformers_utils.configs.medusa import MedusaConfig
from vllm.transformers_utils.configs.mllama import MllamaConfig
from vllm.transformers_utils.configs.mlp_speculator import MLPSpeculatorConfig
from vllm.transformers_utils.configs.mpt import MPTConfig
from vllm.transformers_utils.configs.nemotron import NemotronConfig
from vllm.transformers_utils.configs.qwen2vl import (Qwen2VLConfig,
Qwen2VLVisionConfig)
from vllm.transformers_utils.configs.solar import SolarConfig
from vllm.transformers_utils.configs.ultravox import UltravoxConfig

Expand All @@ -32,7 +33,6 @@
"NemotronConfig",
"SolarConfig",
"UltravoxConfig",
# Granite can be removed from here once we have upgraded to
# transformers 4.45+
"GraniteConfig",
"Qwen2VLConfig",
"Qwen2VLVisionConfig",
]
199 changes: 0 additions & 199 deletions vllm/transformers_utils/configs/granite.py

This file was deleted.

Loading

0 comments on commit 4bb98f2

Please sign in to comment.