Upgrade transformers to v4.50.3 (#13905)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
+37
-11
@@ -34,6 +34,16 @@ class _HfExamplesInfo:
|
||||
The minimum version of HF Transformers that is required to run this model.
|
||||
"""
|
||||
|
||||
max_transformers_version: Optional[str] = None
|
||||
"""
|
||||
The maximum version of HF Transformers that this model runs on.
|
||||
"""
|
||||
|
||||
transformers_version_reason: Optional[str] = None
|
||||
"""
|
||||
The reason for the minimum/maximum version requirement.
|
||||
"""
|
||||
|
||||
is_available_online: bool = True
|
||||
"""
|
||||
Set this to ``False`` if the name of this architecture no longer exists on
|
||||
@@ -57,21 +67,28 @@ class _HfExamplesInfo:
|
||||
If the installed transformers version does not meet the requirements,
|
||||
perform the given action.
|
||||
"""
|
||||
if self.min_transformers_version is None:
|
||||
if (self.min_transformers_version is None
|
||||
and self.max_transformers_version is None):
|
||||
return
|
||||
|
||||
current_version = TRANSFORMERS_VERSION
|
||||
required_version = self.min_transformers_version
|
||||
if Version(current_version) < Version(required_version):
|
||||
msg = (
|
||||
f"You have `transformers=={current_version}` installed, but "
|
||||
f"`transformers>={required_version}` is required to run this "
|
||||
"model")
|
||||
min_version = self.min_transformers_version
|
||||
max_version = self.max_transformers_version
|
||||
msg = f"`transformers=={current_version}` installed, but `transformers"
|
||||
if min_version and Version(current_version) < Version(min_version):
|
||||
msg += f">={min_version}` is required to run this model."
|
||||
elif max_version and Version(current_version) > Version(max_version):
|
||||
msg += f"<={max_version}` is required to run this model."
|
||||
else:
|
||||
return
|
||||
|
||||
if on_fail == "error":
|
||||
raise RuntimeError(msg)
|
||||
else:
|
||||
pytest.skip(msg)
|
||||
if self.transformers_version_reason:
|
||||
msg += f" Reason: {self.transformers_version_reason}"
|
||||
|
||||
if on_fail == "error":
|
||||
raise RuntimeError(msg)
|
||||
else:
|
||||
pytest.skip(msg)
|
||||
|
||||
def check_available_online(
|
||||
self,
|
||||
@@ -245,6 +262,9 @@ _MULTIMODAL_EXAMPLE_MODELS = {
|
||||
"Blip2ForConditionalGeneration": _HfExamplesInfo("Salesforce/blip2-opt-2.7b"), # noqa: E501
|
||||
"ChameleonForConditionalGeneration": _HfExamplesInfo("facebook/chameleon-7b"), # noqa: E501
|
||||
"DeepseekVLV2ForCausalLM": _HfExamplesInfo("deepseek-ai/deepseek-vl2-tiny", # noqa: E501
|
||||
extras={"fork": "Isotr0py/deepseek-vl2-tiny"}, # noqa: E501
|
||||
max_transformers_version="4.48", # noqa: E501
|
||||
transformers_version_reason="HF model is not compatible.", # noqa: E501
|
||||
hf_overrides={"architectures": ["DeepseekVLV2ForCausalLM"]}), # noqa: E501
|
||||
"FuyuForCausalLM": _HfExamplesInfo("adept/fuyu-8b"),
|
||||
"Gemma3ForConditionalGeneration": _HfExamplesInfo("google/gemma-3-4b-it",
|
||||
@@ -266,13 +286,19 @@ _MULTIMODAL_EXAMPLE_MODELS = {
|
||||
"LlavaNextVideoForConditionalGeneration": _HfExamplesInfo("llava-hf/LLaVA-NeXT-Video-7B-hf"), # noqa: E501
|
||||
"LlavaOnevisionForConditionalGeneration": _HfExamplesInfo("llava-hf/llava-onevision-qwen2-0.5b-ov-hf"), # noqa: E501
|
||||
"MantisForConditionalGeneration": _HfExamplesInfo("TIGER-Lab/Mantis-8B-siglip-llama3", # noqa: E501
|
||||
max_transformers_version="4.48", # noqa: E501
|
||||
transformers_version_reason="HF model is not compatible.", # noqa: E501
|
||||
hf_overrides={"architectures": ["MantisForConditionalGeneration"]}), # noqa: E501
|
||||
"MiniCPMO": _HfExamplesInfo("openbmb/MiniCPM-o-2_6",
|
||||
max_transformers_version="4.48",
|
||||
transformers_version_reason="Use of deprecated imports which have been removed.", # noqa: E501
|
||||
trust_remote_code=True),
|
||||
"MiniCPMV": _HfExamplesInfo("openbmb/MiniCPM-Llama3-V-2_5",
|
||||
extras={"2.6": "openbmb/MiniCPM-V-2_6"}, # noqa: E501
|
||||
trust_remote_code=True),
|
||||
"MolmoForCausalLM": _HfExamplesInfo("allenai/Molmo-7B-D-0924",
|
||||
max_transformers_version="4.48",
|
||||
transformers_version_reason="Use of private method which no longer exists.", # noqa: E501
|
||||
extras={"olmo": "allenai/Molmo-7B-O-0924"}, # noqa: E501
|
||||
trust_remote_code=True),
|
||||
"NVLM_D": _HfExamplesInfo("nvidia/NVLM-D-72B",
|
||||
|
||||
Reference in New Issue
Block a user