[CI/Build] Split up models tests (#10069)
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
+8
-1
@@ -1,7 +1,8 @@
|
||||
import copy
|
||||
import enum
|
||||
import json
|
||||
import warnings
|
||||
from dataclasses import dataclass, field
|
||||
from dataclasses import dataclass, field, replace
|
||||
from typing import (TYPE_CHECKING, Any, ClassVar, Dict, Final, List, Literal,
|
||||
Mapping, Optional, Set, Tuple, Type, Union)
|
||||
|
||||
@@ -2078,6 +2079,12 @@ class VllmConfig:
|
||||
return quant_config
|
||||
return None
|
||||
|
||||
def with_hf_config(self, hf_config: PretrainedConfig) -> "VllmConfig":
|
||||
model_config = copy.deepcopy(self.model_config)
|
||||
model_config.hf_config = hf_config
|
||||
|
||||
return replace(self, model_config=model_config)
|
||||
|
||||
def __post_init__(self):
|
||||
"""Verify configs are valid & consistent with each other.
|
||||
"""
|
||||
|
||||
@@ -229,7 +229,6 @@ class FuyuForCausalLM(nn.Module, SupportsMultiModal, SupportsPP):
|
||||
def __init__(self, vllm_config: VllmConfig, prefix: str = "") -> None:
|
||||
super().__init__()
|
||||
config = vllm_config.model_config.hf_config
|
||||
cache_config = vllm_config.cache_config
|
||||
quant_config = vllm_config.quant_config
|
||||
multimodal_config = vllm_config.model_config.multimodal_config
|
||||
self.config = config
|
||||
@@ -246,9 +245,8 @@ class FuyuForCausalLM(nn.Module, SupportsMultiModal, SupportsPP):
|
||||
quant_config=quant_config,
|
||||
gather_output=True,
|
||||
)
|
||||
self.language_model = PersimmonForCausalLM(config.text_config,
|
||||
cache_config=cache_config,
|
||||
quant_config=quant_config)
|
||||
self.language_model = PersimmonForCausalLM(
|
||||
vllm_config.with_hf_config(config.text_config))
|
||||
self.make_empty_intermediate_tensors = (
|
||||
self.language_model.make_empty_intermediate_tensors)
|
||||
|
||||
|
||||
@@ -164,10 +164,12 @@ class InternLM2VEForCausalLM(InternLM2ForCausalLM):
|
||||
vllm_config: VllmConfig,
|
||||
prefix: str = "",
|
||||
) -> None:
|
||||
super().__init__(vllm_config, prefix=prefix)
|
||||
|
||||
config = vllm_config.model_config.hf_config
|
||||
cache_config = vllm_config.cache_config
|
||||
quant_config = vllm_config.quant_config
|
||||
super().__init__(config, cache_config, quant_config)
|
||||
|
||||
self.model = InternLM2VEModel(config,
|
||||
cache_config,
|
||||
quant_config,
|
||||
|
||||
@@ -241,11 +241,11 @@ def init_vllm_registered_model(
|
||||
based on the arguments passed to the outer vLLM model.
|
||||
"""
|
||||
model_class, _ = ModelRegistry.resolve_model_cls(hf_config.architectures)
|
||||
import copy
|
||||
copied_config = copy.deepcopy(vllm_config)
|
||||
copied_config.model_config.hf_config = hf_config
|
||||
|
||||
return model_class(vllm_config=copied_config, prefix=prefix)
|
||||
return model_class(
|
||||
vllm_config=vllm_config.with_hf_config(hf_config),
|
||||
prefix=prefix,
|
||||
)
|
||||
|
||||
|
||||
@overload
|
||||
|
||||
Reference in New Issue
Block a user