Skip to content

Conversation

@mfuntowicz
Copy link
Member

@mfuntowicz mfuntowicz commented Nov 3, 2025

This PR attempts to bring an opt-out mecanism to disable hub kernels (aka kernels) globally through transformers.

The default value for the USE_HUB_KERNELS environment variable defaults to YES to maintain backward compatiblity with the current machinery.

In more details, it works by proxying the kernels.use_kernel_forward_from_hub method to include our _kernels_enabled branching logic. In case of _kernels_enabled == False, the function use_kernel_forward_from_hub will return an identity decorator which should just default to the current class the decorator is attached to.

I added tests to a new folder integrations.tests_hub_kernels.py to match the layout structure of the sources folder.
Let me know if it was not the correct way to do, will swizzle at the right place.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@mfuntowicz mfuntowicz force-pushed the kernels-opt-out-flag branch from 450ccab to 7c963b3 Compare November 3, 2025 15:44
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.

3 participants