[NPU] Remove hard code (#12479)

This commit is contained in:
Yuwen Hu 2024-12-02 18:26:07 +08:00 committed by GitHub
parent b2e56a2e03
commit 26adb82ee3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -321,9 +321,6 @@ def generate(
new_tokens = new_generate_kwargs['max_new_tokens'] new_tokens = new_generate_kwargs['max_new_tokens']
invalidInputError(input_length + new_tokens <= self.kv_len + 1, invalidInputError(input_length + new_tokens <= self.kv_len + 1,
"Input plus output tokens should not exceed max_context_len.") "Input plus output tokens should not exceed max_context_len.")
# TODO: may optimize this part later
invalidInputError(new_tokens < 1024,
f"Generated tokens ({new_tokens}) exceed named pipeline limitation.")
if "eos_token_id" not in new_generate_kwargs: if "eos_token_id" not in new_generate_kwargs:
generation_config = GenerationConfig.from_model_config(self.config) generation_config = GenerationConfig.from_model_config(self.config)