Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
alexm-neuralmagic committed Dec 2, 2024
1 parent 7357686 commit ee0d70d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/offline_inference_vision_language.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
on HuggingFace model repository.
"""
import time

from transformers import AutoTokenizer

from vllm import LLM, SamplingParams
Expand All @@ -24,8 +25,7 @@ def run_llava(question: str, modality: str):

prompt = f"USER: <image>\n{question}\nASSISTANT:"

llm = LLM(model="llava-hf/llava-1.5-7b-hf",
max_model_len=4096)
llm = LLM(model="llava-hf/llava-1.5-7b-hf", max_model_len=4096)

stop_token_ids = None
return llm, prompt, stop_token_ids
Expand Down
7 changes: 4 additions & 3 deletions vllm/inputs/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from typing_extensions import NotRequired, TypedDict, TypeVar, assert_never

if TYPE_CHECKING:
from vllm.multimodal import MultiModalDataDict, MultiModalKwargs, MultiModalPlaceholderDict
from vllm.multimodal import (MultiModalDataDict, MultiModalKwargs,
MultiModalPlaceholderDict)
from vllm.multimodal.inputs import MultiModalInputsV2


Expand Down Expand Up @@ -265,14 +266,14 @@ def multi_modal_data(self) -> "MultiModalDataDict":
assert_never(inputs)

@cached_property
def multi_modal_inputs(self) -> "MultiModalKwargs":
def multi_modal_inputs(self) -> Union[Dict, "MultiModalKwargs"]:
inputs = self.inputs

if inputs["type"] == "token":
return inputs.get("multi_modal_inputs", {})

if inputs["type"] == "multimodal":
return inputs.get("mm_inputs", {})
return inputs.get("mm_kwargs", {})

assert_never(inputs)

Expand Down
5 changes: 2 additions & 3 deletions vllm/v1/engine/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import enum
from dataclasses import dataclass
from typing import Any, Dict, List, Optional, Union
from typing import List, Optional, Union

import msgspec

from vllm.lora.request import LoRARequest
from vllm.multimodal import (MultiModalDataDict, MultiModalKwargs,
MultiModalPlaceholderDict)
from vllm.multimodal import MultiModalKwargs, MultiModalPlaceholderDict
from vllm.sampling_params import RequestOutputKind, SamplingParams


Expand Down
1 change: 0 additions & 1 deletion vllm/v1/engine/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from vllm.config import CacheConfig, VllmConfig
from vllm.logger import init_logger
from vllm.usage.usage_lib import UsageContext
from vllm.multimodal import MultiModalDataDict, MultiModalKwargs
from vllm.v1.core.scheduler import Scheduler
from vllm.v1.engine import (EngineCoreOutput, EngineCoreOutputs,
EngineCoreRequest, EngineCoreRequestType)
Expand Down

0 comments on commit ee0d70d

Please sign in to comment.