# ValueError: Could not broadcast input array from shape (64) into shape (64,1)

**URL:** https://support.prodi.gy/t/valueerror-could-not-broadcast-input-array-from-shape-64-into-shape-64-1/446
**Category:** Uncategorized
**Tags:** thinc
**Created:** [March 27, 2018, 1:43pm UTC](https://support.prodi.gy/t/valueerror-could-not-broadcast-input-array-from-shape-64-into-shape-64-1/446 "2018-03-27T13:43:58Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![cmc476](https://avatars.discourse-cdn.com/v4/letter/c/7ab992/32.png) [@cmc476](https://support.prodi.gy/u/cmc476)
#### Post date: [March 27, 2018, 1:43pm UTC](https://support.prodi.gy/t/valueerror-could-not-broadcast-input-array-from-shape-64-into-shape-64-1/446/1 "2018-03-27T13:43:58Z")

</div>

I have a model directory that works wonderfully in the anaconda environment I built it in - if I try to load that model as either the raw directory (tarred and zipped) or as a package (following pkg build instructions) I get the error in the subject line - for python3.6 and python2.7 - looking for a clue here as I’m stumped.

File “…/site-packages/thinc/neural/util.py”, line 48, in copy\_array  
dst[:] = src  
ValueError: could not broadcast input array from shape (64) into shape (64,1)

---

<div class="post-metadata">

### Author: ![honnibal](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/honnibal/32/35_2.png) [@honnibal](https://support.prodi.gy/u/honnibal)
#### Post date: [March 27, 2018, 3:42pm UTC](https://support.prodi.gy/t/valueerror-could-not-broadcast-input-array-from-shape-64-into-shape-64-1/446/2 "2018-03-27T15:42:58Z")

</div>

Hmm! Questions:

1. What model is it – the text classifier, NER, …?

2. Was it trained and loaded on CPU, or is a GPU involved somewhere?

3. Are any vectors loaded?

4. What version of Thinc? Are you sure it’s the same version in your environment and when you load back later?

---

<div class="post-metadata">

### Author: ![cmc476](https://avatars.discourse-cdn.com/v4/letter/c/7ab992/32.png) [@cmc476](https://support.prodi.gy/u/cmc476)
#### Post date: [March 27, 2018, 3:50pm UTC](https://support.prodi.gy/t/valueerror-could-not-broadcast-input-array-from-shape-64-into-shape-64-1/446/3 "2018-03-27T15:50:41Z")

</div>

1. Text Classifier.
2. Trained and loaded on CPU (All CPU everywhere).
3. Large vector model (“en-vectors-web-lg”) was used in training and is installed on target environments.
4. Thinc version 6.10.2 loaded on working machine and non-working machines.

---

<div class="post-metadata">

### Author: ![cmc476](https://avatars.discourse-cdn.com/v4/letter/c/7ab992/32.png) [@cmc476](https://support.prodi.gy/u/cmc476)
#### Post date: [March 27, 2018, 4:32pm UTC](https://support.prodi.gy/t/valueerror-could-not-broadcast-input-array-from-shape-64-into-shape-64-1/446/4 "2018-03-27T16:32:03Z")

</div>

Don’t know if it’s significant or not - but the base environment is Ubuntu 16, anaconda py3 - non-working environments - Ubuntu 16 anaconda 2.7, and Ubuntu 14 anaconda py2 3.6 virtual environment.

Seems to me it would be some change in numpy - but I’ve tried to ensure consistent versions (1.11.3) there as well.

---

<div class="post-metadata">

### Author: ![cmc476](https://avatars.discourse-cdn.com/v4/letter/c/7ab992/32.png) [@cmc476](https://support.prodi.gy/u/cmc476)
#### Post date: [March 27, 2018, 10:25pm UTC](https://support.prodi.gy/t/valueerror-could-not-broadcast-input-array-from-shape-64-into-shape-64-1/446/5 "2018-03-27T22:25:53Z")

</div>

Full trace on fresh 3.6 env -

> > > import spacy  
> > > nlp = spacy.load("models/my-model")  
> > > Traceback (most recent call last):  
> > > File "", line 1, in   
> > > File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/spacy/ **init**.py", line 19, in load  
> > > return util.load\_model(name, \*\*overrides)  
> > > File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/spacy/util.py", line 117, in load\_model  
> > > return load\_model\_from\_path(Path(name), \*\*overrides)  
> > > File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/spacy/util.py", line 159, in load\_model\_from\_path  
> > > return nlp.from\_disk(model\_path)  
> > > File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/spacy/language.py", line 638, in from\_disk  
> > > util.from\_disk(path, deserializers, exclude)  
> > > File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/spacy/util.py", line 522, in from\_disk  
> > > reader(path / key)  
> > > File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/spacy/language.py", line 634, in   
> > > deserializers[name] = lambda p, proc=proc: proc.from\_disk(p, vocab=False)  
> > > File "pipeline.pyx", line 212, in spacy.pipeline.Pipe.from\_disk  
> > > File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/spacy/util.py", line 522, in from\_disk  
> > > reader(path / key)  
> > > File "pipeline.pyx", line 205, in spacy.pipeline.Pipe.from\_disk.load\_model  
> > > File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/thinc/neural/\_classes/model.py", line 352, in from\_bytes  
> > > copy\_array(dest, param[b'value'])  
> > > File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/thinc/neural/util.py", line 48, in copy\_array  
> > > dst[:] = src  
> > > ValueError: could not broadcast input array from shape (64) into shape (64,1)

# spacy validate

```
Installed models (spaCy v2.0.9)
/opt/anaconda/envs/py36/lib/python3.6/site-packages/spacy

TYPE NAME MODEL VERSION                                   
package en-vectors-web-lg en_vectors_web_lg 2.0.0 ✔      
package en-core-web-sm en_core_web_sm 2.0.0 ✔      
package en-core-web-lg en_core_web_lg 2.0.0 ✔      
link en_core_web_sm en_core_web_sm 2.0.0 ✔      
link en_core_web_lg en_core_web_lg 2.0.0 ✔      
link en_vectors_web_lg en_vectors_web_lg 2.0.0 ✔

```

---

<div class="post-metadata">

### Author: ![cmc476](https://avatars.discourse-cdn.com/v4/letter/c/7ab992/32.png) [@cmc476](https://support.prodi.gy/u/cmc476)
#### Post date: [March 27, 2018, 10:34pm UTC](https://support.prodi.gy/t/valueerror-could-not-broadcast-input-array-from-shape-64-into-shape-64-1/446/6 "2018-03-27T22:34:02Z")

</div>

Of note - above trace is python 3.6.4 on ubuntu 14 - same model loads fine ubuntu 16 python 3.6.0

# python

Python 3.6.0 |Anaconda custom (64-bit)| (default, Dec 23 2016, 12:22:00)  
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux  
Type "help", "copyright", "credits" or "license" for more information.

> > > import spacy  
> > > nlp = spacy.load("models/my-model")

---

<div class="post-metadata">

### Author: ![cmc476](https://avatars.discourse-cdn.com/v4/letter/c/7ab992/32.png) [@cmc476](https://support.prodi.gy/u/cmc476)
#### Post date: [March 27, 2018, 10:36pm UTC](https://support.prodi.gy/t/valueerror-could-not-broadcast-input-array-from-shape-64-into-shape-64-1/446/7 "2018-03-27T22:36:18Z")

</div>

# python

Python 3.6.4 |Anaconda, Inc.| (default, Mar 13 2018, 01:15:57)  
[GCC 7.2.0] on linux  
Type "help", "copyright", "credits" or "license" for more information.

> > > import spacy  
> > > nlp = spacy.load("models/my-model")  
> > > Traceback (most recent call last):....

---

<div class="post-metadata">

### Author: ![cmc476](https://avatars.discourse-cdn.com/v4/letter/c/7ab992/32.png) [@cmc476](https://support.prodi.gy/u/cmc476)
#### Post date: [March 29, 2018, 3:34am UTC](https://support.prodi.gy/t/valueerror-could-not-broadcast-input-array-from-shape-64-into-shape-64-1/446/9 "2018-03-29T03:34:56Z")

</div>

Exported my Ubuntu 16 3.6.0 environment to yml file and was able to get it working on Ubuntu 14 - let me know if you need anything to narrow the issue down.

---

<div class="post-metadata">

### Author: ![Mayank](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/mayank/32/1435_2.png) [@Mayank](https://support.prodi.gy/u/Mayank)
#### Post date: [June 4, 2020, 10:45am UTC](https://support.prodi.gy/t/valueerror-could-not-broadcast-input-array-from-shape-64-into-shape-64-1/446/10 "2020-06-04T10:45:42Z")

</div>

Hi Matthew

I tried to run `spacy train` to train NER model with _en\_vectors\_web\_lg_ as a base model and _tok2vec\_cd8\_model289.bin_ [tok2vec model](https://github.com/explosion/projects/releases/download/tok2vec/tok2vec_cd8_model289.bin) as a pre-trained language model but I got the following error:

 ![Screenshot from 2020-06-04 16-14-32](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/f/f06becd53f262c31da0c44d51b85a76e2e823b36.png)

Please advise  
Thanks 🙂
