Lorraine333/ACL_CKBC

AttributeError: 'TensorVariable' object has no attribute 'get_value'

ravi03071991 opened this issue · 14 comments

Hi,

I am getting following error when I tried running train.py file from bilinear_ce. Can you help me on this?

Using cuDNN version 7003 on context None
Mapped name None to device cuda: Tesla K80 (0000:00:1E.0)
Using Training Data../commonsendata/Training/new_omcs600.txt
Using Word Embeddings with Dimension 200
Training on 600000 examples using lambda=1e-05
Saving models to: ../models/Bilinear_cetrainSize300frac1.0dSize200relSize150acti0.001.1e-05.800.RAND.tanh.txt
Traceback (most recent call last):
  File "train.py", line 84, in <module>
    tm = theano_word_model(We, words, params.embedsize, rel, params.relsize, Rel_init, params.LC, params.Lw, params.eta, params.margin, params.usepeep, params.activation)
  File "/home/ubuntu/data/sarcasm/bilinear_ce/commonsense.py", line 262, in __init__
    l_emb = lasagne.layers.EmbeddingLayer(l_in, input_size=self.we.get_value().shape[0], output_size=self.we.get_value().shape[1], W=self.we)
AttributeError: 'TensorVariable' object has no attribute 'get_value'

Thank you.

Hi Ravi,

Thanks for using our code and sorry for the late reply!

I think this might be a software version issue.

I run it on my machine and on another machine using linux system, the code both works. My theano version is 0.82, python version 2.7.6, scipy version 0.15.1, numpy version 0.11.2.

The other machine has the same theano and python version but has scipy verison 0.18.1, numpy version 0.12.0.

Maybe can you try with these version configurations? Also, are you downloading the embedding from this page http://ttic.uchicago.edu/~kgimpel/commonsense.html of embeddings.txt.gz?

Hope that helps, let me know if you still have issue.

Hi @Lorraine333 ,

Thank you for the help. I tried with the above configuration but numpy version 0.11.2/ 0.12.0 are not available. Can I know how to install with the specific numpy versions?
pip install numpy==0.11.2 is not working
I tried with numpy 1.9 version and it is giving same error.

Regards,
D. Ravi Theja.

Hi,

I tried with numpy version 1.14.2, and python version 2.7. How about your theono and lasagne version? You can try use these command to install the "correct" theano and lasagne versions. It works for me.

conda install theano==0.8.2
conda install lasagne==0.1

Let me know if you still have problems.

Hi,

still getting same error. Can I know the scipy version you are using for this? I am using python=2.7.6, numpy=1.14.2, scipy=1.0.1, theano=0.8.2, lasagne=0.1.

I am also getting following user warning.

UserWarning: downsample module has been moved to the theano.tensor.signal.pool module.
"downsample module has been moved to the theano.tensor.signal.pool module.")

Regards,
D. Ravi Theja.

my scipy version is 1.0.1 as well. So I don't think it's version error anymore.

Also, are you downloading the embedding from this page http://ttic.uchicago.edu/~kgimpel/commonsense.html of embeddings.txt.gz? And use this to initialize your word embedding?

Lorraine

I have downloaded embedding from this page http://ttic.uchicago.edu/~kgimpel/commonsense.html of embeddings.txt.gz. I renamed the file with embeddings.txt to get extracted. Is this the right way to extract the embeddings.txt.gz or is there any other command to extract?

Regards,
D. Ravi Theja.

Humm, that's right.

The code works on my machine, so I really have no idea why it's not working. Are you getting the same error running other models as well?

I tried running dnn_hingeloss model...I am getting following value error.

  File "train.py", line 53, in <module>
    (words, We) = getWordmap('../commonsendata/embeddings/embeddings.txt')
  File "/home/ubuntu/data/ACL_CKBC/dnn_hingeloss/utils.py", line 72, in getWordmap
    v.append(float(i[j]))
ValueError: could not convert string to float: �|���0�

is there any problem with my embeddings.txt file?

Regards,
D. Ravi Theja.

Yeah. I think it might be your embedding file. Humm, can you try on another machine see if that works?

I tried in other machine and getting same ValueError. I think the problem is with embeddings.txt file. When I opened the file it is showing some other characters which are not in readable form. Can you check once the uploaded embeddings.txt.gz file is the right one?

Hi @Lorraine333,

I guess the embeddings.txt.gz file got corrupted. Can you please check it once and upload again if needed?

Regards,
D. Ravi Theja.

I tried it myself and it works. I can send you directly if you want.

Yes. Can you send/share it to ravi03071991@gmail.com ?

Thank you.