Skip to content

[ci] fix timm import error#31795

Closed
andyxning wants to merge 1 commit intovllm-project:mainfrom
andyxning:fix_timm_import_error
Closed

[ci] fix timm import error#31795
andyxning wants to merge 1 commit intovllm-project:mainfrom
andyxning:fix_timm_import_error

Conversation

@andyxning
Copy link
Copy Markdown
Contributor

@andyxning andyxning commented Jan 6, 2026

Purpose

Fix ci failure in #29493. It seems that timm 1.0.23 version has a bug so we need to pin 1.0.22 version as a workaround.

[2026-01-06T06:29:51Z] =================================== FAILURES ===================================
--
[2026-01-06T06:29:51Z] __ test_processing_correctness[1.0-32-0.3-nvidia/NVIDIA-Nemotron-Parse-v1.1] ___
[2026-01-06T06:29:51Z]
[2026-01-06T06:29:51Z] model_id = 'nvidia/NVIDIA-Nemotron-Parse-v1.1', hit_rate = 0.3, num_batches = 32
[2026-01-06T06:29:51Z] simplify_rate = 1.0
[2026-01-06T06:29:51Z]
[2026-01-06T06:29:51Z]     @pytest.mark.parametrize("model_id", get_model_ids_to_test())
[2026-01-06T06:29:51Z]     @pytest.mark.parametrize("hit_rate", [0.3, 0.5, 1.0])
[2026-01-06T06:29:51Z]     @pytest.mark.parametrize("num_batches", [32])
[2026-01-06T06:29:51Z]     @pytest.mark.parametrize("simplify_rate", [1.0])
[2026-01-06T06:29:51Z]     def test_processing_correctness(
[2026-01-06T06:29:51Z]         model_id: str,
[2026-01-06T06:29:51Z]         hit_rate: float,
[2026-01-06T06:29:51Z]         num_batches: int,
[2026-01-06T06:29:51Z]         simplify_rate: float,
[2026-01-06T06:29:51Z]     ):
[2026-01-06T06:29:51Z]         if model_id == "google/gemma-3n-E2B-it":
[2026-01-06T06:29:51Z]             pytest.skip("Fix later")
[2026-01-06T06:29:51Z]         if model_id == "OpenGVLab/InternVL2-2B":
[2026-01-06T06:29:51Z]             pytest.skip("Fix later")
[2026-01-06T06:29:51Z]         if model_id == "jinaai/jina-reranker-m0":
[2026-01-06T06:29:51Z]             pytest.skip("Fix later")
[2026-01-06T06:29:51Z]
[2026-01-06T06:29:51Z] >       _test_processing_correctness(
[2026-01-06T06:29:51Z]             model_id,
[2026-01-06T06:29:51Z]             hit_rate=hit_rate,
[2026-01-06T06:29:51Z]             num_batches=num_batches,
[2026-01-06T06:29:51Z]             simplify_rate=simplify_rate,
[2026-01-06T06:29:51Z]         )
[2026-01-06T06:29:51Z]
[2026-01-06T06:29:51Z] models/multimodal/processing/test_common.py:408:
--
[2026-01-06T06:29:51Z] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[2026-01-06T06:29:51Z] models/multimodal/processing/test_common.py:235: in _test_processing_correctness
[2026-01-06T06:29:51Z]     model_config = ModelConfig(
[2026-01-06T06:29:51Z] /opt/venv/lib/python3.12/site-packages/vllm/config/model.py:465: in __post_init__
[2026-01-06T06:29:51Z]     hf_config = get_config(
[2026-01-06T06:29:51Z] /opt/venv/lib/python3.12/site-packages/vllm/transformers_utils/config.py:635: in get_config
[2026-01-06T06:29:51Z]     config_dict, config = config_parser.parse(
[2026-01-06T06:29:51Z] /opt/venv/lib/python3.12/site-packages/vllm/transformers_utils/config.py:168: in parse
[2026-01-06T06:29:51Z]     config = AutoConfig.from_pretrained(
[2026-01-06T06:29:51Z] /opt/venv/lib/python3.12/site-packages/transformers/models/auto/configuration_auto.py:1350: in from_pretrained
[2026-01-06T06:29:51Z]     return config_class.from_pretrained(pretrained_model_name_or_path, **kwargs)
[2026-01-06T06:29:51Z]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2026-01-06T06:29:51Z] /opt/venv/lib/python3.12/site-packages/transformers/configuration_utils.py:640: in from_pretrained
[2026-01-06T06:29:51Z]     return cls.from_dict(config_dict, **kwargs)
[2026-01-06T06:29:51Z]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2026-01-06T06:29:51Z] /opt/venv/lib/python3.12/site-packages/transformers/configuration_utils.py:808: in from_dict
[2026-01-06T06:29:51Z]     config = cls(**config_dict)
[2026-01-06T06:29:51Z]              ^^^^^^^^^^^^^^^^^^
[2026-01-06T06:29:51Z] /fsx/hf_cache/modules/transformers_modules/nvidia/NVIDIA_hyphen_Nemotron_hyphen_Parse_hyphen_v1_dot_1/1fd01c64cd7197ad6292cf32bb2fe684991edc3a/hf_nemotron_parse_config.py:113: in __init__
--
[2026-01-06T06:29:51Z]     vision_auto_config = get_class_from_dynamic_module(*encoder["auto_map"]["AutoConfig"].split("--")[::-1])
[2026-01-06T06:29:51Z]                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2026-01-06T06:29:51Z] /opt/venv/lib/python3.12/site-packages/transformers/dynamic_module_utils.py:616: in get_class_from_dynamic_module
[2026-01-06T06:29:51Z]     return get_class_in_module(class_name, final_module, force_reload=force_download)
[2026-01-06T06:29:51Z]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2026-01-06T06:29:51Z] /opt/venv/lib/python3.12/site-packages/transformers/dynamic_module_utils.py:311: in get_class_in_module
[2026-01-06T06:29:51Z]     module_spec.loader.exec_module(module)
[2026-01-06T06:29:51Z] <frozen importlib._bootstrap_external>:999: in exec_module
[2026-01-06T06:29:51Z]     ???
[2026-01-06T06:29:51Z] <frozen importlib._bootstrap>:488: in _call_with_frames_removed
[2026-01-06T06:29:51Z]     ???
[2026-01-06T06:29:51Z] /fsx/hf_cache/modules/transformers_modules/nvidia/C_hyphen_RADIOv2_hyphen_H/8136123fd0f00a34e597f619f2c0ee2059de0714/hf_model.py:23: in <module>
[2026-01-06T06:29:51Z]     from .common import RESOURCE_MAP, DEFAULT_VERSION
[2026-01-06T06:29:51Z] /fsx/hf_cache/modules/transformers_modules/nvidia/C_hyphen_RADIOv2_hyphen_H/8136123fd0f00a34e597f619f2c0ee2059de0714/common.py:12: in <module>
[2026-01-06T06:29:51Z]     from .radio_model import Resolution
[2026-01-06T06:29:51Z] /fsx/hf_cache/modules/transformers_modules/nvidia/C_hyphen_RADIOv2_hyphen_H/8136123fd0f00a34e597f619f2c0ee2059de0714/radio_model.py:18: in <module>
[2026-01-06T06:29:51Z]     from . import eradio_model
[2026-01-06T06:29:51Z] /fsx/hf_cache/modules/transformers_modules/nvidia/C_hyphen_RADIOv2_hyphen_H/8136123fd0f00a34e597f619f2c0ee2059de0714/eradio_model.py:24: in <module>
[2026-01-06T06:29:51Z]     from timm.models.layers import trunc_normal_, DropPath, LayerNorm2d
[2026-01-06T06:29:51Z] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[2026-01-06T06:29:51Z]
[2026-01-06T06:29:51Z]     # NOTE timm.models.layers is DEPRECATED, please use timm.layers, this is here to reduce breakages in transition
[2026-01-06T06:29:51Z]     from timm.layers.activations import *
[2026-01-06T06:29:51Z]     from timm.layers.adaptive_avgmax_pool import \
[2026-01-06T06:29:51Z]         adaptive_avgmax_pool2d, select_adaptive_pool2d, AdaptiveAvgMaxPool2d, SelectAdaptivePool2d
[2026-01-06T06:29:51Z] >   from timm.layers.attention_pool2d import AttentionPool2d, RotAttentionPool2d, RotaryEmbedding
[2026-01-06T06:29:51Z] E   ImportError: cannot import name 'RotaryEmbedding' from 'timm.layers.attention_pool2d' (/opt/venv/lib/python3.12/site-packages/timm/layers/attention_pool2d.py)
[2026-01-06T06:29:51Z]
[2026-01-06T06:29:51Z] /opt/venv/lib/python3.12/site-packages/timm/models/layers/__init__.py:5: ImportError


Test Plan

ci

Test Result

ci pass.

Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

Signed-off-by: Andy Xie <andy.xning@gmail.com>
@mergify mergify bot added the ci/build label Jan 6, 2026
@DarkLight1337
Copy link
Copy Markdown
Member

It should be fixed by #31764 already

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses a CI failure by pinning the timm package to version 1.0.22. The fix is implemented by adding a pip install command directly into two separate Buildkite CI configuration files. While this resolves the immediate import error, it introduces a maintenance issue by hardcoding and duplicating the dependency version across CI scripts. My review recommends centralizing this dependency management within the project's requirements files for better long-term maintainability.

no_gpu: true
commands:
- "pip install git+https://github.com/TIGER-AI-Lab/Mantis.git || echo 'Mantis installation skipped (decord not available on CPU-only environment)'"
- pip install timm==1.0.22
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While pinning timm==1.0.22 correctly fixes the import error, installing it directly in the CI script is not ideal for long-term maintainability, especially since this change is duplicated in another file (.buildkite/test_areas/models_multimodal.yaml).

A better approach would be to manage this dependency in a centralized requirements file. Please consider updating requirements/test.in to specify timm==1.0.22, and then regenerate requirements/test.txt. This will ensure consistency and make future dependency management easier.

no_gpu: true
commands:
- pip install git+https://github.com/TIGER-AI-Lab/Mantis.git
- pip install timm==1.0.22
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

As mentioned in the comment for .buildkite/test-pipeline.yaml, hardcoding the timm version here creates duplication and a maintenance burden. It would be best to consolidate this dependency pin into the requirements/test.in file and regenerate the corresponding requirements.txt.

@andyxning andyxning closed this Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants