The model config may not have the eos_token_id set as it is an optional field. The ModelInfo response from the Server is what the Router uses to determine the EOS token, but it only checks self.model.config.eos_token_id. If config.eos_token_id is None, the eos token id then defaults to 0.
which uses an attribute that is added to the tokenizer in model.py if the model config has the eos token (REF) but also falls back to the tokenizer attribute. ModelInfo should do the same.
Modifications
Use consistent logic to determine the eos_token_id in ModelInfo as it is in other functions by falling back to the tokenizer's eos_token_id attribute if the model config does not have an eos_token_id.
Result
Fixes the behavior for a model that does not have an eos_token_id configured in its config by using the tokenizer configuration instead.
Motivation
The model config may not have the
eos_token_id
set as it is an optional field. TheModelInfo
response from the Server is what the Router uses to determine the EOS token, but it only checksself.model.config.eos_token_id
. Ifconfig.eos_token_id
is None, the eos token id then defaults to 0.In most places in the Server code that need the EOS token (eg. when creating the next token chooser), the check is:
which uses an attribute that is added to the
tokenizer
in model.py if the model config has the eos token (REF) but also falls back to the tokenizer attribute. ModelInfo should do the same.Modifications
Use consistent logic to determine the eos_token_id in ModelInfo as it is in other functions by falling back to the tokenizer's
eos_token_id
attribute if the model config does not have aneos_token_id
.Result
Fixes the behavior for a model that does not have an eos_token_id configured in its config by using the tokenizer configuration instead.
Related Issues
Resolves https://github.com/IBM/text-generation-inference/issues/91