Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextCategorizer: TypeError: Only cupy arrays can be concatenated on v2.1.0a10 #3355

Closed
Tpt opened this issue Mar 4, 2019 · 3 comments
Closed
Labels
bug Bugs and behaviour differing from documentation feat / textcat Feature: Text Classifier gpu Using spaCy on GPU

Comments

@Tpt
Copy link
Contributor

Tpt commented Mar 4, 2019

How to reproduce the behaviour

With Spacy v2.1.0a10 installed using pip install spacy-nightly[cuda100]==v2.1.0a10 if I try to train the TextCategorizer with gpu backend enabled I get the following error:

    nlp.update(texts, annotations, sgd=optimizer, drop=0.5, losses=losses)
  File "/home/lstt/Projects/backend-sagemcom/venv/lib/python3.7/site-packages/spacy/language.py", line 449, in update
    proc.update(docs, golds, drop=drop, sgd=get_grads, losses=losses)
  File "pipes.pyx", line 918, in spacy.pipeline.pipes.TextCategorizer.update
  File "/home/lstt/Projects/backend-sagemcom/venv/lib/python3.7/site-packages/thinc/neural/_classes/feed_forward.py", line 46, in begin_update
    X, inc_layer_grad = layer.begin_update(X, drop=drop)
  File "/home/lstt/Projects/backend-sagemcom/venv/lib/python3.7/site-packages/thinc/api.py", line 132, in begin_update
    values = [fwd(X, *a, **k) for fwd in forward]
  File "/home/lstt/Projects/backend-sagemcom/venv/lib/python3.7/site-packages/thinc/api.py", line 132, in <listcomp>
    values = [fwd(X, *a, **k) for fwd in forward]
  File "/home/lstt/Projects/backend-sagemcom/venv/lib/python3.7/site-packages/thinc/api.py", line 225, in wrap
    output = func(*args, **kwargs)
  File "/home/lstt/Projects/backend-sagemcom/venv/lib/python3.7/site-packages/thinc/neural/_classes/feed_forward.py", line 46, in begin_update
    X, inc_layer_grad = layer.begin_update(X, drop=drop)
  File "/home/lstt/Projects/backend-sagemcom/venv/lib/python3.7/site-packages/spacy/_ml.py", line 92, in _preprocess_doc
    keys = ops.xp.concatenate(keys)
  File "/home/lstt/Projects/backend-sagemcom/venv/lib/python3.7/site-packages/cupy/manipulation/join.py", line 49, in concatenate
    return core.concatenate_method(tup, axis)
  File "cupy/core/core.pyx", line 2805, in cupy.core.core.concatenate_method
  File "cupy/core/core.pyx", line 2818, in cupy.core.core.concatenate_method
TypeError: Only cupy arrays can be concatenated

It seems to be an other occurrence of #1798. I have not experienced this problem with the alpha version v2.1.0a8.

Your Environment

  • spaCy version: 2.1.0a10
  • Platform: Linux-4.20.11-arch1-1-ARCH-x86_64-with-arch
  • Python version: 3.7.2
@honnibal honnibal added the bug Bugs and behaviour differing from documentation label Mar 5, 2019
@honnibal
Copy link
Member

honnibal commented Mar 5, 2019

Thanks! I thought I'd taken care of this. The GPU regressions are much more difficult to prevent, as we don't have automated CI running on GPU yet.

@ines ines added gpu Using spaCy on GPU feat / textcat Feature: Text Classifier labels Mar 6, 2019
@honnibal
Copy link
Member

honnibal commented Mar 9, 2019

Okay, fixed here: 28c26e2

This fix should be much more reliable than the previous patch in Thinc. We can later move this wrapper to Thinc, but for now it's useful to patch this without requiring a release.

@lock
Copy link

lock bot commented Apr 8, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bugs and behaviour differing from documentation feat / textcat Feature: Text Classifier gpu Using spaCy on GPU
Projects
None yet
Development

No branches or pull requests

3 participants