Reduce AutoWeightsLoader kwargs (#53106)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
Harry Mellor
2026-08-20 15:40:11 +00:00
committed by GitHub
parent 2dd17225c6
commit 1fe3a1571a
84 changed files with 577 additions and 568 deletions
+11 -3
View File
@@ -71,7 +71,12 @@ from .minicpmv import (
MiniCPMVProcessingInfo,
_minicpmv_field_config,
)
from .utils import AutoWeightsLoader, cast_overflow_tensors, maybe_prefix
from .utils import (
AutoWeightsLoader,
WeightsMapper,
cast_overflow_tensors,
maybe_prefix,
)
CPU_DEVICE = torch.device("cpu")
@@ -672,6 +677,9 @@ class MiniCPMWhisperEncoder(WhisperEncoder):
class MiniCPMOBaseModel:
"""Base mixin class for MiniCPM-O models with audio support."""
# Unlike the vision-only MiniCPM-V models, audio weights are loaded here.
hf_to_vllm_mapper = WeightsMapper(orig_to_new_prefix={"tts": None})
packed_modules_mapping = {
"qkv_proj": [
"q_proj",
@@ -718,8 +726,8 @@ class MiniCPMOBaseModel:
return model
def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]) -> set[str]:
loader = AutoWeightsLoader(self, skip_prefixes=["tts"])
loaded = loader.load_weights(weights)
loader = AutoWeightsLoader(self)
loaded = loader.load_weights(weights, mapper=self.hf_to_vllm_mapper)
self._ensure_resampler_device()
return loaded