Skip to content

fix: use correct pydantic le constraint for element_bits#43

Open
shuofengzhang wants to merge 1 commit intoarcee-ai:mainfrom
shuofengzhang:fix/pydantic-field-le-bound
Open

fix: use correct pydantic le constraint for element_bits#43
shuofengzhang wants to merge 1 commit intoarcee-ai:mainfrom
shuofengzhang:fix/pydantic-field-le-bound

Conversation

@shuofengzhang
Copy link
Copy Markdown

@shuofengzhang shuofengzhang commented Mar 15, 2026

What changed

  • Replaced lte=64 with le=64 in QuantizationBin.element_bits (distillkit/compression/config.py).

Why

  • In Pydantic v2, le is the valid keyword for "less than or equal" constraints.
  • lte is treated as an extra/unknown Field argument, which triggers a deprecation warning and does not enforce the intended bound.
  • This change preserves the intended validation behavior (element_bits <= 64) and removes the warning noise.

Testing

  • source .venv/bin/activate && pytest -q
    • Result: 10 passed in 3.20s

Note

Low Risk
Low risk: a one-line Pydantic field constraint fix that restores the intended element_bits <= 64 validation and removes deprecation/extra-arg warnings.

Overview
Fixes QuantizationBin.element_bits validation by replacing the Pydantic field constraint lte=64 with le=64, ensuring the <= 64 bound is actually enforced under Pydantic v2 and avoiding extra/unknown Field-arg warnings.

Written by Cursor Bugbot for commit 579f8fa. This will update automatically on new commits. Configure here.

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.

1 participant