bojone / bert_in_keras

在Keras下微调Bert的一些例子;some examples of bert in keras
655 stars 236 forks source link

run nl2sql_baseline.py meet the error! #9

Closed FakerYFX closed 5 years ago

FakerYFX commented 5 years ago

when i run nl2sql_baseline.py , i meet this error: Traceback (most recent call last): File 'nl2sql_baseline.py', line 254, in pcsel_loss = K.sparse_categorical_crossentropy(csel_in, pcsel) File '/home/work/.local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py', line 3345, in sparse_categorical_crossentropy logits = tf.reshape(output, [-1, int(output_shape[-1])]) TypeError: int returned non-int (type NoneType)

so i want to know the version of tenfsorfow and keras and python? @bojone

bojone commented 5 years ago

I am sorry for my negligence. We have to change source code of sparse_categorical_crossentropy in backend/tensorflow_backend.py: repalce logits = tf.reshape(output, [-1, int(output_shape[-1])]) with logits = tf.reshape(output, [-1, tf.shape(output)[-1]]).

Also see https://github.com/keras-team/keras/commit/613aeff37a721450d94906df1a3f3cc51e2299d4

FakerYFX commented 5 years ago

Thanks for your reply, it solved the error I meet !

FakerYFX commented 5 years ago

so how to make the test? just remove the comment:# test(test_data, test_tables)? @bojone

bojone commented 5 years ago

yes @xieyufei1993

jiangzz1628 commented 4 years ago

@xieyufei1993 您好,请问您那有没有nl2sql的数据集?