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

Method add

fastdeploy/engine/request.py:1030–1059  ·  view source on GitHub ↗

Merge RequestOutput into this one

(self, next_output: RequestOutput)

Source from the content-addressed store, hash-verified

1028 self.accumulate_tool_calls = None
1029
1030 def add(self, next_output: RequestOutput) -> None:
1031 """Merge RequestOutput into this one"""
1032 if next_output.prompt is not None:
1033 self.prompt = next_output.prompt
1034 if next_output.prompt_token_ids is not None:
1035 self.prompt_token_ids = next_output.prompt_token_ids
1036 self.finished |= next_output.finished
1037 self.outputs.index = next_output.outputs.index
1038 self.outputs.token_ids.extend(next_output.outputs.token_ids)
1039
1040 if next_output.metrics.model_forward_time is not None:
1041 self.metrics.model_forward_time = next_output.metrics.model_forward_time
1042 if next_output.metrics.model_execute_time is not None:
1043 self.metrics.model_execute_time = next_output.metrics.model_execute_time
1044 if next_output.metrics.engine_recv_latest_token_time is not None:
1045 self.metrics.engine_recv_latest_token_time = next_output.metrics.engine_recv_latest_token_time
1046 if next_output.outputs.top_logprobs is not None:
1047 self.outputs.top_logprobs.logprob_token_ids.extend(next_output.outputs.top_logprobs.logprob_token_ids)
1048 self.outputs.top_logprobs.logprobs.extend(next_output.outputs.top_logprobs.logprobs)
1049 self.outputs.top_logprobs.sampled_token_ranks.extend(next_output.outputs.top_logprobs.sampled_token_ranks)
1050 if next_output.outputs.draft_top_logprobs is not None:
1051 self.outputs.draft_top_logprobs.logprob_token_ids.extend(
1052 next_output.outputs.draft_top_logprobs.logprob_token_ids
1053 )
1054 self.outputs.draft_top_logprobs.logprobs.extend(next_output.outputs.draft_top_logprobs.logprobs)
1055 self.outputs.draft_top_logprobs.sampled_token_ranks.extend(
1056 next_output.outputs.draft_top_logprobs.sampled_token_ranks
1057 )
1058 if next_output.metrics.speculate_metrics is not None:
1059 self.outputs.speculate_metrics = next_output.metrics.speculate_metrics
1060
1061 def accumulate(self, next_output: RequestOutput) -> None:
1062 """Accumulate RequestOutput"""

Callers 15

accumulateMethod · 0.95
get_cudnn_versionFunction · 0.45
expire_reqsMethod · 0.45
readMethod · 0.45
runMethod · 0.45
put_resultsMethod · 0.45
layers_are_groupedFunction · 0.45
applyMethod · 0.45
apply_ropeFunction · 0.45
applyMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected