From 32f4dff83ba0ca69cea6c162e282ee9fef42e4fb Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Tue, 2 Apr 2024 04:35:47 +0000 Subject: [PATCH] fix: explicitly pass only non-null value Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> --- openllm-python/src/_openllm_tiny/_llm.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/openllm-python/src/_openllm_tiny/_llm.py b/openllm-python/src/_openllm_tiny/_llm.py index 9a813728..ed4f004c 100644 --- a/openllm-python/src/_openllm_tiny/_llm.py +++ b/openllm-python/src/_openllm_tiny/_llm.py @@ -172,9 +172,8 @@ class LLM: top_p = 1.0 if config['temperature'] <= 1e-5 else config['top_p'] config = config.model_copy(update=dict(stop=list(stop), stop_token_ids=stop_token_ids, top_p=top_p)) - sampling_params = SamplingParams(**{ - k: getattr(config, k, None) for k in set(inspect.signature(SamplingParams).parameters.keys()) - }) + params = {k: getattr(config, k, None) for k in set(inspect.signature(SamplingParams).parameters.keys())} + sampling_params = SamplingParams(**{k: v for k, v in params.items() if v is not None}) try: async for it in self._model.generate(