byteNet-tensorflow icon indicating copy to clipboard operation
byteNet-tensorflow copied to clipboard

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

Open SeekPoint opened this issue 8 years ago • 2 comments

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)

  •           tf.scalar_summary('LOSS', loss)
    
  •           tf.summary.scalar('LOSS', loss)
    
              flat_logits = tf.reshape( decoder_output, [-1, options['n_target_quant']])
              prediction = tf.argmax(flat_logits, 1)
    

@@ -220,7 +220,7 @@ class Byte_net_model:

            flat_logits = tf.reshape( decoder_output, [-1, options['n_target_quant']])
            flat_targets = tf.reshape( target_one_hot, [-1, options['n_target_quant']])
  •           loss = tf.nn.softmax_cross_entropy_with_logits(flat_logits, flat_targets, name='decoder_cross_entropy_loss')
    
  •           loss = tf.nn.softmax_cross_entropy_with_logits(logits=flat_logits, labels=flat_targets, name='decoder_cross_entropy_loss')
    
              if 'target_mask_chars' in options:
                      # MASK LOSS BEYOND EOL IN TARGET
    

diff --git a/train_generator.py b/train_generator.py index 78d502c..72e898b 100644

SeekPoint avatar Apr 07 '17 08:04 SeekPoint

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 curr_input = 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

SeekPoint avatar Aug 15 '17 07:08 SeekPoint

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.

fajieyuan avatar Jan 02 '18 23:01 fajieyuan