mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-05 01:15:09 +03:00
chore(deps): bump sentence-transformers from 5.2.3 to 5.6.0 in /libs/partners/huggingface (#40959)
Bumps [sentence-transformers](https://github.com/huggingface/sentence-transformers) from 5.2.3 to 5.6.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/huggingface/sentence-transformers/releases">sentence-transformers's releases</a>.</em></p> <blockquote> <h2>v5.6.0 - Fixes for Causal LM Rerankers, Hard-Negative Mining, and More</h2> <p>This minor version is a correctness- and robustness-focused release. It fixes a silent scoring bug for causal-LM rerankers, corrects several hard-negative mining and GIST loss edge cases, restores TSDAE on <code>transformers</code> v5, and adds Apple Silicon (MPS) support for the cached losses.</p> <p>The headline fix affects chat-template models that read the final token position, i.e. causal-LM rerankers (like <code>Qwen3-Reranker</code>) and last-token-pooling embedders: when an over-long input was truncated, the chat template's trailing suffix (e.g. the assistant prefill the model scores from) was silently dropped, producing wrong scores with no error. There's also a forward-looking deprecation: loading local custom code without <code>trust_remote_code=True</code> now warns, and will require it from v6.0.</p> <p>Install this version with</p> <pre lang="bash"><code># Training + Inference pip install sentence-transformers[train]==5.6.0 <h1>Inference only, use one of:</h1> <p>pip install sentence-transformers==5.6.0 pip install sentence-transformers[onnx-gpu]==5.6.0 pip install sentence-transformers[onnx]==5.6.0 pip install sentence-transformers[openvino]==5.6.0</p> <h1>Multimodal dependencies (optional):</h1> <p>pip install sentence-transformers[image]==5.6.0 pip install sentence-transformers[audio]==5.6.0 pip install sentence-transformers[video]==5.6.0</p> <h1>Or combine as needed:</h1> <p>pip install sentence-transformers[train,onnx,image]==5.6.0 </code></pre></p> <h2>Fixed silently wrong scores when truncation drops chat-template suffixes (<a href="https://redirect.github.com/huggingface/sentence-transformers/issues/3787">#3787</a>)</h2> <p>Chat-template models render the full conversation to a flat string before tokenizing, so when the rendered input is longer than the tokenizer's <code>model_max_length</code>, the tokenizer truncates it from the right and drops the template's trailing suffix: the fixed tokens a template appends <em>after</em> the content, e.g. a prompt, instruction, <code>[/INST]</code>, or a trailing EOS. For models that read the final token position, this silently corrupted the result:</p> <ul> <li>causal-LM rerankers (e.g. <code>Qwen/Qwen3-Reranker-0.6B</code>) score a pair from the last token's <code>yes</code>/<code>no</code> logits, and</li> <li>last-token-pooling embedders read the final hidden state.</li> </ul> <p>When the suffix was truncated away, that final position landed mid-document instead of after the prefill, so the score or embedding came from the wrong place.</p> <p><code>Transformer.preprocess</code> now detects when truncation drops the suffix and splices it back onto the tail of each truncated row. Because the fix lives in the shared base <code>Transformer</code>, it applies across <code>SentenceTransformer</code>, <code>CrossEncoder</code>, and <code>SparseEncoder</code>. It's enabled by default and saved to the model configuration. Pass <code>processing_kwargs={"chat_template": {"restore_suffix": False}}</code> to opt back into raw truncation.</p> <h2>Hard-negative mining and GIST loss correctness (<a href="https://redirect.github.com/huggingface/sentence-transformers/issues/3821">#3821</a>, <a href="https://redirect.github.com/huggingface/sentence-transformers/issues/3817">#3817</a>, <a href="https://redirect.github.com/huggingface/sentence-transformers/issues/3816">#3816</a>)</h2> <p>A trio of correctness and scalability fixes for hard-negative mining and the GIST losses:</p> <ul> <li>Sign-independent relative margin: <code>mine_hard_negatives(relative_margin=...)</code> and the <code>margin_strategy="relative"</code> branch of <code>GISTEmbedLoss</code> / <code>CachedGISTEmbedLoss</code> used a multiplicative threshold (<code>positive * (1 - margin)</code>) that only behaves correctly when the positive-pair similarity is positive. When that similarity was negative, the threshold moved the wrong way and let through false negatives: candidates <em>more</em> similar to the anchor than the true positive. The threshold is now <code>positive - |positive| * margin</code>, identical to before for positive scores but correct for negative ones.</li> <li>Distributed positive masking in the GIST losses: with <code>gather_across_devices=True</code> and a non-zero <code>margin</code>, the false-negative suppression mask protected the wrong columns on ranks beyond the first (it ignored the per-rank offset into the gathered batch), which set the true positive's logit to <code>-inf</code> and produced a <code>+inf</code> loss. The mask now accounts for the cross-rank offset, so multi-GPU GIST training stays finite.</li> <li>Memory-bounded mining without FAISS: <code>mine_hard_negatives(use_faiss=False)</code> (the default) materialized the full <code>(queries × corpus)</code> similarity matrix at once, which could OOM on large corpora. It now batches over the query axis (controlled by <code>faiss_batch_size</code>, default 16384), bounding peak memory while producing identical results.</li> </ul> <h2>TSDAE weight tying restored on <code>transformers</code> v5 (<a href="https://redirect.github.com/huggingface/sentence-transformers/issues/3781">#3781</a>)</h2> <p><code>transformers</code> v5 removed the private <code>PreTrainedModel._tie_encoder_decoder_weights</code> helper that <code>DenoisingAutoEncoderLoss</code> (TSDAE) used to tie its separate encoder and decoder. As a stopgap, v5.5 raised a <code>RuntimeError</code> for the default <code>tie_encoder_decoder=True</code> on <code>transformers >= 5.0.0</code>, effectively breaking TSDAE there unless you pinned an older <code>transformers</code> or disabled tying. TSDAE now ships its own tying routine that shares storage between encoder and decoder, so it works on both <code>transformers</code> <5 and >=5 with the default settings.</p> <h2>Deprecation: loading local custom code without <code>trust_remote_code</code> (<a href="https://redirect.github.com/huggingface/sentence-transformers/issues/3807">#3807</a>)</h2> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/huggingface/sentence-transformers/commit/9c73df3143e97598938a1640d737d3f0f11878e5"><code>9c73df3</code></a> Release v5.6.0</li> <li><a href="https://github.com/huggingface/sentence-transformers/commit/222b0529b93b15f191b6f86b25350be4d226361e"><code>222b052</code></a> [fix] Don't override device_map placement with the device argument (<a href="https://redirect.github.com/huggingface/sentence-transformers/issues/3823">#3823</a>)</li> <li><a href="https://github.com/huggingface/sentence-transformers/commit/a38a6bf16f50347c100c515fed64e2d8e75bf290"><code>a38a6bf</code></a> Fix causal LM reranker scoring when max_length truncates chat-template suffix...</li> <li><a href="https://github.com/huggingface/sentence-transformers/commit/18121031ece5ad8f4676127c6693f517c113782a"><code>1812103</code></a> [fix] Make relative margin sign-independent in mining and GIST losses (<a href="https://redirect.github.com/huggingface/sentence-transformers/issues/3821">#3821</a>)</li> <li><a href="https://github.com/huggingface/sentence-transformers/commit/ae1acc3fb2aa2004577b297eb4a915ce7a03316a"><code>ae1acc3</code></a> Warn when loading local custom code without trust_remote_code (<a href="https://redirect.github.com/huggingface/sentence-transformers/issues/3807">#3807</a>)</li> <li><a href="https://github.com/huggingface/sentence-transformers/commit/429cf5d424869c7aba629ded61e93b2788921677"><code>429cf5d</code></a> [fix] Support MPS in the cached losses' RandContext (<a href="https://redirect.github.com/huggingface/sentence-transformers/issues/3812">#3812</a>)</li> <li><a href="https://github.com/huggingface/sentence-transformers/commit/77fdbfff17c476190f3bb09436e91280fe27b247"><code>77fdbff</code></a> [<code>fix</code>] fix <code>MPS</code> errors (<a href="https://redirect.github.com/huggingface/sentence-transformers/issues/3818">#3818</a>)</li> <li><a href="https://github.com/huggingface/sentence-transformers/commit/bfba988a1ebc5717b7c52af597e43dba86b4a590"><code>bfba988</code></a> [fix] Fix positive masking in GIST losses with multi-GPU + gather_across_devi...</li> <li><a href="https://github.com/huggingface/sentence-transformers/commit/29e382b56077f5ade739737d14878357345b4e7e"><code>29e382b</code></a> [<code>docs</code>] Fix doc build problems (part 1) (<a href="https://redirect.github.com/huggingface/sentence-transformers/issues/3811">#3811</a>)</li> <li><a href="https://github.com/huggingface/sentence-transformers/commit/d16e6bfacf5b00143a93d007fbb711d8095b297b"><code>d16e6bf</code></a> [fix] Avoid materializing the full similarity matrix in mine_hard_negatives w...</li> <li>Additional commits viewable in <a href="https://github.com/huggingface/sentence-transformers/compare/v5.2.3...v5.6.0">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) 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 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) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/langchain-ai/langchain/network/alerts). </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
6ac423b72c
commit
68afc90c73
1 file changed
+3
-3
Generated
+3
-3
@@ -3420,7 +3420,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "sentence-transformers"
|
||||
version = "5.2.3"
|
||||
version = "5.6.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "huggingface-hub" },
|
||||
@@ -3434,9 +3434,9 @@ dependencies = [
|
||||
{ name = "transformers" },
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/5b/30/21664028fc0776eb1ca024879480bbbab36f02923a8ff9e4cae5a150fa35/sentence_transformers-5.2.3.tar.gz", hash = "sha256:3cd3044e1f3fe859b6a1b66336aac502eaae5d3dd7d5c8fc237f37fbf58137c7", size = 381623, upload-time = "2026-02-17T14:05:20.238Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f9/56/d2cb00765a6b15c994a7fccf20f9032f16e8193ca49147cb5155166ad744/sentence_transformers-5.6.0.tar.gz", hash = "sha256:0e7164d051e416c1853ade7c274ff52af3f9da0f4be7f0b83d734c27699e1057", size = 453194, upload-time = "2026-06-16T14:01:56.42Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/46/9f/dba4b3e18ebbe1eaa29d9f1764fbc7da0cd91937b83f2b7928d15c5d2d36/sentence_transformers-5.2.3-py3-none-any.whl", hash = "sha256:6437c62d4112b615ddebda362dfc16a4308d604c5b68125ed586e3e95d5b2e30", size = 494225, upload-time = "2026-02-17T14:05:18.596Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/76/c1/dc1582b79e9a2eb0cddf9559cd9bcdff084f541d6fe881fdd9d98630dba7/sentence_transformers-5.6.0-py3-none-any.whl", hash = "sha256:d2075b5e687a1611005e20ab04a6846994d51adfcf39610aed066af3c0c0b81f", size = 596411, upload-time = "2026-06-16T14:01:55.103Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
Reference in new issue
Block a user