Skip to content

chore: Migrate to transformers v5 (with v4 fallback for distill)#258

Merged
rmitsch merged 1 commit into
mainfrom
chore/update-dependencies
May 1, 2026
Merged

chore: Migrate to transformers v5 (with v4 fallback for distill)#258
rmitsch merged 1 commit into
mainfrom
chore/update-dependencies

Conversation

@rmitsch
Copy link
Copy Markdown
Collaborator

@rmitsch rmitsch commented May 1, 2026

Description

Migrate sieves to allow transformers v5 while keeping the [distill] extra on v4 until setfit ships v5 support.

Related Issues

-

Changes Made

  • Loosen the base transformers pin to >=4,<6 so downstream installs of bare sieves resolve to v5.
  • Cap the [distill] extra at transformers<5 because setfit 1.1.3 (latest, Nov 2024) imports default_logdir from transformers.training_args, a symbol removed in v5. Drop this cap once setfit ships v5 support.
  • Fix a latent bug in the HuggingFace zero-shot wrapper: mode="multi" was never a real pipeline kwarg and was silently ignored, meaning multi-label classification was always running in single-label mode. Replaced with the documented multi_label=True (works on both v4 and v5).
  • Add a new [optimization] extra for optuna (now required by dspy's MIPROv2 optimizer; previously a transitive dep).
  • Bump version to 1.0.3.

Downstream behavior: pip install sieves → transformers v5; pip install sieves[distill] → transformers v4. Sieves' own CI runs against v4 because the universal lockfile intersects both extras (acceptable trade-off given the minimal transformers integration surface in this repo — see comment in .github/workflows/test.yml).

Checklist

  • Tests have been extended to cover changes in functionality
  • Existing and new tests succeed
  • Documentation updated (if applicable)
  • Related issues linked

Screenshots/Examples (if applicable)

🤖 Generated with Claude Code

- Loosen base pin to transformers[torch]>=4,<6 so downstream installs
  pick v5 by default.
- Cap the [distill] extra at transformers<5 because setfit 1.1.3 still
  imports the removed transformers.training_args.default_logdir symbol.
  Drop this cap once setfit ships v5 support.
- Fix latent bug in HuggingFace zero-shot wrapper: replace bogus
  mode="multi" kwarg (silently ignored) with multi_label=True.
- Add new [optimization] extra for optuna (now required by DSPy MIPROv2).
- Bump version to 1.0.3.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rmitsch rmitsch marked this pull request as draft May 1, 2026 08:36
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 1, 2026

Greptile Summary

This PR loosens the base transformers pin to >=4,<6 to allow v5 installs while capping the [distill] extra at <5 due to a setfit v5 incompatibility. It also fixes a latent bug where mode="multi" was silently ignored in the HuggingFace zero-shot wrapper (replaced with the documented multi_label=True), and adds a new [optimization] extra for optuna.

The issues raised in previous review threads — the multi_label kwarg conflict with _inference_kwargs, the strict version equality in validate_init_params, and the duplicate pre-commit entry — remain unaddressed in this revision.

Confidence Score: 4/5

Safe to merge with minor pre-existing issues; no new P0/P1 bugs introduced by this PR.

No new critical issues are introduced. The three previously flagged concerns (multi_label kwarg conflict, strict version equality check, duplicate pre-commit entry) remain open but are all P2 or pre-existing P2 items. The core dependency strategy is sound and well-commented.

sieves/model_wrappers/huggingface_.py and sieves/serialization.py have pre-existing P2 concerns from prior review threads that remain unaddressed.

Important Files Changed

Filename Overview
sieves/model_wrappers/huggingface_.py Fixes latent bug by replacing non-existent mode="multi" with multi_label=True; the fix is correct but placing the kwarg before **self._inference_kwargs prevents callers from overriding it (already flagged separately).
pyproject.toml Loosens transformers pin to >=4,<6, adds [optimization] extra for optuna, constrains [distill] to transformers <5, and adds rolling exclude-newer = "3 days" uv config; duplicate pre-commit entry remains (flagged separately).
sieves/serialization.py Version string bumped to 1.0.3; strict equality check in validate_init_params means configs saved with 1.0.2 will fail to deserialize (flagged in previous thread).
.github/workflows/test.yml Adds optimization to the install extras and documents the intentional v4 constraint imposed by the distill extra in CI.
uv.lock Lockfile regenerated to pick up dependency updates; adds exclude-newer-span and platform-specific resolution markers alongside many package version bumps.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["pip install sieves"] --> B["transformers>=4,<6\n(v5 resolved)"]
    C["pip install sieves[distill]"] --> D["transformers>=4,<5\n(v4 forced by setfit constraint)"]
    E["pip install sieves[optimization]"] --> F["optuna>=4,<5\n(for DSPy MIPROv2)"]
    B --> G["HuggingFace wrapper\nmulti_label=True fix active"]
    D --> H["SetFit / Model2Vec\ntransformers v4 only"]
    CI["CI: sieves[ingestion,distill,optimization,test]"] --> D
    CI --> I["Tests run against\ntransformers v4 only"]
Loading

Reviews (2): Last reviewed commit: "chore: Migrate to transformers v5 (with ..." | Re-trigger Greptile

Comment thread sieves/serialization.py
@codecov
Copy link
Copy Markdown

codecov Bot commented May 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #258   +/-   ##
=======================================
  Coverage   91.99%   91.99%           
=======================================
  Files          80       80           
  Lines        4462     4462           
=======================================
  Hits         4105     4105           
  Misses        357      357           
Files with missing lines Coverage Δ
sieves/model_wrappers/huggingface_.py 91.11% <ø> (ø)
sieves/serialization.py 98.85% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rmitsch rmitsch marked this pull request as ready for review May 1, 2026 08:49
@rmitsch rmitsch merged commit d103d99 into main May 1, 2026
3 checks passed
@rmitsch rmitsch deleted the chore/update-dependencies branch May 1, 2026 08:49
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