# Multiple, separate text classifications in a single model

**URL:** <https://support.prodi.gy/t/multiple-separate-text-classifications-in-a-single-model/2289>\
**Category:** Uncategorized\
**Tags:** usage, textcat, solved\
**Created:** [December 8, 2019, 4:27pm UTC](https://support.prodi.gy/t/multiple-separate-text-classifications-in-a-single-model/2289 "2019-12-08T16:27:07Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![edward](https://avatars.discourse-cdn.com/v4/letter/e/90db22/32.png) [@edward](https://support.prodi.gy/u/edward)\
**Post date:** [December 11, 2019, 3:35pm UTC](https://support.prodi.gy/t/multiple-separate-text-classifications-in-a-single-model/2289/6 "2019-12-11T15:35:42Z")

</div>

Thanks, that _looks_ like what I want, but I've been having no fun trying to implement it.

I managed to save my "aggregated" model using the code you gave. But when I tried to import it I got:

```python
KeyError: "[E002] Can't find factory for 'textcat2'. This usually happens when spaCy calls `nlp.create_pipe` with a component name that's not built in - for example, when constructing the pipeline from a model's meta.json. If you're using a custom component, you can write to `Language.factories['textcat2']` or remove it from the model meta and add it via `nlp.add_pipe` instead."

```

I Googled that and found this thread saying I needed to package with `spacy package` for it to work: [adding custom attribute to doc, having NER use attribute](https://support.prodi.gy/t/adding-custom-attribute-to-doc-having-ner-use-attribute/356)

I tried that, but packaging didn't work:

```python
shutil.Error: [('am-test/textcat', 'am-test-packaged/en_vectors_web_lg-2.1.0/en_vectors_web_lg/en_vectors_web_lg-2.1.0/textcat', "[Errno 13] Permission denied: 'am-test-packaged/en_vectors_web_lg-2.1.0/en_vectors_web_lg/en_vectors_web_lg-2.1.0/textcat'"), ('am-test/textcat3', 'am-test-packaged/en_vectors_web_lg-2.1.0/en_vectors_web_lg/en_vectors_web_lg-2.1.0/textcat3', "[Errno 13] Permission denied: 'am-test-packaged/en_vectors_web_lg-2.1.0/en_vectors_web_lg/en_vectors_web_lg-2.1.0/textcat3'"), ('am-test/vocab', 'am-test-packaged/en_vectors_web_lg-2.1.0/en_vectors_web_lg/en_vectors_web_lg-2.1.0/vocab', "[Errno 13] Permission denied: 'am-test-packaged/en_vectors_web_lg-2.1.0/en_vectors_web_lg/en_vectors_web_lg-2.1.0/vocab'"), ('am-test', 'am-test-packaged/en_vectors_web_lg-2.1.0/en_vectors_web_lg/en_vectors_web_lg-2.1.0', "[Errno 13] Permission denied: 'am-test-packaged/en_vectors_web_lg-2.1.0/en_vectors_web_lg/en_vectors_web_lg-2.1.0'")]

```

> <https://github.com/explosion/spaCy/blob/38e1bc19f4a1c28e27938f46bb3805df4919fedc/spacy/cli/package.py#L71>

If I breakpoint at that line, do the copy manually, and then run the rest of the function, it seems to build - but then the resulting `.tar.gz` is only 4kb, and besides a mention in the `meta.json`, doesn't include my model.

---

_[View the full topic](https://support.prodi.gy/t/multiple-separate-text-classifications-in-a-single-model/2289)._
