transformers icon indicating copy to clipboard operation
transformers copied to clipboard

Not able to load T5 tokenizer

Open adithyaan-creator opened this issue 5 years ago • 9 comments

Transformers==4.0.0 torch == 1.7.0+cu101 tensorflow == 2.3.0 Platform = Colab notebook

@julien-c @patrickvonplaten

Not able to load T5 tokenizer using `tokenizer = T5Tokenizer.from_pretrained('t5-base')'

Getting error - image

I am able to download the pre-trained model though.

adithyaan-creator avatar Dec 14 '20 06:12 adithyaan-creator

Hey @adithyaan-creator,

as the error message says you need to install the sentence piece library :-)

If you run:

pip install sentencepiece==0.1.91

before, it should work.

patrickvonplaten avatar Dec 14 '20 08:12 patrickvonplaten

Thanks @patrickvonplaten .

adithyaan-creator avatar Dec 14 '20 09:12 adithyaan-creator

Hi @patrickvonplaten I installed sentencepiece, but it still doesnt seem to be working for me. Please see the snapshot below. Please help.

image

DesiKeki avatar Jan 02 '21 12:01 DesiKeki

@DesiKeki try sentencepiece version 0.1.94.

adithyaan-creator avatar Jan 02 '21 13:01 adithyaan-creator

Thanks @adithyaan-creator , it worked!

DesiKeki avatar Jan 02 '21 16:01 DesiKeki

Hello @patrickvonplaten I have gone through the issue and the suggestions given above. However, I am facing the same issue and for some reason, none of the above solutions are proving fruitful.

The issue I am facing is exactly the same as the one stated above: from transformers import T5Tokenizer,T5ForConditionalGeneration,Adafactor !pip install sentencepiece==0.1.91 tokenizer = T5Tokenizer.from_pretrained("t5-base") print(tokenizer)

The output of the above code is: None. I tried using other versions of sentencepiece as well (as the one suggested above 0.1.94 and others as well). But it is still not working.

ImportingT5BaseFails

VedantKP avatar Mar 22 '21 10:03 VedantKP

Did you restart your kernel after installing sentencepiece? See conversation in https://github.com/huggingface/transformers/issues/10797

LysandreJik avatar Mar 22 '21 14:03 LysandreJik

Did you restart your kernel after installing sentencepiece? See conversation in #10797

it works for me, thank you

pedramyamini avatar Sep 04 '22 08:09 pedramyamini

Did you restart your kernel after installing sentencepiece? See conversation in #10797

It works for me. Thanks a lot.

mijanur-rahman-40 avatar Jul 10 '23 15:07 mijanur-rahman-40