mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-12-17 12:20:37 +08:00
[model] support GLM4.6v (#9586)
This commit is contained in:
@@ -78,8 +78,11 @@ def run_sft(
|
||||
|
||||
# Compatible with Transformers v4 and Transformers v5
|
||||
if is_transformers_version_greater_than("5.0.0RC0"):
|
||||
extra_special_tokens = getattr(tokenizer, "_extra_special_tokens", [])
|
||||
extra_ids = tokenizer.convert_tokens_to_ids(extra_special_tokens)
|
||||
extra_ids = getattr(tokenizer, "additional_special_tokens_ids", None)
|
||||
if not isinstance(extra_ids, list):
|
||||
extra_special_tokens = getattr(tokenizer, "_extra_special_tokens", [])
|
||||
string_tokens = [str(t) for t in extra_special_tokens]
|
||||
extra_ids = tokenizer.convert_tokens_to_ids(string_tokens)
|
||||
all_eos_ids = [tokenizer.eos_token_id] + [i for i in extra_ids if i != -1]
|
||||
unique_eos_ids = list(dict.fromkeys(all_eos_ids))
|
||||
gen_kwargs["eos_token_id"] = unique_eos_ids
|
||||
|
||||
Reference in New Issue
Block a user