# mismatched structure when loading ner tranformers model (en\_core\_web\_trf)

**URL:** <https://support.prodi.gy/t/mismatched-structure-when-loading-ner-tranformers-model-en-core-web-trf/6013>\
**Category:** Uncategorized\
**Tags:** usage, ner, transformers\
**Created:** [October 6, 2022, 4:36pm UTC](https://support.prodi.gy/t/mismatched-structure-when-loading-ner-tranformers-model-en-core-web-trf/6013 "2022-10-06T16:36:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ruiyeNLP](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ruiyenlp/32/2305_2.png) [@ruiyeNLP](https://support.prodi.gy/u/ruiyeNLP)\
**Post date:** [October 6, 2022, 4:36pm UTC](https://support.prodi.gy/t/mismatched-structure-when-loading-ner-tranformers-model-en-core-web-trf/6013/1 "2022-10-06T16:36:23Z")

</div>

I am using Python 3.8, Prodigy 1.11.8, Spacy 3.4.0. I also downloaded the latest version of en\_core\_web\_trf.

I created my model 'en\_tagger\_parser\_trf' using prodigy the following code:

 ![Screenshot 2022-10-06 at 17.34.53](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/8/85b07288561a6d48dcc760172b66739cb8750ea2.png)

The model was trained with the following command:

> prodigy train --ner gdpr\_ner ./tmp\_model\_7 --eval-split 0.2 --config configAccuracy.cfg --label-stats --gpu-id 0 --base-model en\_tagger\_parser\_trf

 ![Screenshot 2022-10-06 at 17.36.50](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/e/e10cc5103a9f1116b8b59bf4a73a2dcba5f5de66.png)

I attempt to load the model using:

 ![Screenshot 2022-10-06 at 17.37.53](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/6/671c7a1604987a8d975a4fb817140ac39051c5ce.png)  
It throws the following exception:  
 ![Screenshot 2022-10-06 at 17.38.33](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/a/aeb275eddf08d3a53c57334f66ac81b5a40e8a00.png)

---

<div class="post-metadata">

**Author:** ![ryanwesslen](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ryanwesslen/32/2969_2.png) [@ryanwesslen](https://support.prodi.gy/u/ryanwesslen)\
**Post date:** [October 7, 2022, 4:16pm UTC](https://support.prodi.gy/t/mismatched-structure-when-loading-ner-tranformers-model-en-core-web-trf/6013/2 "2022-10-07T16:16:25Z")

</div>

hi @ruiyeNLP!

Can you explain what you're doing here?

> [@ruiyeNLP](#):
>
> ![Screenshot 2022-10-06 at 17.34.53](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/8/85b07288561a6d48dcc760172b66739cb8750ea2.png)
> 
> Screenshot 2022-10-06 at 17.34.53722×266 26.3 KB

I don't understand why you're loading `en_core_web_lg` but calling it a `_trf` since it would only have `tok2vec` layer, not a `transformers`. Maybe that's just a typo.

Are you trying to simply reuse a full pipeline but then create your own `ner`?

I found [this post](https://github.com/explosion/spaCy/discussions/10041) in spaCy GitHub Discussion forum with a similar error.

It recommends:

```python
nlp = spacy.load("en_core_web_lg", exclude=["ner"]) # could be en_core_web_trf
nlp.add_pipe("ner", source=spacy.load("my_custom_pipeline"))

```

Could you try this?
