MCPcopy Create free account
hub / github.com/going-doer/Paper2Code / run_llm

Function run_llm

codes/2_analyzing_llm.py:170–178  ·  view source on GitHub ↗
(msg)

Source from the content-addressed store, hash-verified

168 sampling_params = SamplingParams(temperature=temperature, max_tokens=128000, stop_token_ids=[tokenizer.eos_token_id])
169
170def run_llm(msg):
171 # vllm
172 prompt_token_ids = [tokenizer.apply_chat_template(messages, add_generation_prompt=True) for messages in [msg]]
173
174 outputs = llm.generate(prompt_token_ids=prompt_token_ids, sampling_params=sampling_params)
175
176 completion = [output.outputs[0].text for output in outputs]
177
178 return completion[0]
179
180artifact_output_dir=f'{output_dir}/analyzing_artifacts'
181os.makedirs(artifact_output_dir, exist_ok=True)

Callers 1

2_analyzing_llm.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected