Closed charan05a8 closed 3 weeks ago
Hello!
This has been integrated in #2927, which has been released in v3.1.0. Consider upgrading your Sentence Transformers version to take advantage of it:
pip install -U sentence_transformers
Sentence Transformers is currently fully backwards compatible when it comes to inference, so there's nothing to worry abut there.
When using the
sentence_transformers
library, a warning appears due totorch.load
being called with the defaultweights_only=False
. This is causing the following warning message during model loading:This warning implies a potential security risk because it allows untrusted pickle data to execute arbitrary code. Starting in future versions of PyTorch,
weights_only=True
will become the default, allowing only safe, pre-approved modules to be loaded.Suggested Solution
We suggest adding support for
weights_only=True
intorch.load
calls, specifically inmodels/Dense.py
. This would help future-proof the library and align with PyTorch's upcoming security enhancements.Steps to Reproduce the Warning
sentence_transformers
library, for example:weights_only=False
might pose security risks.Additional Information
Please let us know if any additional details would be helpful for implementation.