8383from fastdeploy import envs
8484from fastdeploy .engine .pooling_params import PoolingParams
8585from fastdeploy .engine .tasks import PoolingTask
86- from fastdeploy .input .ernie4_5_vl_processor import DataProcessor
86+ # from fastdeploy.input.ernie4_5_vl_processor import DataProcessor
8787from fastdeploy .inter_communicator import IPCSignal , ZmqIpcClient
8888from fastdeploy .model_executor .forward_meta import ForwardMeta
8989from fastdeploy .model_executor .layers .pool .metadata import PoolingMetadata
@@ -117,8 +117,8 @@ def __init__(
117117
118118 # VL model config:
119119 if self .enable_mm :
120- if "ernie" in self .fd_config .model_config .model_type :
121- self ._init_image_preprocess ()
120+ # if "ernie" in self.fd_config.model_config.model_type:
121+ # self._init_image_preprocess()
122122
123123 self .amp_black = [
124124 "reduce_sum" ,
@@ -1119,6 +1119,11 @@ def _init_share_inputs(self, max_num_seqs: int):
11191119
11201120 # Initialize rotary position embedding
11211121 if not self .enable_mm :
1122+
1123+ logger .info (f"Final rotary_dim from config: { self .model_config .rotary_dim } " )
1124+ logger .info (f"Original head_dim from config: { self .model_config .head_dim } " )
1125+ logger .info (f"Calculated partial_rotary_factor from config: { self .model_config .partial_rotary_factor } " )
1126+
11221127 self .share_inputs ["rope_emb" ] = get_rope (
11231128 rotary_dim = self .model_config .head_dim ,
11241129 position_ids = paddle .arange (self .model_config .max_model_len ).reshape ((1 , - 1 )),
@@ -1128,7 +1133,6 @@ def _init_share_inputs(self, max_num_seqs: int):
11281133 )
11291134
11301135
1131-
11321136 # Set block tables
11331137 pre_max_block_num = (
11341138 self .model_config .max_model_len + self .cache_config .block_size - 1
@@ -2423,27 +2427,27 @@ def padding_cudagraph_inputs(self) -> None:
24232427 self .real_token_num = self .forward_meta .ids_remove_padding .shape [0 ]
24242428 return
24252429
2426- def _init_image_preprocess (self ) -> None :
2427- processor = DataProcessor (
2428- tokenizer_name = self .model_config .model ,
2429- image_preprocessor_name = str (self .model_config .model ),
2430- )
2431- processor .eval ()
2432- image_preprocess = processor .image_preprocessor
2433- image_preprocess .image_mean_tensor = paddle .to_tensor (image_preprocess .image_mean , dtype = "float32" ).reshape (
2434- [1 , 3 , 1 , 1 ]
2435- )
2436- image_preprocess .image_std_tensor = paddle .to_tensor (image_preprocess .image_std , dtype = "float32" ).reshape (
2437- [1 , 3 , 1 , 1 ]
2438- )
2439- image_preprocess .rescale_factor = paddle .to_tensor (image_preprocess .rescale_factor , dtype = "float32" )
2440- image_preprocess .image_mean_tensor = image_preprocess .image_mean_tensor .squeeze ([- 2 , - 1 ]).repeat_interleave (
2441- self .model_config .vision_config .patch_size ** 2 * 1 , - 1
2442- )
2443- image_preprocess .image_std_tensor = image_preprocess .image_std_tensor .squeeze ([- 2 , - 1 ]).repeat_interleave (
2444- self .model_config .vision_config .patch_size ** 2 * 1 , - 1
2445- )
2446- self .image_preprocess = image_preprocess
2430+ # def _init_image_preprocess(self) -> None:
2431+ # processor = DataProcessor(
2432+ # tokenizer_name=self.model_config.model,
2433+ # image_preprocessor_name=str(self.model_config.model),
2434+ # )
2435+ # processor.eval()
2436+ # image_preprocess = processor.image_preprocessor
2437+ # image_preprocess.image_mean_tensor = paddle.to_tensor(image_preprocess.image_mean, dtype="float32").reshape(
2438+ # [1, 3, 1, 1]
2439+ # )
2440+ # image_preprocess.image_std_tensor = paddle.to_tensor(image_preprocess.image_std, dtype="float32").reshape(
2441+ # [1, 3, 1, 1]
2442+ # )
2443+ # image_preprocess.rescale_factor = paddle.to_tensor(image_preprocess.rescale_factor, dtype="float32")
2444+ # image_preprocess.image_mean_tensor = image_preprocess.image_mean_tensor.squeeze([-2, -1]).repeat_interleave(
2445+ # self.model_config.vision_config.patch_size**2 * 1, -1
2446+ # )
2447+ # image_preprocess.image_std_tensor = image_preprocess.image_std_tensor.squeeze([-2, -1]).repeat_interleave(
2448+ # self.model_config.vision_config.patch_size**2 * 1, -1
2449+ # )
2450+ # self.image_preprocess = image_preprocess
24472451
24482452 def _preprocess_mm_task (self , one : dict ) -> None :
24492453 """process batch"""
0 commit comments