mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-12-27 17:20:35 +08:00
Compare commits
2 Commits
5744f1ea94
...
1bbb461f76
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1bbb461f76 | ||
|
|
c1f5f8fff6 |
@@ -291,7 +291,7 @@ Read technical notes:
|
||||
| [Gemma/Gemma 2/CodeGemma](https://huggingface.co/google) | 2B/7B/9B/27B | gemma/gemma2 |
|
||||
| [Gemma 3/Gemma 3n](https://huggingface.co/google) | 270M/1B/4B/6B/8B/12B/27B | gemma3/gemma3n |
|
||||
| [GLM-4/GLM-4-0414/GLM-Z1](https://huggingface.co/zai-org) | 9B/32B | glm4/glmz1 |
|
||||
| [GLM-4.1V](https://huggingface.co/zai-org) | 9B | glm4v |
|
||||
| [GLM-4.1V/GLM-4.6V](https://huggingface.co/zai-org) | 9B/106B | glm4v |
|
||||
| [GLM-4.5/GLM-4.5V](https://huggingface.co/zai-org) | 106B/355B | glm4_moe/glm4v_moe |
|
||||
| [GPT-2](https://huggingface.co/openai-community) | 0.1B/0.4B/0.8B/1.5B | - |
|
||||
| [GPT-OSS](https://huggingface.co/openai) | 20B/120B | gpt |
|
||||
|
||||
@@ -293,7 +293,7 @@ https://github.com/user-attachments/assets/43b700c6-a178-41db-b1f8-8190a5d3fcfc
|
||||
| [Gemma/Gemma 2/CodeGemma](https://huggingface.co/google) | 2B/7B/9B/27B | gemma/gemma2 |
|
||||
| [Gemma 3/Gemma 3n](https://huggingface.co/google) | 270M/1B/4B/6B/8B/12B/27B | gemma3/gemma3n |
|
||||
| [GLM-4/GLM-4-0414/GLM-Z1](https://huggingface.co/zai-org) | 9B/32B | glm4/glmz1 |
|
||||
| [GLM-4.1V](https://huggingface.co/zai-org) | 9B | glm4v |
|
||||
| [GLM-4.1V/GLM-4.6V](https://huggingface.co/zai-org) | 9B/106B | glm4v |
|
||||
| [GLM-4.5/GLM-4.5V](https://huggingface.co/zai-org) | 106B/355B | glm4_moe/glm4v_moe |
|
||||
| [GPT-2](https://huggingface.co/openai-community) | 0.1B/0.4B/0.8B/1.5B | - |
|
||||
| [GPT-OSS](https://huggingface.co/openai) | 20B/120B | gpt |
|
||||
|
||||
@@ -199,9 +199,12 @@ class Template:
|
||||
logger.info_rank0(f"Add pad token: {tokenizer.pad_token}")
|
||||
|
||||
if stop_words:
|
||||
num_added_tokens = tokenizer.add_special_tokens(
|
||||
dict(additional_special_tokens=stop_words), replace_additional_special_tokens=False
|
||||
)
|
||||
try:
|
||||
num_added_tokens = tokenizer.add_special_tokens(
|
||||
dict(additional_special_tokens=stop_words), replace_additional_special_tokens=False
|
||||
)
|
||||
except TypeError:
|
||||
num_added_tokens = tokenizer.add_special_tokens(dict(additional_special_tokens=stop_words))
|
||||
logger.info_rank0("Add {} to stop words.".format(",".join(stop_words)))
|
||||
if num_added_tokens > 0:
|
||||
logger.warning_rank0("New tokens have been added, make sure `resize_vocab` is True.")
|
||||
|
||||
@@ -969,6 +969,14 @@ register_model_group(
|
||||
DownloadSource.DEFAULT: "zai-org/GLM-4.1V-9B-Thinking",
|
||||
DownloadSource.MODELSCOPE: "ZhipuAI/GLM-4.1V-9B-Thinking",
|
||||
},
|
||||
"GLM-4.6V": {
|
||||
DownloadSource.DEFAULT: "zai-org/GLM-4.6V",
|
||||
DownloadSource.MODELSCOPE: "ZhipuAI/GLM-4.6V",
|
||||
},
|
||||
"GLM-4.6V-Flash": {
|
||||
DownloadSource.DEFAULT: "zai-org/GLM-4.6V-Flash",
|
||||
DownloadSource.MODELSCOPE: "ZhipuAI/GLM-4.6V-Flash",
|
||||
},
|
||||
},
|
||||
template="glm4v",
|
||||
multimodal=True,
|
||||
|
||||
@@ -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