mirror of
https://github.com/open-compass/opencompass.git
synced 2025-05-30 16:03:24 +08:00
[Update] strip stop_words (#1635)
This commit is contained in:
parent
662dddf41a
commit
fb12c3f98a
@ -73,7 +73,11 @@ class TurboMindModelwithChatTemplate(BaseModel):
|
|||||||
else:
|
else:
|
||||||
assert isinstance(generation_config.eos_token_id, list)
|
assert isinstance(generation_config.eos_token_id, list)
|
||||||
for token_id in generation_config.eos_token_id:
|
for token_id in generation_config.eos_token_id:
|
||||||
potential_stop_words.append(self.tokenizer.decode(token_id))
|
stop_word = self.tokenizer.decode(token_id)
|
||||||
|
if stop_word.startswith(' '):
|
||||||
|
self.logger.warning(f'stop_word "{stop_word}" contains blanks, which will be stripped')
|
||||||
|
stop_word = stop_word.strip()
|
||||||
|
potential_stop_words.append(stop_word)
|
||||||
if self.tokenizer.eos_token is not None:
|
if self.tokenizer.eos_token is not None:
|
||||||
potential_stop_words.append(self.tokenizer.eos_token)
|
potential_stop_words.append(self.tokenizer.eos_token)
|
||||||
potential_stop_words = list(set(potential_stop_words))
|
potential_stop_words = list(set(potential_stop_words))
|
||||||
|
Loading…
Reference in New Issue
Block a user