Skip to content

Commit

Permalink
chore: Use token instead of use_auth_token because of deprecation war…
Browse files Browse the repository at this point in the history
…ning (#8552)

* Use token instead of use_auth_token because of deprecation warning

* Fix test

* pylint

* fix linting

---------

Co-authored-by: Stefano Fiorucci <[email protected]>
  • Loading branch information
sjrl and anakin87 authored Nov 18, 2024
1 parent bd77120 commit 14895f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class _SentenceTransformersEmbeddingBackendFactory:
_instances: Dict[str, "_SentenceTransformersEmbeddingBackend"] = {}

@staticmethod
def get_embedding_backend(
def get_embedding_backend( # pylint: disable=too-many-positional-arguments
model: str,
device: Optional[str] = None,
auth_token: Optional[Secret] = None,
Expand Down Expand Up @@ -52,7 +52,7 @@ class _SentenceTransformersEmbeddingBackend:
Class to manage Sentence Transformers embeddings.
"""

def __init__(
def __init__( # pylint: disable=too-many-positional-arguments
self,
model: str,
device: Optional[str] = None,
Expand All @@ -67,7 +67,7 @@ def __init__(
self.model = SentenceTransformer(
model_name_or_path=model,
device=device,
use_auth_token=auth_token.resolve_value() if auth_token else None,
token=auth_token.resolve_value() if auth_token else None,
trust_remote_code=trust_remote_code,
truncate_dim=truncate_dim,
model_kwargs=model_kwargs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_model_initialization(mock_sentence_transformer):
mock_sentence_transformer.assert_called_once_with(
model_name_or_path="model",
device="cpu",
use_auth_token="fake-api-token",
token="fake-api-token",
trust_remote_code=True,
truncate_dim=256,
model_kwargs=None,
Expand Down

0 comments on commit 14895f6

Please sign in to comment.