fix lora target

Former-commit-id: d822e41e7ac7e310ee49e347fc45754284ce30b8
This commit is contained in:
hiyouga
2023-09-09 17:04:45 +08:00
parent 7143c551ab
commit f91c5f2638
7 changed files with 63 additions and 43 deletions

View File

@@ -77,13 +77,13 @@ class Template:
) -> Tuple[List[int], List[int]]:
if tokenizer.bos_token_id is not None and getattr(tokenizer, "add_bos_token", True):
bos_ids = [tokenizer.bos_token_id]
else: # baichuan, qwen and gpt2 models has no bos token
else: # baichuan, qwen and gpt2 models have no bos token
bos_ids = []
if tokenizer.eos_token_id is None:
raise ValueError("EOS token is required.")
if self.efficient_eos: # used in baichuan, qwen and gpt2 models
if self.efficient_eos: # used in baichuan, qwen, chatglm, etc.
eos_ids = []
else:
eos_ids = [tokenizer.eos_token_id]