Hi, I’m seeing an error running textcat.batch-train
:
$ prodigy textcat.batch-train my_dataset en_core_web_sm -l INTERESTING --eval-split 0.2
Loaded model en_core_web_sm
Using 20% of examples (7571) for evaluation
Using 100% of remaining examples (30284) for training
Dropout: 0.2 Batch size: 10 Iterations: 10
# LOSS F-SCORE ACCURACY
Traceback (most recent call last):
File "/Users/wei/anaconda/envs/py3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/Users/wei/anaconda/envs/py3/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/wei/anaconda/envs/py3/lib/python3.6/site-packages/prodigy/__main__.py", line 235, in <module>
controller = recipe(*args, use_plac=True)
File "cython_src/prodigy/core.pyx", line 130, in prodigy.core.recipe.recipe_decorator.recipe_proxy
File "/Users/wei/anaconda/envs/py3/lib/python3.6/site-packages/plac_core.py", line 328, in call
cmd, result = parser.consume(arglist)
File "/Users/wei/anaconda/envs/py3/lib/python3.6/site-packages/plac_core.py", line 207, in consume
return cmd, self.func(*(args + varargs + extraopts), **kwargs)
File "/Users/wei/anaconda/envs/py3/lib/python3.6/site-packages/prodigy/recipes/textcat.py", line 131, in batch_train
loss += model.update(batch, revise=False, drop=dropout)
File "cython_src/prodigy/models/textcat.pyx", line 200, in prodigy.models.textcat.TextClassifier.update
File "cython_src/prodigy/models/textcat.pyx", line 214, in prodigy.models.textcat.TextClassifier._update
File "/Users/wei/anaconda/envs/py3/lib/python3.6/site-packages/spacy/language.py", line 513, in pipe
for doc in docs:
File "pipeline.pyx", line 704, in pipe
File "pipeline.pyx", line 709, in spacy.pipeline.TextCategorizer.predict
File "/Users/wei/anaconda/envs/py3/lib/python3.6/site-packages/thinc/neural/_classes/model.py", line 161, in __call__
return self.predict(x)
File "/Users/wei/anaconda/envs/py3/lib/python3.6/site-packages/thinc/api.py", line 55, in predict
X = layer(X)
File "/Users/wei/anaconda/envs/py3/lib/python3.6/site-packages/thinc/neural/_classes/model.py", line 161, in __call__
return self.predict(x)
File "/Users/wei/anaconda/envs/py3/lib/python3.6/site-packages/thinc/neural/_classes/model.py", line 125, in predict
y, _ = self.begin_update(X)
File "/Users/wei/anaconda/envs/py3/lib/python3.6/site-packages/thinc/api.py", line 176, in begin_update
values = [fwd(X, *a, **k) for fwd in forward]
File "/Users/wei/anaconda/envs/py3/lib/python3.6/site-packages/thinc/api.py", line 176, in <listcomp>
values = [fwd(X, *a, **k) for fwd in forward]
File "/Users/wei/anaconda/envs/py3/lib/python3.6/site-packages/thinc/api.py", line 258, in wrap
output = func(*args, **kwargs)
File "/Users/wei/anaconda/envs/py3/lib/python3.6/site-packages/thinc/api.py", line 61, in begin_update
X, inc_layer_grad = layer.begin_update(X, drop=drop)
File "/Users/wei/anaconda/envs/py3/lib/python3.6/site-packages/thinc/neural/_classes/attention.py", line 25, in begin_update
attention, bp_attention = self._get_attention(self.Q, Xs, lengths)
File "/Users/wei/anaconda/envs/py3/lib/python3.6/site-packages/thinc/neural/_classes/attention.py", line 47, in _get_attention
self.ops.softmax(attention[start : start+length], inplace=True)
File "ops.pyx", line 190, in thinc.neural.ops.Ops.softmax
File "/Users/wei/anaconda/envs/py3/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 2252, in amax
out=out, **kwargs)
File "/Users/wei/anaconda/envs/py3/lib/python3.6/site-packages/numpy/core/_methods.py", line 26, in _amax
return umr_maximum(a, axis, None, out, keepdims)
ValueError: zero-size array to reduction operation maximum which has no identity
It’s probably something related to the annotations on my dataset since I’ve successfully trained other models on my machine, but I’m currently stuck trying to decipher this error message - any leads would be appreciated. My dataset includes one label (INTERESTING
) with 218 accepted examples and thousands of rejected answers. I thought the problem might have been the accepted answers were too sparse, so tried it with a smaller set of rejected examples but I still got the same error.