问题
在官方指令之后,我尝试添加一个额外的训练数据集,并在本地cpu环境中训练一个模型。
但我不会更改base_config.cfg和config.cfg文件的内容。
如何修复这些错误来构建模型并对其进行评估?
错误
我不确定第一个问题是否是一个问题,我也不知道如何填写config.cfg文件。
ℹ Using CPU
✘ Error parsing config overrides
paths -> train not a section value that can be overwritten代码
$ python3 -m spacy train config.cfg --output ./output --paths.train train.spacy --paths.dev train.spacy迄今为止的程序
$ python3 -m spacy init fill-config base_config.cfg config.cfg
#former output
configparser.DuplicateSectionError: While reading from '<string>' [line 90]: section 'paths' already exists
#current output
File "/usr/local/lib/python3.9/site-packages/spacy/util.py", line 137, in get
raise RegistryError(
catalogue.RegistryError: [E893] Could not find function 'spacy.MultiHashEmbed.v2' in function registry 'architectures'. If you're using a custom function, make sure the code is available. If the function is provided by a third-party package, e.g. spacy-transformers, make sure the package is installed in your environment.
Available names: spacy-legacy.MaxoutWindowEncoder.v1, spacy-legacy.MishWindowEncoder.v1, spacy-legacy.TextCatEnsemble.v1, spacy-legacy.Tok2Vec.v1, spacy-legacy.WandbLogger.v1, spacy.CharacterEmbed.v1, spacy.EntityLinker.v1, spacy.HashEmbedCNN.v1, spacy.MaxoutWindowEncoder.v2, spacy.MishWindowEncoder.v2, spacy.MultiHashEmbed.v1, spacy.PretrainCharacters.v1, spacy.PretrainVectors.v1, spacy.Tagger.v1, spacy.TextCatBOW.v1, spacy.TextCatCNN.v1, spacy.TextCatEnsemble.v2, spacy.TextCatLowData.v1, spacy.Tok2Vec.v2, spacy.Tok2VecListener.v1, spacy.TorchBiLSTMEncoder.v1, spacy.TransitionBasedParser.v1, spacy.TransitionBasedParser.v2即使在执行上述代码之后,config.cfg文件仍然是空的。
base_config.cfg从官方指令上的表单下载
# This is an auto-generated partial config. To use it with 'spacy train'
# you can run spacy init fill-config to auto-fill all default settings:
# python -m spacy init fill-config ./base_config.cfg ./config.cfg
[paths]
train = null
dev = null
[system]
gpu_allocator = null
[nlp]
lang = "en"
pipeline = ["tok2vec","ner"]
batch_size = 1000
[components]
[components.tok2vec]
factory = "tok2vec"
[components.tok2vec.model]
@architectures = "spacy.Tok2Vec.v2"
[components.tok2vec.model.embed]
@architectures = "spacy.MultiHashEmbed.v2"
width = ${components.tok2vec.model.encode.width}
attrs = ["ORTH", "SHAPE"]
rows = [5000, 2500]
include_static_vectors = false
[components.tok2vec.model.encode]
@architectures = "spacy.MaxoutWindowEncoder.v2"
width = 96
depth = 4
window_size = 1
maxout_pieces = 3
[components.ner]
factory = "ner"
[components.ner.model]
@architectures = "spacy.TransitionBasedParser.v2"
state_type = "ner"
extra_state_tokens = false
hidden_width = 64
maxout_pieces = 2
use_upper = true
nO = null
[components.ner.model.tok2vec]
@architectures = "spacy.Tok2VecListener.v1"
width = ${components.tok2vec.model.encode.width}
[corpora]
[corpora.train]
@readers = "spacy.Corpus.v1"
path = ${paths.train}
max_length = 0
[corpora.dev]
@readers = "spacy.Corpus.v1"
path = ${paths.dev}
max_length = 0
[training]
dev_corpus = "corpora.dev"
train_corpus = "corpora.train"
[training.optimizer]
@optimizers = "Adam.v1"
[training.batcher]
@batchers = "spacy.batch_by_words.v1"
discard_oversize = false
tolerance = 0.2
[training.batcher.size]
@schedules = "compounding.v1"
start = 100
stop = 1000
compound = 1.001
[initialize]
vectors = ${paths.vectors}发布于 2021-07-23 08:19:41
好像你双贴了配置之类的?从错误中您会注意到,它说您有两个[paths]部分。在你的文件的一半时间里,有这样的评论:
# This is an auto-generated partial config. To use it with 'spacy train'试着从那里删除所有的东西,然后再做一次。
https://stackoverflow.com/questions/68495699
复制相似问题