|
@@ -23,7 +23,6 @@
|
|
|
# See the License for the specific language governing permissions and
|
|
|
# limitations under the License.
|
|
|
"""Inference-only Qwen2-VL model compatible with HuggingFace weights."""
|
|
|
-from array import array
|
|
|
from functools import lru_cache, partial
|
|
|
from typing import (Iterable, List, Mapping, Optional, Tuple, Type, TypedDict,
|
|
|
Union)
|
|
@@ -46,8 +45,7 @@ from aphrodite.attention.selector import (_Backend, backend_name_to_enum,
|
|
|
get_global_forced_attn_backend)
|
|
|
from aphrodite.common.config import CacheConfig, MultiModalConfig
|
|
|
from aphrodite.common.logger import log_once
|
|
|
-from aphrodite.common.sequence import (APHRODITE_TOKEN_ID_ARRAY_TYPE,
|
|
|
- IntermediateTensors, SequenceData)
|
|
|
+from aphrodite.common.sequence import IntermediateTensors, SequenceData
|
|
|
from aphrodite.distributed import parallel_state
|
|
|
from aphrodite.distributed import utils as dist_utils
|
|
|
from aphrodite.inputs import INPUT_REGISTRY, InputContext, LLMInputs
|
|
@@ -715,20 +713,12 @@ def dummy_data_for_qwen2_vl(
|
|
|
"--limit-mm-per-prompt."
|
|
|
)
|
|
|
hf_config = ctx.get_hf_config(Qwen2VLConfig)
|
|
|
- token_ids = array(
|
|
|
- APHRODITE_TOKEN_ID_ARRAY_TYPE, [hf_config.vision_start_token_id]
|
|
|
+ dummy_seqdata = SequenceData.from_token_counts(
|
|
|
+ (hf_config.vision_start_token_id, 1),
|
|
|
+ (hf_config.image_token_id, max_llm_image_tokens),
|
|
|
+ (hf_config.vision_end_token_id, 1),
|
|
|
+ (0, seq_len - max_llm_image_tokens - 2),
|
|
|
)
|
|
|
- token_ids += (
|
|
|
- array(APHRODITE_TOKEN_ID_ARRAY_TYPE, [hf_config.image_token_id])
|
|
|
- * max_llm_image_tokens
|
|
|
- )
|
|
|
- token_ids += array(
|
|
|
- APHRODITE_TOKEN_ID_ARRAY_TYPE, [hf_config.vision_end_token_id]
|
|
|
- )
|
|
|
- token_ids += array(APHRODITE_TOKEN_ID_ARRAY_TYPE, [0]) * (
|
|
|
- seq_len - max_llm_image_tokens - 2
|
|
|
- )
|
|
|
- dummy_seqdata = SequenceData(token_ids)
|
|
|
dummy_image = Image.new(
|
|
|
"RGB", (max_resized_width, max_resized_height), color=0
|
|
|
)
|