diff --git a/src/python/py/models/builders/base.py b/src/python/py/models/builders/base.py index 9267a5ec56..633970f9fe 100644 --- a/src/python/py/models/builders/base.py +++ b/src/python/py/models/builders/base.py @@ -551,7 +551,7 @@ def make_genai_config(self, model_name_or_path, extra_kwargs, out_dir): } for key, default_val in defaults.items(): val = getattr(gen_config, key) - if val != default_val: + if val is not None and val != default_val: setattr(config, key, getattr(gen_config, key)) except: pass @@ -623,8 +623,8 @@ def make_genai_config(self, model_name_or_path, extra_kwargs, out_dir): else self.past_present_share_buffer, "repetition_penalty": config.repetition_penalty if hasattr(config, "repetition_penalty") else 1.0, "temperature": config.temperature if hasattr(config, "temperature") else 1.0, - "top_k": config.top_k if hasattr(config, "top_k") else 50, - "top_p": config.top_p if hasattr(config, "top_p") else 1.0, + "top_k": config.top_k if hasattr(config, "top_k") and config.top_k is not None else 50, + "top_p": config.top_p if hasattr(config, "top_p") and config.top_p is not None else 1.0, }, }