Skip to content

Commit

Permalink
Merge pull request #3 from nanbo-liu/fix_tokenizer_bug
Browse files Browse the repository at this point in the history
Fix tokenizer bug
  • Loading branch information
nanbo-liu authored Mar 22, 2024
2 parents 075376e + 4b314f6 commit 8aee783
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion runtimes/huggingface/mlserver_huggingface/pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

from transformers import Pipeline
from transformers import AutoModel
from transformers import AutoTokenizer
from sentence_transformers.util import is_sentence_transformer_model
from sentence_transformers import SentenceTransformer


class StEmbeddingPipeline(Pipeline):
"""A custom huggingface pipeline that wraps sentence transformers embedder"""

def __init__(self, model: AutoModel, **kwargs):
def __init__(self, model: AutoModel, tokenizer: AutoTokenizer, **kwargs):
# self.tokenzier is not being used.sentence-transformers model has a tokenizer
self.tokenizer = tokenizer
(
self._preprocess_params,
self._forward_params,
Expand Down

0 comments on commit 8aee783

Please sign in to comment.