Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added use_auth_token to TextEmbedding class #49

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/vecs/adapter/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ class TextEmbedding(AdapterStep):
embeddings using a specified sentence transformers model.
"""

def __init__(self, *, model: TextEmbeddingModel, batch_size: int = 8):
def __init__(self, *, model: TextEmbeddingModel, batch_size: int = 8, use_auth_token: str = None):
"""
Initializes the TextEmbedding adapter with a sentence transformers model.

Args:
model (TextEmbeddingModel): The sentence transformers model to use for embeddings.
batch_size (int): The number of records to encode simultaneously.
use_auth_token (str): The HuggingFace Hub auth token to use for private models.

Raises:
MissingDependency: If the sentence_transformers library is not installed.
Expand All @@ -53,7 +54,7 @@ def __init__(self, *, model: TextEmbeddingModel, batch_size: int = 8):
"Missing feature vecs[text_embedding]. Hint: `pip install 'vecs[text_embedding]'`"
)

self.model = ST(model)
self.model = ST(model, use_auth_token=use_auth_token)
self._exported_dimension = self.model.get_sentence_embedding_dimension()
self.batch_size = batch_size

Expand Down