chore: upgrade transformers 4.52.3 (#6575)

Co-authored-by: Mick <mickjagger19@icloud.com>
This commit is contained in:
Yineng Zhang
2025-05-25 22:49:58 -07:00
committed by GitHub
co-authored by Mick
parent 84147254c9
commit 7eb9d8e594
5 changed files with 152 additions and 125 deletions
+8 -12
View File
@@ -7,11 +7,8 @@ import sentencepiece as spm
from transformers import (
TOKENIZER_MAPPING,
LlamaConfig,
Phi3Config,
PretrainedConfig,
PreTrainedTokenizer,
PreTrainedTokenizerFast,
Qwen2Config,
)
from sglang.utils import logger
@@ -302,24 +299,23 @@ class InternVLChatConfig(PretrainedConfig):
)
if llm_config is None:
# TODO: There might still be a bug in transformers version 4.44 and above.
llm_config = {"architectures": [""]}
llm_config = {"architectures": ["InternLM2ForCausalLM"]}
logger.info(
"llm_config is None. Initializing the LlamaConfig config with default values (`LlamaConfig`)."
)
self.vision_config = InternVisionConfig(**vision_config)
if llm_config["architectures"][0] == "LlamaForCausalLM":
if llm_config.get("architectures")[0] == "LlamaForCausalLM":
self.llm_config = LlamaConfig(**llm_config)
elif llm_config["architectures"][0] == "InternLM2ForCausalLM":
elif llm_config.get("architectures")[0] == "InternLM2ForCausalLM":
self.llm_config = InternLM2Config(**llm_config)
elif llm_config["architectures"][0] == "Phi3ForCausalLM":
self.llm_config = Phi3Config(**llm_config)
elif llm_config["architectures"][0] == "Qwen2ForCausalLM":
self.llm_config = Qwen2Config(**llm_config)
else:
raise ValueError(
"Unsupported architecture: {}".format(llm_config["architectures"][0])
"Unsupported architecture: {}".format(
llm_config.get("architectures")[0]
)
)
self.use_backbone_lora = use_backbone_lora
self.use_llm_lora = use_llm_lora
self.pad2square = pad2square