[4/N] Initialize MM components in context managers (M-P) (#32663)
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
@@ -820,16 +820,18 @@ class NemotronParseForConditionalGeneration(nn.Module, SupportsMultiModal):
|
||||
cache_config = vllm_config.cache_config
|
||||
quant_config = vllm_config.quant_config
|
||||
|
||||
self.encoder = RadioWithNeck(
|
||||
config=config, quant_config=quant_config, prefix=f"{prefix}.encoder"
|
||||
)
|
||||
with self._mark_tower_model(vllm_config, "image"):
|
||||
self.encoder = RadioWithNeck(
|
||||
config=config, quant_config=quant_config, prefix=f"{prefix}.encoder"
|
||||
)
|
||||
|
||||
self.decoder = MBartDecoderNoPos(
|
||||
config.decoder,
|
||||
cache_config=cache_config,
|
||||
quant_config=quant_config,
|
||||
prefix=f"{prefix}.decoder",
|
||||
)
|
||||
with self._mark_language_model(vllm_config):
|
||||
self.decoder = MBartDecoderNoPos(
|
||||
config.decoder,
|
||||
cache_config=cache_config,
|
||||
quant_config=quant_config,
|
||||
prefix=f"{prefix}.decoder",
|
||||
)
|
||||
|
||||
self.vocab_size = config.decoder.vocab_size
|
||||
self.lm_head = ParallelLMHead(
|
||||
@@ -883,9 +885,6 @@ class NemotronParseForConditionalGeneration(nn.Module, SupportsMultiModal):
|
||||
pixel_values = pixel_values.to(dtype)
|
||||
return self.encoder(pixel_values)
|
||||
|
||||
def get_language_model(self) -> torch.nn.Module:
|
||||
return self.decoder
|
||||
|
||||
def embed_multimodal(self, **kwargs: object) -> MultiModalEmbeddings | None:
|
||||
image_input = self._parse_and_validate_image_input(**kwargs)
|
||||
if image_input is None:
|
||||
|
||||
Reference in New Issue
Block a user