Skip to content

Gemma's Tokenizer fails to split on spaces  #30416

Description

@vasqu

Preface

This is related to #29617, similar issue as described in there so this is kind of a placeholder. Should be fixed by #28881.

Who can help?

@ArthurZucker

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained('google/gemma-7b', use_auth=True)
sentence = 'Sampel to demonstrate the issue'

input_encoding = tokenizer(sentence, add_special_tokens=True)
tokens = input_encoding.tokens()
word_ids = input_encoding.word_ids()

print(f'Tokens produced: {tokens}\nReferenced word ids: {word_ids}')

Expected behavior

Correct split(s) assigned.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Core: TokenizationInternals of the library; Tokenization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions