sheffieldnlp / deepQuest

Framework for neural-based Quality Estimation
https://sheffieldnlp.github.io/deepQuest/
BSD 3-Clause "New" or "Revised" License
42 stars 13 forks source link

DataType error #4

Closed dimitarsh1 closed 5 years ago

dimitarsh1 commented 5 years ago

Hello all,

I ran the framework with the BiRNN model and I had no problem (more or less).

However, I cannot manage to run the Postech version. I have followed the example in the website: https://sheffieldnlp.github.io/deepQuest/tutorials.html#training-a-qe-model but it gives the following error on training the predictor:

Traceback (most recent call last): File "main.py", line 610, in train_model(parameters, args.dataset, trainable_est=True, trainable_pred=True, weights_path=parameters.get('PRED_WEIGHTS', None)) File "main.py", line 100, in train_model clear_dirs=True, weights_path=weights_path) File "/home/dimitar/tools/deepQuest/quest/model_zoo.py", line 117, in init eval('self.' + model_type + '(params)') File "", line 1, in File "/home/dimitar/tools/deepQuest/quest/model_zoo.py", line 3498, in Predictor ctx_mean = MaskedMean(trainable=self.trainable)(annotations) File "/home/dimitar/tools/deepQuest/quest/keras/engine/topology.py", line 602, in call output = self.call(inputs, *kwargs) File "/home/dimitar/tools/deepQuest/quest/keras/layers/core.py", line 1087, in call return K.mean(mask[:, :, None] x, axis=1) File "/home/dimitar/anaconda2/envs/theano/lib/python2.7/site-packages/tensorflow/python/ops/math_ops.py", line 847, in binary_op_wrapper return func(x, y, name=name) File "/home/dimitar/anaconda2/envs/theano/lib/python2.7/site-packages/tensorflow/python/ops/math_ops.py", line 1091, in _mul_dispatch return gen_math_ops.mul(x, y, name=name) File "/home/dimitar/anaconda2/envs/theano/lib/python2.7/site-packages/tensorflow/python/ops/gen_math_ops.py", line 4759, in mul "Mul", x=x, y=y, name=name) File "/home/dimitar/anaconda2/envs/theano/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 609, in _apply_op_helper param_name=input_name) File "/home/dimitar/anaconda2/envs/theano/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 60, in _SatisfiesTypeConstraint ", ".join(dtypes.as_dtype(x).name for x in allowed_list))) TypeError: Value passed to parameter 'x' has DataType bool not in list of allowed values: bfloat16, float16, float32, float64, uint8, int8, uint16, int16, int32, int64, complex64, complex128

Any suggestions? Thank you.

julia-ive commented 5 years ago

Hi @dimitarsh1, Thanks for your interest to deepQuest! I can see that you are using Tensorflow. Unfortunately, until now our code has been tested only for Keras over Theano. Could you try that ? Best, Julia

dimitarsh1 commented 5 years ago

Hi Julia,

Indeed, that was the issue. I don't know why it was running tensorflow, since I used the requirements.txt to set up a conda environment.

Anyway, thanks for spotting that. Reinstalled theano and removed tensorflow from the environment and now it is running. Interestingly, the BiRNN method worked with tensorflow.

Cheers, Dimitar

julia-ive commented 5 years ago

Dimitar,

Glad it helped ! Well, BiRNN is a component we added using the standard Keras library, while POSTECH uses Theano-specific (at that time) components of NMT-Keras.

Let me know if further help will be needed, Julia

lvapeab commented 5 years ago

Hi,

I'm one of the maintainers of the Keras' fork upon which deepQuest is based on (MarcBS/keras). As @julia-ive said, some layers lacked Tensorflow support. We made some minor changes (mostly related to castings) for also supporting Tensorflow. It should work fine for both Theano and Tensorflow.

julia-ive commented 5 years ago

Hi @lvapeab

Thanks a lot for this useful update! Switching to Tensorflow is one of the open issues. I will handle ASAP. I am closing this one.

Have a nice day, Julia

dimitarsh1 commented 5 years ago

Thank you both.

Cheers, Dimitar