MCPcopy
hub / github.com/hpcaitech/ColossalAI / generate

Method generate

colossalai/inference/core/engine.py:69–85  ·  view source on GitHub ↗

Executing the inference step. Args: request_ids (List[int], optional): The request ID. Defaults to None. prompts (Union[List[str], optional): Input prompts. Defaults to None.

(
        self,
        request_ids: Union[List[int], int] = None,
        prompts: Union[List[str], str] = None,
        *args,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

67 assert self._initialized, "Engine must be initialized"
68
69 def generate(
70 self,
71 request_ids: Union[List[int], int] = None,
72 prompts: Union[List[str], str] = None,
73 *args,
74 **kwargs,
75 ) -> Union[List[Union[str, List[PIL.Image.Image], np.ndarray]], Tuple[List[str], List[List[int]]]]:
76 """
77 Executing the inference step.
78
79 Args:
80 request_ids (List[int], optional): The request ID. Defaults to None.
81 prompts (Union[List[str], optional): Input prompts. Defaults to None.
82 """
83
84 assert self.engine is not None, "Please init Engine first"
85 return self.engine.generate(request_ids=request_ids, prompts=prompts, *args, **kwargs)
86
87 def add_request(
88 self,

Callers 10

check_inference_engineFunction · 0.95
check_inference_engineFunction · 0.95
check_inference_engineFunction · 0.95
check_spec_decFunction · 0.95
_run_engineFunction · 0.95
check_inference_engineFunction · 0.95
benchmark_inferenceFunction · 0.95
inferFunction · 0.95
inferFunction · 0.95
benchmark_colossalaiFunction · 0.95

Calls

no outgoing calls

Tested by 6

check_inference_engineFunction · 0.76
check_inference_engineFunction · 0.76
check_inference_engineFunction · 0.76
check_spec_decFunction · 0.76
_run_engineFunction · 0.76
check_inference_engineFunction · 0.76