# textcat.teach with pattern match failed with trained model

**URL:** <https://support.prodi.gy/t/textcat-teach-with-pattern-match-failed-with-trained-model/3251>\
**Category:** Uncategorized\
**Tags:** usage, spacy, solved\
**Created:** [July 30, 2020, 3:18am UTC](https://support.prodi.gy/t/textcat-teach-with-pattern-match-failed-with-trained-model/3251 "2020-07-30T03:18:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![curious](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@curious](https://support.prodi.gy/u/curious)\
**Post date:** [July 30, 2020, 3:18am UTC](https://support.prodi.gy/t/textcat-teach-with-pattern-match-failed-with-trained-model/3251/1 "2020-07-30T03:18:47Z")

</div>

I'm using Prodigy 1.10.2. If I use a trained model, I got the following error -

Traceback (most recent call last):  
File "/home/ec2-user/anaconda3/lib/python3.7/runpy.py", line 193, in \_run\_module\_as\_main  
" **main**", mod\_spec)  
File "/home/ec2-user/anaconda3/lib/python3.7/runpy.py", line 85, in \_run\_code  
exec(code, run\_globals)  
File "/home/ec2-user/anaconda3/lib/python3.7/site-packages/prodigy/ **main**.py", line 60, in   
controller = recipe(\*args, use\_plac=True)  
File "cython\_src/prodigy/core.pyx", line 318, in prodigy.core.recipe.recipe\_decorator.recipe\_proxy  
File "cython\_src/prodigy/core.pyx", line 138, in prodigy.core.Controller. **init**  
File "cython\_src/prodigy/components/feeds.pyx", line 56, in prodigy.components.feeds.SharedFeed. **init**  
File "cython\_src/prodigy/components/feeds.pyx", line 155, in prodigy.components.feeds.SharedFeed.validate\_stream  
File "/home/ec2-user/anaconda3/lib/python3.7/site-packages/toolz/itertoolz.py", line 376, in first  
return next(iter(seq))  
File "cython\_src/prodigy/components/sorters.pyx", line 98, in **iter**  
File "cython\_src/prodigy/util.pyx", line 449, in predict  
File "/home/ec2-user/anaconda3/lib/python3.7/site-packages/toolz/itertoolz.py", line 242, in interleave  
yield next(itr)  
File "cython\_src/prodigy/models/matcher.pyx", line 167, in **call**  
File "matcher.pyx", line 234, in spacy.matcher.matcher.Matcher. **call**  
ValueError: [E155] The pipeline needs to include a tagger in order to use Matcher or PhraseMatcher with the attributes POS, TAG, or LEMMA. Try using nlp() instead of nlp.make\_doc() or list(nlp.pipe()) instead of list(nlp.tokenizer.pipe()).

The command I used to teach is -  
PRODIGY\_PORT=8000 prodigy textcat.teach temp\_db5 /tmp/my\_model/ ~/user/class/chat\_sentence\_plus.jsonl --label my\_class -pt ~/fiona/class/class\_pattern.jsonl

If I replace my trained model with en\_core\_web\_lg, I wont' get the error.

This is command I used to train my model -  
prodigy train textcat temp\_db5 blank:en -o /tmp/my\_model/

---

<div class="post-metadata">

**Author:** ![adriane](https://avatars.discourse-cdn.com/v4/letter/a/46a35a/32.png) [@adriane](https://support.prodi.gy/u/adriane)\
**Post date:** [July 30, 2020, 7:33am UTC](https://support.prodi.gy/t/textcat-teach-with-pattern-match-failed-with-trained-model/3251/2 "2020-07-30T07:33:27Z")

</div>

If your patterns include `POS/TAG/LEMMA` you need a `tagger` component in your model. When you train your textcat model with the base model `blank:en`, there's no tagger, the only component is the new `textcat` component.

Instead of `blank:en`, specify a base model that contains a tagger like `en_core_web_lg`.

```python
prodigy train textcat temp_db5 en_core_web_lg -o /tmp/my_model/

```

---

<div class="post-metadata">

**Author:** ![curious](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@curious](https://support.prodi.gy/u/curious)\
**Post date:** [August 3, 2020, 1:04am UTC](https://support.prodi.gy/t/textcat-teach-with-pattern-match-failed-with-trained-model/3251/3 "2020-08-03T01:04:53Z")

</div>

Thank you. Yes your solution worked. I don't get the error any more.

However as I remember we were encouraged to train a new model from a blank model instead of the pre-trained model. Will I get a worse model if I start the training with en\_core\_web\_lg? Thanks.
