Skip to content

Commit

Permalink
[Model] Support Qwen-VL and Qwen-VL-Chat models with text-only inputs (
Browse files Browse the repository at this point in the history
…vllm-project#5710)

Co-authored-by: Roger Wang <[email protected]>
  • Loading branch information
2 people authored and jimpang committed Jul 8, 2024
1 parent 6c14283 commit 5216b0d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions vllm/model_executor/models/qwen.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from vllm.model_executor.model_loader.weight_utils import default_weight_loader
from vllm.model_executor.sampling_metadata import SamplingMetadata
from vllm.sequence import SamplerOutput
from vllm.utils import print_warning_once


class QWenMLP(nn.Module):
Expand Down Expand Up @@ -288,6 +289,15 @@ def load_weights(self, weights: Iterable[Tuple[str, torch.Tensor]]):
# Skip loading extra bias for GPTQ models.
if name.endswith(".bias") and name not in params_dict:
continue
# Skip loading visual weights to support Qwen-VL models
# in cases with text-only inputs
# TODO: add support for Qwen-VL
if (name not in params_dict
and name.startswith("transformer.visual.")):
print_warning_once(
"Only text inputs are allowed. Images won't be handled "
"until Qwen-VL models are fully supported.")
continue
param = params_dict[name]
weight_loader = getattr(param, "weight_loader",
default_weight_loader)
Expand Down

0 comments on commit 5216b0d

Please sign in to comment.