Skip to content

fix: add kernel version#675

Open
sdiazlor wants to merge 3 commits into
mainfrom
fix/kernel-version-required
Open

fix: add kernel version#675
sdiazlor wants to merge 3 commits into
mainfrom
fix/kernel-version-required

Conversation

@sdiazlor

@sdiazlor sdiazlor commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Description

Transformers (even dev or >=5.0) is not compatible with kernels>=0.15.
It raises the following error in tests:

ImportError while loading conftest '/home/runner/work/prunatree/prunatree/pruna/tests/conftest.py'.
tests/conftest.py:6: in <module>
    from .fixtures import *  # noqa: F403, F401
    ^^^^^^^^^^^^^^^^^^^^^^^
tests/fixtures.py:9: in <module>
    from transformers import AutoModelForCausalLM, AutoModelForImageTextToText, AutoProcessor, AutoTokenizer, pipeline
../.venv/lib/python3.11/site-packages/transformers/utils/import_utils.py:2045: in __getattr__
    module = self._get_module(self._class_to_module[name])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../.venv/lib/python3.11/site-packages/transformers/utils/import_utils.py:2239: in _get_module
    raise e
../.venv/lib/python3.11/site-packages/transformers/utils/import_utils.py:2237: in _get_module
    return importlib.import_module("." + module_name, self.__name__)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../.venv/lib/python3.11/site-packages/transformers/models/auto/processing_auto.py:25: in <module>
    from ...image_processing_utils import ImageProcessingMixin
../.venv/lib/python3.11/site-packages/transformers/image_processing_utils.py:23: in <module>
    from .processing_utils import ImagesKwargs, Unpack
../.venv/lib/python3.11/site-packages/transformers/processing_utils.py:79: in <module>
    from .modeling_utils import PreTrainedAudioTokenizerBase
../.venv/lib/python3.11/site-packages/transformers/modeling_utils.py:73: in <module>
    from .integrations.hub_kernels import is_kernel
../.venv/lib/python3.11/site-packages/transformers/integrations/hub_kernels.py:88: in <module>
    "cuda": LayerRepository(
../.venv/lib/python3.11/site-packages/kernels/layer/layer.py:76: in __init__
    raise ValueError("Either a revision or a version must be specified.")
E   ValueError: Either a revision or a version must be specified.

This us due to the kernel version requirement: https://github.com/huggingface/kernels/releases/tag/v0.15.1

To fix it:

  • Pin the kernels version until compatibility
  • Add the version for following updates

Related in prunatree: https://github.com/PrunaAI/prunatree/pull/470

No fixes btm on HF: huggingface/transformers#46291

Fixes #(issue number)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactor (no functional change)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Testing

  • I added or updated tests covering my changes
  • Existing tests pass locally (uv run pytest -m "cpu and not slow")

For full setup and testing instructions, see the Contributing Guide.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code, especially for agent-assisted changes
  • I updated the documentation where necessary

Thanks for contributing to Pruna! We're excited to review your work.

New to contributing? Check out our Contributing Guide for everything you need to get started.

Note:

  • Draft PRs or PRs without a clear and detailed overview may be delayed.
  • Please mark your PR as Ready for Review and ensure the sections above are filled out.
  • Contributions that are entirely AI-generated without meaningful human review are discouraged.

@sdiazlor sdiazlor marked this pull request as ready for review June 9, 2026 08:19
@github-actions github-actions Bot requested review from gsprochette and llcnt June 9, 2026 08:20
@sdiazlor sdiazlor requested review from johannaSommer and removed request for llcnt June 9, 2026 08:20

@gsprochette gsprochette left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hello ! I just have some questions on the two changes. It looks super good but I need to understand what's going on before I can approve :)

Comment thread src/pruna/algorithms/flash_attn3.py
Comment thread pyproject.toml Outdated
"piq",
"opencv-python",
"kernels",
"kernels<=0.14.1",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm not super sure why we need to pin a max version if the problem was that we need to specify a version as of 15.1 and this PR is doing that. Is there still a bug even after specifying a version?
Also, why 14.1?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ah ok I only now understood that transformers itself doesn't yet specify versions yet so we do this until they specify versions in a new release, perfect 👍

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's just leave a comment explaining the reason of the pin I would say

@gsprochette gsprochette self-requested a review June 13, 2026 08:30

@gsprochette gsprochette left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I understood the answer to my question only after my first review. I left two comments:

  • first is just double check on the FA3 kernel version and tests
  • second is me getting confused and finally just asking for a comment :)

Is there a plan to make transformers compatible with kernels>=15.1 on the HF side? Like is there an open PR or an issue we can reference and check in the future if it's time to remove the kernels pin?

Thanks a lot for finding this bug and fixing it :)

Comment thread pyproject.toml Outdated
"piq",
"opencv-python",
"kernels",
"kernels<=0.14.1",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's just leave a comment explaining the reason of the pin I would say

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants