Repository navigation
Silence torch._check_is_size FutureWarning and shim it if torch removes it - #7023
Conversation
…es it
bitsandbytes 4-bit dequant calls torch._check_is_size, which torch
deprecated with a FutureWarning ("Use _check(i >= 0) instead") that prints
on every bnb-4bit load. Silence that warning in suppress_cuda_printf, and
add fix_torch_check_is_size so a future torch that removes _check_is_size
gets it shimmed to _check(i >= 0) (honoring the max bound) and bitsandbytes
keeps working.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Lead with what the shim does and drop the redundant line; two lines instead of three, same intent.
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
bitsandbytes 4-bit dequant calls
torch._check_is_size(blocksize)(many sites acrossbitsandbytes/_ops.pyand the CUDA/Triton backends). torch deprecated that function, so every gpt-oss and any bnb-4bit load prints:Change
suppress_cuda_printf, next to the other torch and torchao deprecation filters.fix_torch_check_is_size(): if a future torch removestorch._check_is_size, shim it totorch._check(i >= 0)(honoring the optionalmaxbound) so bitsandbytes keeps working. It is a no-op while torch still provides the function.Wired into
_gpu_init.py. Only bitsandbytes calls_check_is_size; no unsloth or unsloth_zoo code does.Tested
On torch 2.11.0 and 2.12.1: the warning no longer prints after
import unsloth, and with_check_is_sizedeleted the shim recreates it, accepts a valid size, rejects a negative size, and honorsmax.