chore: Migrate to transformers v5 (with v4 fallback for distill)#258
Conversation
- 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>
Greptile SummaryThis PR loosens the base The issues raised in previous review threads — the Confidence Score: 4/5Safe 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
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"]
Reviews (2): Last reviewed commit: "chore: Migrate to transformers v5 (with ..." | Re-trigger Greptile |
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
🚀 New features to boost your workflow:
|
Description
Migrate
sievesto allowtransformersv5 while keeping the[distill]extra on v4 untilsetfitships v5 support.Related Issues
-
Changes Made
transformerspin to>=4,<6so downstream installs of baresievesresolve to v5.[distill]extra attransformers<5becausesetfit 1.1.3(latest, Nov 2024) importsdefault_logdirfromtransformers.training_args, a symbol removed in v5. Drop this cap once setfit ships v5 support.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 documentedmulti_label=True(works on both v4 and v5).[optimization]extra foroptuna(now required bydspy's MIPROv2 optimizer; previously a transitive dep).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 minimaltransformersintegration surface in this repo — see comment in.github/workflows/test.yml).Checklist
Screenshots/Examples (if applicable)
🤖 Generated with Claude Code