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

Method add_request

colossalai/inference/core/engine.py:87–105  ·  view source on GitHub ↗

Add requests. Args: request_ids (List[int], optional): The request ID. Defaults to None. prompts (Union[List[str], optional): Input prompts. Defaults to None. prompts_token_ids (List[List[int]], optional): token ids of input prompts. Defaults to

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

Source from the content-addressed store, hash-verified

85 return self.engine.generate(request_ids=request_ids, prompts=prompts, *args, **kwargs)
86
87 def add_request(
88 self,
89 request_ids: Union[List[int], int] = None,
90 prompts: Union[List[str], str] = None,
91 *args,
92 **kwargs,
93 ) -> None:
94 """
95 Add requests.
96
97 Args:
98 request_ids (List[int], optional): The request ID. Defaults to None.
99 prompts (Union[List[str], optional): Input prompts. Defaults to None.
100 prompts_token_ids (List[List[int]], optional): token ids of input prompts. Defaults to None.
101 kwargs: for LLM, it could be max_length, max_new_tokens, etc
102 for diffusion, it could be prompt_2, prompt_3, num_images_per_prompt, do_classifier_free_guidance, negative_prompt, negative_prompt_2, negative_prompt_3, prompt_embeds, negative_prompt_embeds, pooled_prompt_embeds, negative_pooled_prompt_embeds, clip_skip, which aligns with diffusers
103 """
104 assert self.engine is not None, "Please init Engine first"
105 self.engine.add_request(request_ids=request_ids, prompts=prompts, *args, **kwargs)
106
107 def step(self):
108 assert self.engine is not None, "Please init Engine first"

Callers 5

check_inference_engineFunction · 0.95
check_streamingllmFunction · 0.95
check_inference_engineFunction · 0.95
_run_engineFunction · 0.95
check_inference_engineFunction · 0.95

Calls

no outgoing calls

Tested by 5

check_inference_engineFunction · 0.76
check_streamingllmFunction · 0.76
check_inference_engineFunction · 0.76
_run_engineFunction · 0.76
check_inference_engineFunction · 0.76