paarthneekhara / byteNet-tensorflow

ByteNet for character-level language modelling
MIT License
319 stars 67 forks source link

We can upgrade the code to compatible with tf1.0.0 by the following diff: #8

Open SeekPoint opened 7 years ago

SeekPoint commented 7 years ago

git diff

diff --git a/ByteNet/model.py b/ByteNet/model.py index 4cfe3b3..3a12b5b 100644 --- a/ByteNet/model.py +++ b/ByteNet/model.py @@ -138,7 +138,7 @@ class Byte_net_model: decoder_output = self.decoder(source_embedding) loss = self.loss(decoder_output, target_sentence)

SeekPoint commented 7 years ago

W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations. Traceback (most recent call last): File "train_translator.py", line 144, in main() File "train_translator.py", line 89, in main bn_tensors = byte_net.build_translation_model(sample_size = key) File "/Users/yike.ke/yike_prj/byteNet-tensorflow/ByteNet/model.py", line 90, in build_translation_model decoder_output = self.decoder(target1_embedding, encoder_output) File "/Users/yike.ke/yike_prj/byteNet-tensorflow/ByteNet/model.py", line 259, in decoder currinput = tf.concat(2, [input, encoder_embedding]) File "/Users/yike.ke/yike_prj/ve_tf1.0_py2/venv/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 1029, in concat dtype=dtypes.int32).get_shape( File "/Users/yike.ke/yike_prj/ve_tf1.0_py2/venv/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 637, in convert_to_tensor as_ref=False) File "/Users/yike.ke/yike_prj/ve_tf1.0_py2/venv/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 702, in internal_convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "/Users/yike.ke/yike_prj/ve_tf1.0_py2/venv/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 110, in _constant_tensor_conversion_function return constant(v, dtype=dtype, name=name) File "/Users/yike.ke/yike_prj/ve_tf1.0_py2/venv/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 99, in constant tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape)) File "/Users/yike.ke/yike_prj/ve_tf1.0_py2/venv/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 367, in make_tensor_proto _AssertCompatible(values, dtype) File "/Users/yike.ke/yike_prj/ve_tf1.0_py2/venv/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 302, in _AssertCompatible (dtype.name, repr(mismatch), type(mismatch).name)) TypeError: Expected int32, got list containing Tensors of type '_Message' instead.

maybe I am wrong, it is report error above on tf1.0 or tf1.2

fajieyuan commented 6 years ago

I am not sure about masked 1d, It seems that the mask operation is done on difference channels like image in RGB channel. Do you think your implementation here is in line with the paper, see pixelRNN.