testing dynamic register

This commit is contained in:
Chranos
2026-02-05 18:08:05 +08:00
parent 83c958a7c5
commit 70bee4e3ec

View File

@@ -176,14 +176,9 @@ class Base(nn.Module):
} }
) )
def __init_subclass__(cls, *args, **kwargs): # Note: __init_subclass__ with WeightsMapper merging is not supported in v0.6.2
"""Merge hf_to_vllm_mapper in MRO from most specific to least specific.""" # because WeightsMapper doesn't implement __or__/__ior__ operators.
super().__init_subclass__(*args, **kwargs) # Each Mixin should define its own hf_to_vllm_mapper if needed.
hf_to_vllm_mapper = WeightsMapper()
for base in cls.__mro__:
if base_hf_to_vllm_mapper := getattr(base, "hf_to_vllm_mapper", None):
hf_to_vllm_mapper |= base_hf_to_vllm_mapper
cls.hf_to_vllm_mapper = hf_to_vllm_mapper
def __init__(self, *, vllm_config: VllmConfig, prefix: str = "") -> None: def __init__(self, *, vllm_config: VllmConfig, prefix: str = "") -> None:
super().__init__() super().__init__()