Nlp 使用en_trf_bertbaseuncased_lg模型训练NER空间
我目前正在从事NER项目,我想通过尝试新的SpaCy模型Nlp 使用en_trf_bertbaseuncased_lg模型训练NER空间,nlp,spacy,named-entity-recognition,ner,Nlp,Spacy,Named Entity Recognition,Ner,我目前正在从事NER项目,我想通过尝试新的SpaCy模型en_trf_bertbaseuncased_lg来提高我的NER性能,但它给了我错误keyrerror:[E001]在管道中找不到组件'trf_tok2vec'。可用名称:[NER']“。SpaCy目前是否不支持此语言模型的NER?谢谢 # get names of other pipes to disable them during training other_pipes = [pipe for pipe in nlp.
en_trf_bertbaseuncased_lg
来提高我的NER性能,但它给了我错误keyrerror:[E001]在管道中找不到组件'trf_tok2vec'。可用名称:[NER']“
。SpaCy目前是否不支持此语言模型的NER?谢谢
# get names of other pipes to disable them during training
other_pipes = [pipe for pipe in nlp.pipe_names if pipe != 'ner']
with nlp.disable_pipes(*other_pipes): # only train NER
for itn in tqdm(range(n_iter)):
random.shuffle(train_data_list)
losses = {}
# batch up the examples using spaCy's minibatch
batches = minibatch(train_data_list, size=compounding(8., 64., 1.001))
for batch in batches:
texts, annotations = zip(*batch)
nlp.update(texts, annotations, sgd=optimizer, drop=0.35,
losses=losses)
tqdm.write('Iter: ' + str(itn + 1) + ' Losses: ' + str(losses['ner']))
if itn == 30 or itn == 40:
output_dir = Path(output_dir)
if not output_dir.exists():
output_dir.mkdir()
nlp.to_disk(Path(output_dir))
它给了我错误的答案
nlp.update(texts, annotations, sgd=optimizer, drop=0.35,
losses=losses)
根据spaCy上该模型的文档,该模型还不支持命名实体识别。它只支持:
判决者
trf\u拼字机
trf_tok2vec
>>> import spacy
>>> nlp = spacy.load("en_trf_bertbaseuncased_lg")
>>> nlp.pipe_names
[sentencizer, trf_wordpiecer, trf_tok2vec]
根据spaCy上该模型的文档,该模型还不支持命名实体识别。它只支持:
判决者
trf\u拼字机
trf_tok2vec
>>> import spacy
>>> nlp = spacy.load("en_trf_bertbaseuncased_lg")
>>> nlp.pipe_names
[sentencizer, trf_wordpiecer, trf_tok2vec]
你能发布导致错误的代码吗?我在问题中添加了代码片段。谢谢你能发布导致错误的代码吗?我在问题中添加了代码片段。谢谢