-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit d96cadc
Python: Update sentence-transformers requirement from <5.0,>=2.2 to >=2.2,<6.0 in /python (#12679)
Updates the requirements on
[sentence-transformers](https://github.com/UKPLab/sentence-transformers)
to permit the latest version.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/UKPLab/sentence-transformers/releases">sentence-transformers's
releases</a>.</em></p>
<blockquote>
<h2>v5.0.0 - SparseEncoder support; encode_query & encode_document;
multi-processing in encode; Router; and more</h2>
<p>This release consists of significant updates including the
introduction of Sparse Encoder models, new methods
<code>encode_query</code> and <code>encode_document</code>,
multi-processing support in <code>encode</code>, the <code>Router</code>
module for asymmetric models, custom learning rates for parameter
groups, composite loss logging, and various small improvements and bug
fixes.</p>
<p>Install this version with</p>
<pre lang="bash"><code># Training + Inference
pip install sentence-transformers[train]==5.0.0
<h1>Inference only, use one of:</h1>
<p>pip install sentence-transformers==5.0.0
pip install sentence-transformers[onnx-gpu]==5.0.0
pip install sentence-transformers[onnx]==5.0.0
pip install sentence-transformers[openvino]==5.0.0
</code></pre></p>
<blockquote>
<p>[!TIP]
Our <a href="https://huggingface.co/blog/train-sparse-encoder">Training
and Finetuning Sparse Embedding Models with Sentence Transformers v5
blogpost</a> is an excellent place to learn about finetuning sparse
embedding models!</p>
</blockquote>
<blockquote>
<p>[!NOTE]
This release is designed to be fully backwards compatible, meaning that
you should be able to upgrade from older versions to v5.x without any
issues. If you are running into issues when upgrading, feel free to open
<a href="https://github.com/uKPLab/sentence-transformers/issues/new">an
issue</a>. Also see the <a
href="https://sbert.net/docs/migration_guide.html">Migration Guide</a>
for changes that we would recommend.</p>
</blockquote>
<h2>Sparse Encoder models</h2>
<p>The Sentence Transformers v5.0 release introduces Sparse Embedding
models, also known as Sparse Encoders. These models generate
high-dimensional embeddings, often with 30,000+ dimensions, where often
only <1% of dimensions are non-zero. This is in contrast to the
standard dense embedding models, which produce low-dimensional
embeddings (e.g., 384, 768, or 1024 dimensions) where all values are
non-zero.</p>
<p>Usually, each active dimension (i.e. the dimension with a non-zero
value) in a sparse embedding corresponds to a specific token in the
model's vocabulary, allowing for interpretability. This means that you
can e.g. see exactly which words/tokens are important in an embedding,
and that you can inspect exactly because of which words/tokens two texts
are deemed similar.</p>
<p>Let's have a look at <a
href="https://huggingface.co/naver/splade-v3">naver/splade-v3</a>, a
strong sparse embedding model, as an example:</p>
<pre lang="python"><code>from sentence_transformers import SparseEncoder
<h1>Download from the 🤗 Hub</h1>
<p>model = SparseEncoder("naver/splade-v3")</p>
<h1>Run inference</h1>
<p>sentences = [
"The weather is lovely today.",
"It's so sunny outside!",
"He drove to the stadium.",
]
embeddings = model.encode(sentences)
print(embeddings.shape)</p>
<h1>(3, 30522)</h1>
<h1>Get the similarity scores for the embeddings</h1>
<p>similarities = model.similarity(embeddings, embeddings)
print(similarities)</p>
<h1>tensor([[ 32.4323, 5.8528, 0.0258],</h1>
<p></tr></table>
</code></pre></p>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/UKPLab/sentence-transformers/commit/8dc0fca767afd74208764fd28f89dd83e8743241"><code>8dc0fca</code></a>
Release v5.0.0</li>
<li><a
href="https://github.com/UKPLab/sentence-transformers/commit/e91af6ac3e160aa0d610ea32aeb295f3ff648e67"><code>e91af6a</code></a>
Update links for SPLADE and Inference-Free SPLADE models collections in
docum...</li>
<li><a
href="https://github.com/UKPLab/sentence-transformers/commit/4c00aea59d4b25061ba03761804a4266c3e8fd33"><code>4c00aea</code></a>
[<code>fix</code>] Remove hub_kwargs in SparseStaticEmbedding.from_json
in favor of more...</li>
<li><a
href="https://github.com/UKPLab/sentence-transformers/commit/28685bb1d771b8609c5e4d4115a8b862267358ce"><code>28685bb</code></a>
Clean up gitignore (<a
href="https://redirect.github.com/UKPLab/sentence-transformers/issues/3409">#3409</a>)</li>
<li><a
href="https://github.com/UKPLab/sentence-transformers/commit/85dd17518f15a8466ec131a4f82e1e93e4ada631"><code>85dd175</code></a>
Fix formatting of docstring arguments in
SpladeRegularizerWeightSchedulerCall...</li>
<li><a
href="https://github.com/UKPLab/sentence-transformers/commit/14afc4b6681f0b83bded05fe91a8fd3320d453f9"><code>14afc4b</code></a>
Merge PR <a
href="https://redirect.github.com/UKPLab/sentence-transformers/issues/3401">#3401</a>:
[<code>v5</code>] Add support for Sparse Embedding models</li>
<li><a
href="https://github.com/UKPLab/sentence-transformers/commit/2d248419eb47c3710d50fa560d41e7fd17459846"><code>2d24841</code></a>
Update tip phrasing and fix links</li>
<li><a
href="https://github.com/UKPLab/sentence-transformers/commit/ed043c56b21d4a6c8f600e9d2a74523e522d6823"><code>ed043c5</code></a>
typo</li>
<li><a
href="https://github.com/UKPLab/sentence-transformers/commit/b2679d12294f9e0e5a2250cbcb400e9b4111f856"><code>b2679d1</code></a>
fix broken link</li>
<li><a
href="https://github.com/UKPLab/sentence-transformers/commit/d30341ec2f3a8fa50eb41f924273e414bb7c0db7"><code>d30341e</code></a>
Update tips to prepared for v5.0</li>
<li>Additional commits viewable in <a
href="https://github.com/UKPLab/sentence-transformers/compare/v2.2.0...v5.0.0">compare
view</a></li>
</ul>
</details>
<br />
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Evan Mattson <[email protected]>1 parent e44bfb1 commit d96cadcCopy full SHA for d96cadc
File tree
Expand file treeCollapse file tree
1 file changed
+1
-1
lines changedFilter options
- python
Expand file treeCollapse file tree
1 file changed
+1
-1
lines changed+1-1Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
93 | 93 |
| |
94 | 94 |
| |
95 | 95 |
| |
96 |
| - | |
| 96 | + | |
97 | 97 |
| |
98 | 98 |
| |
99 | 99 |
| |
|
0 commit comments