MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / _dummy_run

Method _dummy_run

fastdeploy/worker/xpu_model_runner.py:1405–1442  ·  view source on GitHub ↗

Use dummy inputs to run before formal execution. Args: num_tokens: Number of the input tokens batch_size: Batch size expected_decode_len: Expected decode length in_capturing: Is cuda graph in capturing state

(
        self,
        num_tokens: paddle.Tensor,
        batch_size: paddle.Tensor,
        expected_decode_len: int = 1,
        in_capturing: bool = False,
    )

Source from the content-addressed store, hash-verified

1403 )
1404
1405 def _dummy_run(
1406 self,
1407 num_tokens: paddle.Tensor,
1408 batch_size: paddle.Tensor,
1409 expected_decode_len: int = 1,
1410 in_capturing: bool = False,
1411 ) -> paddle.Tensor:
1412 """
1413 Use dummy inputs to run before formal execution.
1414 Args:
1415 num_tokens: Number of the input tokens
1416 batch_size: Batch size
1417 expected_decode_len: Expected decode length
1418 in_capturing: Is cuda graph in capturing state
1419 """
1420 input_length_list, max_dec_len_list, block_num = self.get_input_length_list(
1421 num_tokens=num_tokens,
1422 batch_size=batch_size,
1423 expected_decode_len=expected_decode_len,
1424 )
1425 self._dummy_prefill_inputs(
1426 input_length_list=input_length_list,
1427 max_dec_len_list=max_dec_len_list,
1428 block_num=block_num,
1429 )
1430
1431 if self.speculative_method in ["mtp"]:
1432 self.proposer.dummy_prefill_inputs(
1433 num_tokens=num_tokens,
1434 batch_size=batch_size,
1435 expected_decode_len=1,
1436 )
1437
1438 while True:
1439 self.execute_model(is_dummy_run=True, in_capturing=in_capturing)
1440
1441 if int((self.share_inputs["seq_lens_this_time"] > 0).sum()) == 0:
1442 break
1443
1444 def _init_speculative_proposer(self):
1445 """

Callers 3

capture_modelMethod · 0.95
sot_warmupMethod · 0.95
profile_runMethod · 0.95

Calls 4

get_input_length_listMethod · 0.95
_dummy_prefill_inputsMethod · 0.95
execute_modelMethod · 0.95
dummy_prefill_inputsMethod · 0.80

Tested by

no test coverage detected