Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import asyncio

from fastdeploy.input.tokenzier_client import (
from fastdeploy.input.tokenizer_client import (
AsyncTokenizerClient,
ImageDecodeRequest,
ImageEncodeRequest,
Expand Down
2 changes: 1 addition & 1 deletion fastdeploy/entrypoints/openai/response_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from typing import Any, Dict, List, Optional

from fastdeploy.entrypoints.openai.usage_calculator import count_tokens
from fastdeploy.input.tokenzier_client import AsyncTokenizerClient, ImageDecodeRequest
from fastdeploy.input.tokenizer_client import AsyncTokenizerClient, ImageDecodeRequest


class ChatResponseProcessor:
Expand Down
2 changes: 1 addition & 1 deletion fastdeploy/entrypoints/openai/v1/serving_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
OpenAiServingBase,
ServingResponseContext,
)
from fastdeploy.input.tokenzier_client import AsyncTokenizerClient, ImageDecodeRequest
from fastdeploy.input.tokenizer_client import AsyncTokenizerClient, ImageDecodeRequest
from fastdeploy.metrics.metrics import main_process_metrics
from fastdeploy.utils import api_server_logger
from fastdeploy.worker.output import LogprobsLists
Expand Down
12 changes: 6 additions & 6 deletions fastdeploy/worker/gpu_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,12 +640,12 @@ def _process_mm_features(self, request_list: List[Request]):
image_features_output is not None
), f"image_features_output is None, images_lst length: {len(multi_vision_inputs['images_lst'])}"
grid_thw = multi_vision_inputs["grid_thw_lst_batches"][index][thw_idx]
mm_token_lenght = inputs["mm_num_token_func"](grid_thw=grid_thw)
mm_feature = image_features_output[feature_idx : feature_idx + mm_token_lenght]
mm_token_length = inputs["mm_num_token_func"](grid_thw=grid_thw)
mm_feature = image_features_output[feature_idx : feature_idx + mm_token_length]

# add feature to encoder cache
self.encoder_cache[mm_hash] = mm_feature.detach().cpu()
feature_idx += mm_token_lenght
feature_idx += mm_token_length
thw_idx += 1

feature_start = feature_position.offset
Expand All @@ -665,13 +665,13 @@ def _process_mm_features(self, request_list: List[Request]):
merge_image_features, thw_idx = [], 0
for feature_position in feature_position_item:
grid_thw = grid_thw_lst[thw_idx]
mm_token_lenght = inputs["mm_num_token_func"](grid_thw=grid_thw)
mm_feature = image_features_output[feature_idx : feature_idx + mm_token_lenght]
mm_token_length = inputs["mm_num_token_func"](grid_thw=grid_thw)
mm_feature = image_features_output[feature_idx : feature_idx + mm_token_length]

feature_start = feature_position.offset
feature_end = feature_position.offset + feature_position.length
merge_image_features.append(mm_feature[feature_start:feature_end])
feature_idx += mm_token_lenght
feature_idx += mm_token_length
thw_idx += 1
image_features_list.append(paddle.concat(merge_image_features, axis=0))
for idx, index in req_idx_img_index_map.items():
Expand Down
12 changes: 6 additions & 6 deletions fastdeploy/worker/metax_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,12 +571,12 @@ def _process_mm_features(self, request_list: List[Request]):
image_features_output is not None
), f"image_features_output is None, images_lst length: {len(multi_vision_inputs['images_lst'])}"
grid_thw = multi_vision_inputs["grid_thw_lst_batches"][index][thw_idx]
mm_token_lenght = inputs["mm_num_token_func"](grid_thw=grid_thw)
mm_feature = image_features_output[feature_idx : feature_idx + mm_token_lenght]
mm_token_length = inputs["mm_num_token_func"](grid_thw=grid_thw)
mm_feature = image_features_output[feature_idx : feature_idx + mm_token_length]

# add feature to encoder cache
self.encoder_cache[mm_hash] = mm_feature.detach().cpu()
feature_idx += mm_token_lenght
feature_idx += mm_token_length
thw_idx += 1

feature_start = feature_position.offset
Expand All @@ -596,13 +596,13 @@ def _process_mm_features(self, request_list: List[Request]):
merge_image_features, thw_idx = [], 0
for feature_position in feature_position_item:
grid_thw = grid_thw_lst[thw_idx]
mm_token_lenght = inputs["mm_num_token_func"](grid_thw=grid_thw)
mm_feature = image_features_output[feature_idx : feature_idx + mm_token_lenght]
mm_token_length = inputs["mm_num_token_func"](grid_thw=grid_thw)
mm_feature = image_features_output[feature_idx : feature_idx + mm_token_length]

feature_start = feature_position.offset
feature_end = feature_position.offset + feature_position.length
merge_image_features.append(mm_feature[feature_start:feature_end])
feature_idx += mm_token_lenght
feature_idx += mm_token_length
thw_idx += 1
image_features_list.append(paddle.concat(merge_image_features, axis=0))
for idx, index in req_idx_img_index_map.items():
Expand Down
12 changes: 6 additions & 6 deletions fastdeploy/worker/xpu_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,12 +485,12 @@ def _process_mm_features(self, request_list: List[Request]):
image_features_output is not None
), f"image_features_output is None, images_lst length: {len(multi_vision_inputs['images_lst'])}"
grid_thw = multi_vision_inputs["grid_thw_lst"][thw_idx]
mm_token_lenght = inputs["mm_num_token_func"](grid_thw=grid_thw)
mm_feature = image_features_output[feature_idx : feature_idx + mm_token_lenght]
mm_token_length = inputs["mm_num_token_func"](grid_thw=grid_thw)
mm_feature = image_features_output[feature_idx : feature_idx + mm_token_length]

# add feature to encoder cache
self.encoder_cache[mm_hash] = mm_feature.detach().cpu()
feature_idx += mm_token_lenght
feature_idx += mm_token_length
thw_idx += 1

feature_start = feature_position.offset
Expand All @@ -510,13 +510,13 @@ def _process_mm_features(self, request_list: List[Request]):
image_features_output = self.extract_vision_features(multi_vision_inputs)
for feature_position in multi_vision_inputs["feature_position_list"]:
grid_thw = multi_vision_inputs["grid_thw_lst"][thw_idx]
mm_token_lenght = inputs["mm_num_token_func"](grid_thw=grid_thw)
mm_feature = image_features_output[feature_idx : feature_idx + mm_token_lenght]
mm_token_length = inputs["mm_num_token_func"](grid_thw=grid_thw)
mm_feature = image_features_output[feature_idx : feature_idx + mm_token_length]

feature_start = feature_position.offset
feature_end = feature_position.offset + feature_position.length
merge_image_features.append(mm_feature[feature_start:feature_end])
feature_idx += mm_token_lenght
feature_idx += mm_token_length
thw_idx += 1
self.share_inputs["image_features"] = paddle.concat(merge_image_features, axis=0)

Expand Down
2 changes: 1 addition & 1 deletion tests/input/test_tokenizer_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import pytest
import respx

from fastdeploy.input.tokenzier_client import (
from fastdeploy.input.tokenizer_client import (
AsyncTokenizerClient,
ImageEncodeRequest,
VideoEncodeRequest,
Expand Down
Loading