Skip to content

Commit d103d99

Browse files
rmitschRaphael Mitschclaude
authored
chore: Migrate to transformers v5 (with v4 fallback for distill) (#258)
- 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: Raphael Mitsch <raphael@climatiq.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bc42352 commit d103d99

7 files changed

Lines changed: 1638 additions & 1557 deletions

File tree

.github/workflows/test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ jobs:
4949
source .venv/bin/activate
5050
uv pip install ./dist/sieves-*.whl
5151
# Optional dependencies need to be installed in separate command.
52-
uv pip install 'sieves[ingestion,distill,test]'
52+
# Note: due to `setfit` not supporting `transformers` v5 yet, installing the `distill` extra runs with v4 of
53+
# `transformers`. As we're installing all packages for tests, we're running the test suite with `transformers`
54+
# v4. This is an ok tradeoff for now, given the minimal integration surface of `transformers` within `sieves`.
55+
uv pip install 'sieves[ingestion,distill,optimization,test]'
5356
5457
- name: Build docs
5558
run: |

CITATION.CFF

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ authors:
1515
- family-names: "Maufe"
1616
given-names: "Matthew"
1717
title: "Sieves"
18-
version: 1.0.2
18+
version: 1.0.3
1919
doi: 10.5281/zenodo.18664061
20-
date-released: 2026-02-16
20+
date-released: 2026-05-01
2121
url: "https://github.com/MantisAI/sieves"

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,9 @@ pip install sieves
236236

237237
**Optional extras:**
238238
```bash
239-
pip install "sieves[ingestion]" # PDF/DOCX parsing (docling, marker)
240-
pip install "sieves[distill]" # Model distillation (setfit, model2vec)
239+
pip install "sieves[ingestion]" # PDF/DOCX parsing (docling, marker)
240+
pip install "sieves[distill]" # Model distillation (setfit, model2vec)
241+
pip install "sieves[optimization]" # Prompt optimization with DSPy (optuna)
241242
```
242243

243244
## Community & Support

pyproject.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ dependencies = [
2626
# Model wrappers
2727
"outlines>=1,<2",
2828
"gliner2>=1.2,<2",
29-
"transformers[torch]>=4,<5",
29+
"transformers[torch]>=4,<6",
3030
"dspy-ai>=3,<4",
3131
"dspy>=3,<4",
3232
"accelerate>1.2,<2",
@@ -54,13 +54,20 @@ Homepage = "https://github.com/MantisAI/sieves"
5454
Repository = "https://github.com/MantisAI/sieves"
5555

5656
[project.optional-dependencies]
57+
optimization = [
58+
"optuna>=4,<5",
59+
]
5760
ingestion = [
5861
"docling>=2,<3",
5962
"nltk>=3.9.1",
6063
]
6164
distill = [
6265
"setfit>=1.1,<2",
6366
"model2vec[train]>0.4,<0.5",
67+
# setfit 1.1.3 (latest, Nov 2024) imports `default_logdir` from
68+
# transformers.training_args, which was removed in transformers v5.
69+
# Cap distill to transformers v4 until setfit ships v5 support.
70+
"transformers[torch]>=4,<5",
6471
]
6572
test = [
6673
"anthropic>=0.45,<1",
@@ -130,6 +137,9 @@ ignore = ["D203", "D212"]
130137
fixable = ["ALL"]
131138
unfixable = ["F401"]
132139

140+
[tool.uv]
141+
exclude-newer = "3 days"
142+
133143
[tool.ruff.lint.pydocstyle]
134144
convention = "pep257"
135145

sieves/model_wrappers/huggingface_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def execute(values: Sequence[dict[str, Any]]) -> Sequence[tuple[Result | None, A
6666
sequences=[doc_values["text"] for doc_values in values],
6767
candidate_labels=prompt_signature,
6868
hypothesis_template=template,
69-
mode="multi",
69+
multi_label=True,
7070
**self._inference_kwargs,
7171
)
7272

sieves/serialization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def get_version() -> str:
7979
8080
:return str: Version string from setup.cfg metadata.
8181
"""
82-
return "1.0.2"
82+
return "1.0.3"
8383

8484
version: str = get_version()
8585
cls_name: str

uv.lock

Lines changed: 1616 additions & 1549 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)