fast-bert icon indicating copy to clipboard operation
fast-bert copied to clipboard

ImportError: cannot import name 'BertWordPieceTokenizer'

Open stellaywu opened this issue 5 years ago • 4 comments

tried installed from pip and source, both returned ImportError: cannot import name 'BertWordPieceTokenizer' on from fast_bert.data_cls

Please help!

stellaywu avatar Feb 08 '20 18:02 stellaywu

I have the same issue. I've tried using 1.6.1 and 1.6.0, but then run into other problems during the fit of a multi-label model.

mrjgamble avatar Feb 11 '20 20:02 mrjgamble

This issue may be due to the version of the tokenizers module. If so then you would need to first install Rust and then install the tokenizers module.

Assuming you have a bash shell and are within your env (actual or venv development environment), you can try the following:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source $HOME/.cargo/env pip install tokenizers

More logs would help though.

dhruv-sharma avatar Feb 16 '20 17:02 dhruv-sharma

I solved the issue by adding those two lines befort the import :

import torch

camembert = torch.hub.load('pytorch/fairseq', 'camembert.v0')

propower1712 avatar Feb 21 '20 19:02 propower1712

I had this and then ran pip install --upgrade tokenizers and got past it. Though I'm still nowhere near getting it to work yet ha

Shane-Neeley avatar Mar 16 '20 19:03 Shane-Neeley