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

Size mismatch error #269

Open
firasfrikha opened this issue Jul 9, 2020 · 4 comments
Open

Size mismatch error #269

firasfrikha opened this issue Jul 9, 2020 · 4 comments
Labels

Comments

@firasfrikha
Copy link

Hello everyone,
i'm trying to train neuralcoref for french language.
After training the model, i add it to the pipeline but when i execute this command:

doc = nlp(u"je suis firas")

I get the following error

---------------------------------------------------------------------------
ShapeMismatchError                        Traceback (most recent call last)
<ipython-input-31-0862bb3d76d3> in <module>
----> 1 doc = nlp(u"je suis firas")

~/.conda/envs/coref2/lib/python3.8/site-packages/spacy/language.py in __call__(self, text, disable, component_cfg)
    437             if not hasattr(proc, "__call__"):
    438                 raise ValueError(Errors.E003.format(component=type(proc), name=name))
--> 439             doc = proc(doc, **component_cfg.get(name, {}))
    440             if doc is None:
    441                 raise ValueError(Errors.E005.format(name=name))

neuralcoref.pyx in neuralcoref.neuralcoref.NeuralCoref.__call__()

neuralcoref.pyx in neuralcoref.neuralcoref.NeuralCoref.predict()

~/.conda/envs/coref2/lib/python3.8/site-packages/thinc/neural/_classes/model.py in __call__(self, x)
    165             Must match expected shape
    166         """
--> 167         return self.predict(x)
    168 
    169     def pipe(self, stream, batch_size=128):

~/.conda/envs/coref2/lib/python3.8/site-packages/thinc/neural/_classes/feed_forward.py in predict(self, X)
     38     def predict(self, X):
     39         for layer in self._layers:
---> 40             X = layer(X)
     41         return X
     42 

~/.conda/envs/coref2/lib/python3.8/site-packages/thinc/neural/_classes/model.py in __call__(self, x)
    165             Must match expected shape
    166         """
--> 167         return self.predict(x)
    168 
    169     def pipe(self, stream, batch_size=128):

~/.conda/envs/coref2/lib/python3.8/site-packages/thinc/check.py in checked_function(wrapped, instance, args, kwargs)
    153                 if not isinstance(check, Callable):
    154                     raise ExpectedTypeError(check, ["Callable"])
--> 155                 check(arg_id, fix_args, kwargs)
    156         return wrapped(*args, **kwargs)
    157 

~/.conda/envs/coref2/lib/python3.8/site-packages/thinc/check.py in has_shape_inner(arg_id, args, kwargs)
     72             # Allow underspecified dimensions
     73             if dim is not None and arg.shape[i] != dim:
---> 74                 raise ShapeMismatchError(arg.shape, shape_values, shape)
     75 
     76     return has_shape_inner

ShapeMismatchError: 

  Shape mismatch: input (0, 668) not compatible with [None, 3924].

  Traceback:
  ├─ __call__ in /home/equalios/.conda/envs/coref2/lib/python3.8/site-packages/spacy/language.py:439
  ├─── __call__ in neural/_classes/model.py:167
  └───── predict in neural/_classes/feed_forward.py:40
         >>> X = layer(X)
​```


I'am using an embedding vector of size 300
Can any one please help me
@svlandeg
Copy link
Collaborator

svlandeg commented Sep 7, 2020

Is this issue related to Issus #275 ?

@aditya624
Copy link

any update for this ?

Hello everyone,
i'm trying to train neuralcoref for french language.
After training the model, i add it to the pipeline but when i execute this command:

doc = nlp(u"je suis firas")

I get the following error

---------------------------------------------------------------------------
ShapeMismatchError                        Traceback (most recent call last)
<ipython-input-31-0862bb3d76d3> in <module>
----> 1 doc = nlp(u"je suis firas")

~/.conda/envs/coref2/lib/python3.8/site-packages/spacy/language.py in __call__(self, text, disable, component_cfg)
    437             if not hasattr(proc, "__call__"):
    438                 raise ValueError(Errors.E003.format(component=type(proc), name=name))
--> 439             doc = proc(doc, **component_cfg.get(name, {}))
    440             if doc is None:
    441                 raise ValueError(Errors.E005.format(name=name))

neuralcoref.pyx in neuralcoref.neuralcoref.NeuralCoref.__call__()

neuralcoref.pyx in neuralcoref.neuralcoref.NeuralCoref.predict()

~/.conda/envs/coref2/lib/python3.8/site-packages/thinc/neural/_classes/model.py in __call__(self, x)
    165             Must match expected shape
    166         """
--> 167         return self.predict(x)
    168 
    169     def pipe(self, stream, batch_size=128):

~/.conda/envs/coref2/lib/python3.8/site-packages/thinc/neural/_classes/feed_forward.py in predict(self, X)
     38     def predict(self, X):
     39         for layer in self._layers:
---> 40             X = layer(X)
     41         return X
     42 

~/.conda/envs/coref2/lib/python3.8/site-packages/thinc/neural/_classes/model.py in __call__(self, x)
    165             Must match expected shape
    166         """
--> 167         return self.predict(x)
    168 
    169     def pipe(self, stream, batch_size=128):

~/.conda/envs/coref2/lib/python3.8/site-packages/thinc/check.py in checked_function(wrapped, instance, args, kwargs)
    153                 if not isinstance(check, Callable):
    154                     raise ExpectedTypeError(check, ["Callable"])
--> 155                 check(arg_id, fix_args, kwargs)
    156         return wrapped(*args, **kwargs)
    157 

~/.conda/envs/coref2/lib/python3.8/site-packages/thinc/check.py in has_shape_inner(arg_id, args, kwargs)
     72             # Allow underspecified dimensions
     73             if dim is not None and arg.shape[i] != dim:
---> 74                 raise ShapeMismatchError(arg.shape, shape_values, shape)
     75 
     76     return has_shape_inner

ShapeMismatchError: 

  Shape mismatch: input (0, 668) not compatible with [None, 3924].

  Traceback:
  ├─ __call__ in /home/equalios/.conda/envs/coref2/lib/python3.8/site-packages/spacy/language.py:439
  ├─── __call__ in neural/_classes/model.py:167
  └───── predict in neural/_classes/feed_forward.py:40
         >>> X = layer(X)
​```


I'am using an embedding vector of size 300
Can any one please help me

@csgomezg0
Copy link

hi, has you find some solution?

@aditya624
Copy link

hi, has you find some solution?

i think not yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants