1
0
Fork 0
mirror of https://github.com/p-e-w/heretic.git synced 2026-12-03 18:42:57 +07:00

[GH-ISSUE #343] Version mismatch issues with kernels package #185

Closed
opened 2026-11-01 04:18:24 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @p-e-w on GitHub (Jun 2, 2026).
Original GitHub issue: https://github.com/p-e-w/heretic/issues/343

I have received two reports of issues with the kernels package. Resolving those is not trivial, because kernels is required by Transformers for inference with some models (e.g. GPT-OSS), but is annoyingly not a dependency of Transformers.

/cc @Vinay-Umrethe

Originally created by @p-e-w on GitHub (Jun 2, 2026). Original GitHub issue: https://github.com/p-e-w/heretic/issues/343 I have received two reports of issues with the `kernels` package. Resolving those is not trivial, because `kernels` is required by Transformers for inference with some models (e.g. GPT-OSS), but is annoyingly **not** a dependency of Transformers. /cc @Vinay-Umrethe
bsakaguchi 2026-11-01 04:18:24 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@Vinay-Umrethe commented on GitHub (Jun 2, 2026):

Full Log

heretic --model Qwen/Qwen3.5-4B --batch-size 128
Traceback (most recent call last):
  File "/usr/local/bin/heretic", line 3, in <module>
    from heretic.main import main
  File "/usr/local/lib/python3.12/site-packages/heretic/main.py", line 64, in <module>
    from .analyzer import Analyzer
  File "/usr/local/lib/python3.12/site-packages/heretic/analyzer.py", line 16, in <module>
    from .model import Model
  File "/usr/local/lib/python3.12/site-packages/heretic/model.py", line 13, in <module>
    from peft import LoraConfig, PeftModel, get_peft_model
  File "/usr/local/lib/python3.12/site-packages/peft/__init__.py", line 17, in <module>
    from .auto import (
  File "/usr/local/lib/python3.12/site-packages/peft/auto.py", line 31, in <module>
    from .config import PeftConfig
  File "/usr/local/lib/python3.12/site-packages/peft/config.py", line 30, in <module>
    from .utils import CONFIG_NAME, PeftType, TaskType
  File "/usr/local/lib/python3.12/site-packages/peft/utils/__init__.py", line 15, in <module>
    from .constants import ALLOWED_COMPUTE_DTYPES, UPCAST_DTYPES
  File "/usr/local/lib/python3.12/site-packages/peft/utils/constants.py", line 16, in <module>
    from transformers import BloomPreTrainedModel
  File "<frozen importlib._bootstrap>", line 1412, in _handle_fromlist
  File "/usr/local/lib/python3.12/site-packages/transformers/utils/import_utils.py", line 2249, in __getattr__
    module = self._get_module(self._class_to_module[name])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/transformers/utils/import_utils.py", line 2483, in _get_module
    raise e
  File "/usr/local/lib/python3.12/site-packages/transformers/utils/import_utils.py", line 2481, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/transformers/models/bloom/modeling_bloom.py", line 26, in <module>
    from ...modeling_layers import GradientCheckpointingLayer
  File "/usr/local/lib/python3.12/site-packages/transformers/modeling_layers.py", line 27, in <module>
    from .processing_utils import Unpack
  File "/usr/local/lib/python3.12/site-packages/transformers/processing_utils.py", line 63, in <module>
    from .utils.type_validators import (
  File "/usr/local/lib/python3.12/site-packages/transformers/utils/type_validators.py", line 19, in <module>
    from ..activations import ACT2FN
  File "/usr/local/lib/python3.12/site-packages/transformers/activations.py", line 22, in <module>
    from .integrations.hub_kernels import use_kernel_forward_from_hub
  File "/usr/local/lib/python3.12/site-packages/transformers/integrations/hub_kernels.py", line 89, in <module>
    "cuda": LayerRepository(
            ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/kernels/layer/layer.py", line 76, in __init__
    raise ValueError("Either a revision or a version must be specified.")
ValueError: Either a revision or a version must be specified.

Current Fix

pip uninstall kernels -y
█░█░█▀▀░█▀▄░█▀▀░▀█▀░█░█▀▀  v1.3.0
█▀█░█▀▀░█▀▄░█▀▀░░█░░█░█░░
▀░▀░▀▀▀░▀░▀░▀▀▀░░▀░░▀░▀▀▀  https://github.com/p-e-w/heretic

Detected 1 CUDA device(s) (94.97 GB total VRAM)
CUDA Version: 13.0
Driver Version: 580.95.05
* CUDA 0: NVIDIA RTX PRO 6000 Blackwell Server Edition (94.97 GB)

Loading model Qwen/Qwen3.5-4B...
* Trying dtype auto...
* LoRA adapters initialized (target types: down_proj, o_proj, out_proj)
* Transformer model with 32 layers
* Abliterable components:
  * attn.o_proj: 32 modules total
  * mlp.down_proj: 32 modules total

Note

This does not seem to be a Heretic problem, rather something is wrong with transformers / huggingface_hub / kernels version range conflicts

Not sure how its required for gpt-oss models, but newer transformers versions' modeling code might be depending on kernels for some faster work

<!-- gh-comment-id:4603029385 --> @Vinay-Umrethe commented on GitHub (Jun 2, 2026): ### Full Log ```bash heretic --model Qwen/Qwen3.5-4B --batch-size 128 ``` ```bash Traceback (most recent call last): File "/usr/local/bin/heretic", line 3, in <module> from heretic.main import main File "/usr/local/lib/python3.12/site-packages/heretic/main.py", line 64, in <module> from .analyzer import Analyzer File "/usr/local/lib/python3.12/site-packages/heretic/analyzer.py", line 16, in <module> from .model import Model File "/usr/local/lib/python3.12/site-packages/heretic/model.py", line 13, in <module> from peft import LoraConfig, PeftModel, get_peft_model File "/usr/local/lib/python3.12/site-packages/peft/__init__.py", line 17, in <module> from .auto import ( File "/usr/local/lib/python3.12/site-packages/peft/auto.py", line 31, in <module> from .config import PeftConfig File "/usr/local/lib/python3.12/site-packages/peft/config.py", line 30, in <module> from .utils import CONFIG_NAME, PeftType, TaskType File "/usr/local/lib/python3.12/site-packages/peft/utils/__init__.py", line 15, in <module> from .constants import ALLOWED_COMPUTE_DTYPES, UPCAST_DTYPES File "/usr/local/lib/python3.12/site-packages/peft/utils/constants.py", line 16, in <module> from transformers import BloomPreTrainedModel File "<frozen importlib._bootstrap>", line 1412, in _handle_fromlist File "/usr/local/lib/python3.12/site-packages/transformers/utils/import_utils.py", line 2249, in __getattr__ module = self._get_module(self._class_to_module[name]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/transformers/utils/import_utils.py", line 2483, in _get_module raise e File "/usr/local/lib/python3.12/site-packages/transformers/utils/import_utils.py", line 2481, in _get_module return importlib.import_module("." + module_name, self.__name__) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/transformers/models/bloom/modeling_bloom.py", line 26, in <module> from ...modeling_layers import GradientCheckpointingLayer File "/usr/local/lib/python3.12/site-packages/transformers/modeling_layers.py", line 27, in <module> from .processing_utils import Unpack File "/usr/local/lib/python3.12/site-packages/transformers/processing_utils.py", line 63, in <module> from .utils.type_validators import ( File "/usr/local/lib/python3.12/site-packages/transformers/utils/type_validators.py", line 19, in <module> from ..activations import ACT2FN File "/usr/local/lib/python3.12/site-packages/transformers/activations.py", line 22, in <module> from .integrations.hub_kernels import use_kernel_forward_from_hub File "/usr/local/lib/python3.12/site-packages/transformers/integrations/hub_kernels.py", line 89, in <module> "cuda": LayerRepository( ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/kernels/layer/layer.py", line 76, in __init__ raise ValueError("Either a revision or a version must be specified.") ValueError: Either a revision or a version must be specified. ``` ### Current Fix ```bash pip uninstall kernels -y ``` ```bash █░█░█▀▀░█▀▄░█▀▀░▀█▀░█░█▀▀ v1.3.0 █▀█░█▀▀░█▀▄░█▀▀░░█░░█░█░░ ▀░▀░▀▀▀░▀░▀░▀▀▀░░▀░░▀░▀▀▀ https://github.com/p-e-w/heretic Detected 1 CUDA device(s) (94.97 GB total VRAM) CUDA Version: 13.0 Driver Version: 580.95.05 * CUDA 0: NVIDIA RTX PRO 6000 Blackwell Server Edition (94.97 GB) Loading model Qwen/Qwen3.5-4B... * Trying dtype auto... * LoRA adapters initialized (target types: down_proj, o_proj, out_proj) * Transformer model with 32 layers * Abliterable components: * attn.o_proj: 32 modules total * mlp.down_proj: 32 modules total ``` > [!NOTE] > This does not seem to be a Heretic problem, rather something is wrong with `transformers / huggingface_hub / kernels` version range conflicts Not sure how its required for gpt-oss models, but newer transformers versions' modeling code might be depending on `kernels` for some faster work
Author
Owner

@p-e-w commented on GitHub (Jun 4, 2026):

I have fully understood, and fixed, this issue.

Transformers doesn't depend on kernels by default, but because some models require it, kernels is specified as an extra dependency in setup.py.

The supported version range is

kernels>=0.12.0,<0.13

whereas we had

kernels~=0.13

These two version specifications are in conflict.

However, since we only install kernels in support of Transformers, this is easily fixed by removing our dependency on kernels, and installing Transformers with the kernels extra instead, which is guaranteed to pull in a compatible version.

<!-- gh-comment-id:4619748882 --> @p-e-w commented on GitHub (Jun 4, 2026): I have fully understood, and fixed, this issue. Transformers doesn't depend on `kernels` by default, but because some models require it, `kernels` is specified as an **extra dependency** in `setup.py`. The supported version range is ``` kernels>=0.12.0,<0.13 ``` whereas we had ``` kernels~=0.13 ``` These two version specifications are in conflict. However, since we only install `kernels` in support of Transformers, this is easily fixed by removing our dependency on `kernels`, and installing Transformers with the `kernels` extra instead, which is guaranteed to pull in a compatible version.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
p-e-w/heretic#185
No description provided.