'utf

您所在的位置:网站首页 (0x80) 'utf

'utf

2024-06-30 11:57| 来源: 网络整理| 查看: 265

@lipingbj With the latest versions of transformers you need to pass the path to the PyTorch-compatible model, so in your example use:

tokenizer = BertTokenizer.from_pretrained("/home/liping/liping/bert/")

The following files must be located in that folder:

vocab.txt - vocabulary file pytorch_model.bin - the PyTorch-compatible (and converted) model config.json - json-based model configuration

Please make sure that these files exist and e.g. rename bert-base-cased-pytorch_model.bin to pytorch_model.bin.

That should work :)

encoder_model = BertModel.from_pretrained("/home/liping/liping/bert/pytorch-bert-model") tokenizer = BertTokenizer.from_pretrained("/home/liping/liping/bert/pytorch-bert-model")

vocab.txt, pytorch_model.bin, config.json have included in directory bert/pytorch-bert-model

OSError: Model name '/home/liping/liping/bert/pytorch-bert-model' was not found in model name list (bert-base-uncased, bert-large-uncased, bert-base-cased, bert-large-cased, bert-base-multilingual-uncased, bert-base-multilingual-cased, bert-base-chinese, bert-base-german-cased, bert-large-uncased-whole-word-masking, bert-large-cased-whole-word-masking, bert-large-uncased-whole-word-masking-finetuned-squad, bert-large-cased-whole-word-masking-finetuned-squad, bert-base-cased-finetuned-mrpc, bert-base-german-dbmdz-cased, bert-base-german-dbmdz-uncased). We assumed '/home/liping/liping/bert/pytorch-bert-model/config.json' was a path or url to a configuration file named config.json or a directory containing such a file but couldn't find any such file at this path or url.



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3