Skip to content

[Bug]: Bert tokenizer is tokenizing some tokens as UNK #11184

@maxdebayser

Description

@maxdebayser

Your current environment

The output of `python collect_env.py`
Your output of `python collect_env.py` here

Model Input Dumps

No response

🐛 Describe the bug

With some Bert and Roberta models like sentence-transformers/all-MiniLM-L12-v2 I found that the output is not similar to the one generated by sentence-transformers. If I place the following prints in _normalize_prompt_text_to_input() in serving_engine.py

        print(f"{input_ids=}")

I get [101, 100, 3007, 1997, 100, 2003, 100, 1012, 102] for the sentence "The capital of France is Paris.". 100 is the UNK token. When I run with sentence-transformers, I get [ 101, 1996, 3007, 1997, 2605, 2003, 3000, 1012, 102] . This problem happens both with --tokenizer-mode auto and --tokenizer-mode slow.

cc: @DarkLight1337

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions