Convert formatting to use ruff instead of yapf + isort (#26247)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
@@ -13,14 +13,16 @@ from vllm.config.multimodal import BaseDummyOptions
|
||||
from vllm.multimodal import MULTIMODAL_REGISTRY
|
||||
from vllm.multimodal.inputs import MultiModalDataDict
|
||||
|
||||
from .llava_next import (LlavaDummyInputsBuilder, LlavaNextMultiModalProcessor,
|
||||
LlavaNextProcessingInfo)
|
||||
from .llava_next import (
|
||||
LlavaDummyInputsBuilder,
|
||||
LlavaNextMultiModalProcessor,
|
||||
LlavaNextProcessingInfo,
|
||||
)
|
||||
from .llava_onevision import LlavaOnevisionForConditionalGeneration
|
||||
from .utils import WeightsMapper
|
||||
|
||||
|
||||
class RVLProcessingInfo(LlavaNextProcessingInfo):
|
||||
|
||||
def get_hf_config(self):
|
||||
return self.ctx.get_hf_config()
|
||||
|
||||
@@ -29,7 +31,6 @@ class RVLProcessingInfo(LlavaNextProcessingInfo):
|
||||
|
||||
|
||||
class RVLDummyInputsBuilder(LlavaDummyInputsBuilder[RVLProcessingInfo]):
|
||||
|
||||
def get_dummy_text(self, mm_counts: Mapping[str, int]) -> str:
|
||||
num_images = mm_counts.get("image", 0)
|
||||
image_token = "<image>"
|
||||
@@ -44,26 +45,24 @@ class RVLDummyInputsBuilder(LlavaDummyInputsBuilder[RVLProcessingInfo]):
|
||||
) -> MultiModalDataDict:
|
||||
num_images = mm_counts.get("image", 0)
|
||||
|
||||
target_width, target_height = (
|
||||
self.info.get_image_size_with_most_features())
|
||||
target_width, target_height = self.info.get_image_size_with_most_features()
|
||||
|
||||
image_overrides = mm_options.get("image") if mm_options else None
|
||||
|
||||
return {
|
||||
"image":
|
||||
self._get_dummy_images(width=target_width,
|
||||
height=target_height,
|
||||
num_images=num_images,
|
||||
overrides=image_overrides),
|
||||
"image": self._get_dummy_images(
|
||||
width=target_width,
|
||||
height=target_height,
|
||||
num_images=num_images,
|
||||
overrides=image_overrides,
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
class RVLMultiModalProjector(nn.Module):
|
||||
|
||||
def __init__(self, config):
|
||||
super().__init__()
|
||||
self.pre_norm = nn.LayerNorm(config.vision_config.hidden_size,
|
||||
eps=1e-06)
|
||||
self.pre_norm = nn.LayerNorm(config.vision_config.hidden_size, eps=1e-06)
|
||||
self.linear_1 = nn.Linear(
|
||||
config.vision_config.hidden_size,
|
||||
config.text_config.hidden_size,
|
||||
@@ -91,7 +90,6 @@ class RVLMultiModalProjector(nn.Module):
|
||||
dummy_inputs=RVLDummyInputsBuilder,
|
||||
)
|
||||
class RForConditionalGeneration(LlavaOnevisionForConditionalGeneration):
|
||||
|
||||
hf_to_vllm_mapper = WeightsMapper(
|
||||
orig_to_new_prefix={
|
||||
# mapping for new names in checkpoint saved after transformers
|
||||
@@ -101,7 +99,8 @@ class RForConditionalGeneration(LlavaOnevisionForConditionalGeneration):
|
||||
"model.multi_modal_projector.": "multi_modal_projector.",
|
||||
"model.image_newline": "image_newline",
|
||||
"lm_head.": "language_model.lm_head.",
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
def __init__(self, *, vllm_config: VllmConfig, prefix: str = "") -> None:
|
||||
super().__init__(vllm_config=vllm_config, prefix=prefix)
|
||||
|
||||
Reference in New Issue
Block a user