[Model][LoRA] Enable LoRA support for ModernBertModel (#57148)

Signed-off-by: linitra24 <renshuang.zhou@daocloud.io>
This commit is contained in:
linitra24
2026-09-16 14:16:09 +00:00
committed by GitHub
parent c81eb3e69c
commit ca542ee154
2 changed files with 8 additions and 3 deletions
+7 -2
View File
@@ -32,7 +32,7 @@ from vllm.model_executor.layers.vocab_parallel_embedding import VocabParallelEmb
from vllm.model_executor.model_loader.weight_utils import default_weight_loader
from vllm.sequence import IntermediateTensors
from .interfaces import SupportsCrossEncoding
from .interfaces import SupportsCrossEncoding, SupportsLoRA
from .interfaces_base import attn_type, default_pooling_type
from .utils import AutoWeightsLoader, WeightsMapper, maybe_prefix
@@ -262,7 +262,7 @@ class ModernBertEncoderLayer(nn.Module):
@support_torch_compile
@default_pooling_type(seq_pooling_type="CLS")
class ModernBertModel(nn.Module):
class ModernBertModel(nn.Module, SupportsLoRA):
hf_to_vllm_mapper = WeightsMapper(
orig_to_new_prefix={
"model.layers.": "encoder_layer.layers.",
@@ -271,6 +271,11 @@ class ModernBertModel(nn.Module):
}
)
packed_modules_mapping = {
"Wqkv": ["Wqkv"],
"Wi": ["Wi"],
}
def __init__(
self,
vllm_config: VllmConfig,