glorotxa/SME

ValueError: dimension mismatch with FB15k training

Closed this issue · 1 comments

I now fed the data with the right input format into the model, unfortunately I got another exception this time:

Traceback (most recent call last):
  File "FB15k_TransE.py", line 5, in <module>
    nbatches=100, totepochs=500, test_all=10, neval=1000, savepath='FB15k_TransE', datapath='../data/')
  File "/Users/dennisulmer/Desktop/SME-master/FB15k_exp.py", line 421, in launch
    FB15kexp(state, channel)
  File "/Users/dennisulmer/Desktop/SME-master/FB15k_exp.py", line 269, in FB15kexp
    tmpl, tmpr, tmpo, tmpnl, tmpnr)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/theano/compile/function_module.py", line 871, in __call__
    storage_map=getattr(self.fn, 'storage_map', None))
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/theano/gof/link.py", line 314, in raise_with_op
    reraise(exc_type, exc_value, exc_trace)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/theano/compile/function_module.py", line 859, in __call__
    outputs = self.fn()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/theano/gof/op.py", line 912, in rval
    r = p(n, [x[0] for x in i], o)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/theano/sparse/basic.py", line 4121, in perform
    rval = x * y
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/base.py", line 388, in __rmul__
    return (self.transpose() * tr).transpose()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/base.py", line 355, in __mul__
    raise ValueError('dimension mismatch')
ValueError: dimension mismatch
Apply node that caused the error: SparseDot(Eemb, SparseVariable{csr,float64})
Toposort index: 9
Inputs types: [TensorType(float64, matrix), Sparse[float64, csr]]
Inputs shapes: [(50, 16296), (17844, 816)]
Inputs strides: [(130368, 8), 'No strides']
Inputs values: ['not shown', 'not shown']
Outputs clients: [[InplaceDimShuffle{1,0}(SparseDot.0)]]

Backtrace when the node is created(use Theano flag traceback.limit=N to make it longer):
  File "FB15k_TransE.py", line 5, in <module>
    nbatches=100, totepochs=500, test_all=10, neval=1000, savepath='FB15k_TransE', datapath='../data/')
  File "/Users/dennisulmer/Desktop/SME-master/FB15k_exp.py", line 421, in launch
    FB15kexp(state, channel)
  File "/Users/dennisulmer/Desktop/SME-master/FB15k_exp.py", line 236, in FB15kexp
    marge=state.marge, rel=False)
  File "/Users/dennisulmer/Desktop/SME-master/model.py", line 1157, in TrainFn1Member
    lhsn = S.dot(embedding.E, inpln).T

HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.

What could be the source of this problem?

You hardcoded stats about your input data (like number of relations and entities) into your code.