Skip to content

Handle missing tokenizer_class #245

Closed
@baloodevil

Description

@baloodevil

tokenizers.js expects tokenizer_class to exist in a tokenizer_config.json file according to this line. But a common model like bert-base-uncased does not have tokenizer_class. So the following code

import { AutoTokenizer } from "@xenova/transformers";
const tokenizer = await AutoTokenizer.from_pretrained("bert-base-uncased");
const { input_ids } = await tokenizer("I love transformers!");

throws error - TypeError: Cannot read properties of undefined (reading 'replace')

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