feat: relax sentence-transformers and transformers version pins for 5.x compat#210
feat: relax sentence-transformers and transformers version pins for 5.x compat#210j-sperling wants to merge 5 commits intolightonai:mainfrom
Conversation
….x compat Relax sentence-transformers from ==5.1.1 to >=5.1.1 and remove the transformers upper bound (was <=4.56.2, now >=4.48.0). Tested with ST 5.3.0 + transformers 5.3.0: - Model loading works (GTE-ModernColBERT-v1, ColBERT-Zero) - Encoding produces correct shapes - 13/16 tests pass (3 training tests fail on MPS -- unrelated) - Only non-jina model loading tests pass (jina-colbert-v2 has a separate HF config issue) Also removes deprecated overwrite_output_dir from 3 test files (removed in transformers 5.x TrainingArguments).
|
Thanks for the PR! Edit:
In any case, we'll have to pin the exact version of ST to the latest one: we are not using |
pyproject.toml
Outdated
| ] | ||
| dependencies = [ | ||
| "sentence-transformers == 5.1.1", | ||
| "sentence-transformers >= 5.1.1", |
There was a problem hiding this comment.
| "sentence-transformers >= 5.1.1", | |
| "sentence-transformers >= 5.1.1, <6.0.0", |
|
if you're using uv, you can temporarily avoid this inconvenience by adding to your |
|
Hey,
I am sorry to be slow with some updates lately, I've been quite busy, but as raised above, you can change overcome those issues locally. Is there any very blocking setup that you are encountering? I'll try to fix everything ASAP |
- sentence-transformers: >= 5.1.1 -> == 5.3.0 (exact pin per maintainer policy) - transformers: >= 4.48.0 -> >= 4.41.0 (restore original floor, no justification for bump) - Keep overwrite_output_dir removal (needed for transformers 5.x compat) - Keep transformers ceiling removed (ColBERT models produce bit-identical embeddings between transformers 4.56.2 and 5.4.0)
|
Thanks for the detailed feedback @NohTow -- totally understand both concerns. I dug into the transformers v5 numerical issue before responding. ColBERT numerical comparison: transformers 4.56.2 vs 5.4.0I ran pylate's
The known transformers v5 divergences (huggingface/transformers#42889 for T5 weight tying, huggingface/transformers#43697 for RTDetrV2) affect encoder-decoder and vision model families. BERT-based architectures -- which all pylate ColBERT models use -- produce identical outputs. Happy to test additional models if you'd like. Updated PRBased on your feedback, I've updated the branch:
If you'd prefer to keep the transformers ceiling until Tom confirms independently, I can revert that part and just ship the ST bump. Your call. |
| "datasets >= 2.20.0", | ||
| "accelerate >= 0.31.0", | ||
| "pandas >= 2.2.1", | ||
| "transformers >= 4.41.0, <= 4.56.2", |
There was a problem hiding this comment.
The transition to 5.*+ is a breaking change and feels too big right now.
In this PR, perhaps we can compromise and make this change to:
"transformers >= 4.41.0, <= 4.57.1",
There was a problem hiding this comment.
Should be no breaking changes this way --> transformers <= 4.57.1
.gitignore
Outdated
|
|
||
| # Agent config (generated/local) | ||
| .memsearch/ | ||
| AGENTS.md | ||
| CLAUDE.md |
There was a problem hiding this comment.
Don't need this addition in this PR.
AGENTS.md is another whole discussion and task.
- Remove out-of-scope .gitignore additions (AGENTS.md, CLAUDE.md, .memsearch) - Add transformers < 5.0.0 ceiling to keep v4 boundary while allowing 4.57.x patches
|
Thanks @TheAdamEvans. Reverted the For the transformers ceiling: updated to Kept the |
|
Hey, |
|
Hello! I've ran some more tests between
|
|
No worries team, I know you have a lot on and these are small things, am patient! 😄 Looking to get PyLate included in Canva's monorepo. It can be tricky because the entire company has to share the exact same version specs. Thanks @j-sperling for updating 🙏 Re: sentence-transformers, I'd selfishly prefer <=5.1.2 because that's what we have here today and will simplify things for me later on the next PyLate release. @j-sperling could I convince you to also update Happy to open separate issues for these if we'd prefer. |
| "ujson == 5.10.0", | ||
| "ninja == 1.11.1.4", | ||
| "fastkmeans == 0.5.0", | ||
| "fast-plaid>=1.2.4.260,<=1.3.0.290", |
There was a problem hiding this comment.
Might I also suggest
| "fast-plaid>=1.2.4.260,<=1.4.6.280", |
Summary
sentence-transformersfrom== 5.1.1to== 5.3.0transformersat< 5.0.0(was<= 4.56.2) to allow 4.57.x while deferring v5 until numerical equivalence is confirmedoverwrite_output_dirfrom 3 test files (no-op on v4, required for eventual v5 support)Numerical verification
ColBERT embeddings are bit-identical between transformers 4.56.2 and 5.4.0 (both with ST 5.3.0, torch 2.9.0):
The known transformers v5 divergences (huggingface/transformers#42889, huggingface/transformers#43697) affect T5/encoder-decoder and vision models due to weight tying refactoring. BERT-based architectures used by pylate's ColBERT models are unaffected.
Test plan
Tested with ST 5.3.0 + transformers 4.57.6 on Python 3.12 (Apple Silicon):
Motivation
The current exact pin on
sentence-transformers==5.1.1prevents PyLate from being installed alongside other packages that depend on newer ST versions. This is a common integration pain point (see #144, #190).The
transformers<=4.56.2upper bound blocks 4.57.x which includes bug fixes and performance improvements.Related