SKTBrain / KoBERT

Korean BERT pre-trained cased (KoBERT)
Apache License 2.0
1.3k stars 368 forks source link

type object 'BERTVocab' has no attribute 'from_sentencepiece' #108

Open songjuhan opened 1 year ago

songjuhan commented 1 year ago

using cached model. /home/cgac/juhan/kobert/kobert/KoBERT/.cache/kobert_v1.zip using cached model. /home/cgac/juhan/kobert/kobert/KoBERT/.cache/kobert_news_wiki_ko_cased-1087f8699e.spiece

AttributeError Traceback (most recent call last) in 17 device = torch.device("cuda:0") 18 #BERT 모델, Vocabulary 불러오기 ---> 19 bertmodel, vocab = get_pytorch_kobert_model()

~/juhan/kobert/kobert/KoBERT/kobert/pytorch_kobert.py in get_pytorch_kobert_model(ctx, cachedir) 50 # download vocab 51 vocab_path = get_tokenizer() ---> 52 return get_kobert_model(model_path, vocab_path, ctx) 53 54

~/juhan/kobert/kobert/KoBERT/kobert/pytorch_kobert.py in get_kobert_model(model_path, vocab_file, ctx) 29 bertmodel.to(device) 30 bertmodel.eval() ---> 31 vocab_b_obj = nlp.vocab.BERTVocab.from_sentencepiece( 32 vocab_file, padding_token="[PAD]" 이 오류에 대해 혹시 알수 있을까요?

aeri123443 commented 3 months ago

gluonnlp0.6.0으로 사용하셨다면 해당 오류가 발생할 수 있습니다. from_sentencepiecegluonnlp==0.7.0부터 지원되는 듯해요.