如何恢复NER培训?

时间:2018-02-16 13:03:16

标签: python machine-learning nlp spacy

我正在使用带有意大利NER模型的Spacy 2.0.6。 我想在该模型中添加样本以提高准确性。什么是正确的方法?

一开始我用这段代码训练了模型:

    with nlp.disable_pipes(*other_pipes):  # only train NER
        optimizer = nlp.begin_training()
        for itn in range(epochs):
            random.shuffle(train)
            losses = {}

            for batch in minibatch(train, size=32):
                docs, golds = zip(*batch)
                nlp.update(docs, golds, drop=.3, sgd=optimizer, losses=losses)

不幸的是,它不适用于新样品。 我在optimizer = nlp.begin_training()行收到错误。

optimizer = nlp.begin_training()
  File "/home/damiano/lavoro/python/parser/.env/lib/python3.5/site-packages/spacy/language.py", line 456, in begin_training
    sgd=self._optimizer)
  File "nn_parser.pyx", line 843, in spacy.syntax.nn_parser.Parser.begin_training
KeyError: 'token_vector_width'

我如何“恢复”NER模型的训练?

0 个答案:

没有答案