From f4fd390f5de585fd94877158bea4e1b2d1920df3 Mon Sep 17 00:00:00 2001 From: Michael Goin Date: Thu, 1 Aug 2024 15:01:07 -0400 Subject: [PATCH] [Bugfix] Lower gemma's unloaded_params exception to warning (#7002) --- vllm/model_executor/models/gemma.py | 6 +++--- vllm/model_executor/models/gemma2.py | 9 ++++++--- vllm/model_executor/models/paligemma.py | 6 +++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/vllm/model_executor/models/gemma.py b/vllm/model_executor/models/gemma.py index 7e0888b5..64aef102 100644 --- a/vllm/model_executor/models/gemma.py +++ b/vllm/model_executor/models/gemma.py @@ -404,6 +404,6 @@ class GemmaForCausalLM(nn.Module, SupportsLoRA): loaded_params.add(name) unloaded_params = params_dict.keys() - loaded_params if unloaded_params: - raise RuntimeError( - "Some weights are not initialized from checkpoints: " - f"{unloaded_params}") + logger.warning( + "Some weights are not initialized from checkpoints: %s", + unloaded_params) diff --git a/vllm/model_executor/models/gemma2.py b/vllm/model_executor/models/gemma2.py index 8386084c..b77c901f 100644 --- a/vllm/model_executor/models/gemma2.py +++ b/vllm/model_executor/models/gemma2.py @@ -23,6 +23,7 @@ from transformers import Gemma2Config from vllm.attention import Attention, AttentionMetadata from vllm.config import CacheConfig, LoRAConfig from vllm.distributed import get_tensor_model_parallel_world_size +from vllm.logger import init_logger from vllm.model_executor.layers.activation import GeluAndMul from vllm.model_executor.layers.layernorm import GemmaRMSNorm from vllm.model_executor.layers.linear import (MergedColumnParallelLinear, @@ -41,6 +42,8 @@ from vllm.sequence import IntermediateTensors, SamplerOutput from .interfaces import SupportsLoRA +logger = init_logger(__name__) + class Gemma2MLP(nn.Module): @@ -390,6 +393,6 @@ class Gemma2ForCausalLM(nn.Module, SupportsLoRA): unloaded_params = params_dict.keys() - loaded_params if unloaded_params: - raise RuntimeError( - "Some weights are not initialized from checkpoints: " - f"{unloaded_params}") + logger.warning( + "Some weights are not initialized from checkpoints: %s", + unloaded_params) diff --git a/vllm/model_executor/models/paligemma.py b/vllm/model_executor/models/paligemma.py index 2af48b6b..fe91611c 100644 --- a/vllm/model_executor/models/paligemma.py +++ b/vllm/model_executor/models/paligemma.py @@ -342,6 +342,6 @@ class PaliGemmaForConditionalGeneration(nn.Module, SupportsVision): unloaded_params = params_dict.keys() - loaded_params if unloaded_params: - raise RuntimeError( - "Some weights are not initialized from checkpoints: " - f"{unloaded_params}") + logger.warning( + "Some weights are not initialized from checkpoints: %s", + unloaded_params)