Remove bitsandbytes `_check_is_size` warning filter once the minimum required bitsandbytes is >= 0.50.0
- Dominant language
- Python
- Stars
- 19.3k
- Forks
- 3k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 194
Description
### What
`test_peft_with_quantization` in the DPO, KTO, and SFT trainer tests emits a benign `FutureWarning` in CI when loading a bitsandbytes-quantized model:
```
bitsandbytes/backends/cuda/ops.py:213: FutureWarning: _check_is_size will be removed in a future PyTorch release along with guard_size_oblivious. Use _check(i >= 0) instead.
torch._check_is_size(blocksize)
```
Affected tests:
- `tests/test_dpo_trainer.py::TestDPOTrainer::test_peft_with_quantization`
- `tests/test_kto_trainer.py::TestKTOTrainer::test_peft_with_quantization`
- `tests/test_sft_trainer.py::TestSFTTrainer::test_peft_with_quantization`
### Root cause
The warning originates in `bitsandbytes`, not TRL. Its CUDA quantization ops call the deprecated `torch._check_is_size(blocksize)`. PyTorch has deprecated `torch._check_is_size` (along with `guard_size_oblivious`) in favor of `torch._check(i >= 0)`, and emits a `FutureWarning`. TRL only triggers it indirectly by loading a 4-bit/8-bit quantized model in these PEFT + quantization tests; there is nothing actionable on the TRL side.
### Upstream status
Already fixed upstream by replacing the deprecated call: https://github.com/bitsandbytes-foundation/bitsandbytes/pull/1940 (merged 2026-05-07).
The fix is **merged but unreleased** — the latest numbered release is `0.49.2` (which predates the fix); it is currently only in the `continuous-release_main` rolling build. TRL requires `bitsandbytes` with no version pin.
### Workaround in place
We suppress the warning via `filterwarnings` in `pyproject.toml`:
```toml
"ignore:_check_is_size will be removed in a future PyTorch release:FutureWarning",
```
### Action item
The fix is released in `bitsandbytes` 0.50.0. Since `pyproject.toml` declares `bitsandbytes` with no lower bound, older releases remain supported configurations and can still emit the warning, so the filter must stay.
Remove the `filterwarnings` entry once TRL's minimum required `bitsandbytes` is `>= 0.50.0`. Do not bump the floor solely to drop this filter: wait for an independent reason to require 0.50.0.
Contributor guide
Research direction
Start by reading the bitsandbytes requirement and filterwarnings entry in pyproject.toml, then review the three named quantization tests. Confirm that an independent change has raised the minimum supported version to 0.50.0; done means the matching warning filter is removed without changing the dependency floor solely for this issue, and the affected tests remain clean.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning, testing-qa
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100