Unnamed vectors -- this won't allow multiple vectors models to be loaded

Hi! I am new to Prodigy and even though everything seems to be running smoothly, I am getting the following error when running the text cat.teach command:

Warning: Unnamed vectors – this won’t allow multiple vectors models to be loaded. (Shape: (0, 0))

Command:
python3.6 -m prodigy textcat.teach db de_core_news_sm ~/Downloads/input.csv --label mylabel --exclude db

Any idea?

1 Like

Thanks for the report – this might be related to an issue in spaCy, which we’ve already fixed in the latest dev build. Could you try upgrading spaCy to v2.0.12.dev0 and see if this solves the problem?

pip install spacy==v2.0.12.dev0
1 Like

Thanks, I “Successfully installed spacy-2.0.12.dev0”, but the error is still the same. It seems to work fine even with this error message…

1 Like

Hey, I’m also encountering this error. On spacy 2.0.11.

I’ve also tried the dev build that you recommended above… And that didn’t fix it.

I don’t feel comfortable ignoring this warning, because I don’t really understand what it means.

I encounter the error when I run code to build a blank spacy model. My code looks roughly like:

nlp = spacy.blank('en')
ner = EntityRecognizer(nlp.vocab)
ner.add_label('ADD_SOME_LABELS')
nlp.add_pipe(ner)
nlp.add_pipe(SentenceSegmenter(nlp.vocab))
#some custom code to add my word2vec model vectors to the model
rows, cols = 0, 0
for i, line in enumerate(open(word2vec_bin_file, 'r')):
    if i == 0:
        rows, cols = line.split()
        rows, cols = int(rows), int(cols)
        nlp.vocab.reset_vectors(shape=(rows,cols))
    else:
        word, *vec = line.split()
        vec = np.array([float(i) for i in vec])
        nlp.vocab.set_vector(word, vec)

optimizer = nlp.begin_training(lambda: []) 

The warning is generated from within nlp.begin_training

Cheers.

1 Like

Hi mitch,

I had same issue, add the vector name before calling the begin_training.

nlp.vocab.vectors.name = 'spacy_pretrained_vectors'
optimizer = nlp.begin_training()

The reason after investigating the source code, it gives you warning if you don’t put name into vectors before calling begin_training.

Hope helps

3 Likes