tech-srl / code2seq

Code for the model presented in the paper: "code2seq: Generating Sequences from Structured Representations of Code"
http://code2seq.org
MIT License
548 stars 165 forks source link

InvalidArgumentError running `train.sh` on custom dataset #100

Closed yrahul3910 closed 2 years ago

yrahul3910 commented 3 years ago

I am running the code (TensorFlow 1.15, CUDA 11.0) on C++ code from Kolkir's repo. I get the following runtime error when running train.sh. Could you please help me fix this?

Initalized variables
Started reader...
2021-06-29 21:48:57.323877: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcublas.so.11
2021-06-29 21:49:01.800470: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at sparse_to_dense_op.cc:128 : Invalid argument: indices[10] = [1,9] is out of bounds: need 0 <= index < [200,9]
2021-06-29 21:49:01.804618: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at sparse_to_dense_op.cc:128 : Invalid argument: indices[21] = [6,9] is out of bounds: need 0 <= index < [200,9]
Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1365, in _do_call
    return fn(*args)
  File "/opt/conda/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1350, in _run_fn
    target_list, run_metadata)
  File "/opt/conda/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1443, in _call_tf_sessionrun
    run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found.
  (0) Invalid argument: {{function_node __inference_tf_data_experimental_map_and_batch_Reader.process_dataset_2211}} indices[10] = [1,9] is out of bounds: need 0 <= index < [200,9]
     [[{{node SparseToDense_3}}]]
     [[IteratorGetNext]]
  (1) Invalid argument: {{function_node __inference_tf_data_experimental_map_and_batch_Reader.process_dataset_2211}} indices[10] = [1,9] is out of bounds: need 0 <= index < [200,9]
     [[{{node SparseToDense_3}}]]
     [[IteratorGetNext]]
     [[model/embedding_lookup_3/_93]]
0 successful operations.
0 derived errors ignored.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "code2seq.py", line 39, in <module>
    model.train()
  File "/home/ryedida/code2seq/model.py", line 96, in train
    _, batch_loss = self.sess.run([optimizer, train_loss])
  File "/opt/conda/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 956, in run
    run_metadata_ptr)
  File "/opt/conda/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1180, in _run
    feed_dict_tensor, options, run_metadata)
  File "/opt/conda/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1359, in _do_run
    run_metadata)
  File "/opt/conda/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1384, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found.
  (0) Invalid argument:  indices[10] = [1,9] is out of bounds: need 0 <= index < [200,9]
     [[{{node SparseToDense_3}}]]
     [[IteratorGetNext]]
  (1) Invalid argument:  indices[10] = [1,9] is out of bounds: need 0 <= index < [200,9]
     [[{{node SparseToDense_3}}]]
     [[IteratorGetNext]]
     [[model/embedding_lookup_3/_93]]
0 successful operations.
0 derived errors ignored.
2021-06-29 21:49:02.066263: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at sparse_to_dense_op.cc:128 : Invalid argument: indices[480] = [130,9] is out of bounds: need 0 <= index < [200,9]
2021-06-29 21:49:02.069476: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at sparse_to_dense_op.cc:128 : Invalid argument: indices[227] = [60,9] is out of bounds: need 0 <= index < [200,9]
2021-06-29 21:49:02.076446: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at sparse_to_dense_op.cc:128 : Invalid argument: indices[63] = [19,9] is out of bounds: need 0 <= index < [200,9]
2021-06-29 21:49:02.085207: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at sparse_to_dense_op.cc:128 : Invalid argument: indices[553] = [160,9] is out of bounds: need 0 <= index < [200,9]
2021-06-29 21:49:02.085585: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at sparse_to_dense_op.cc:128 : Invalid argument: indices[24] = [4,9] is out of bounds: need 0 <= index < [200,9]
2021-06-29 21:49:02.092384: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at sparse_to_dense_op.cc:128 : Invalid argument: indices[45] = [11,9] is out of bounds: need 0 <= index < [200,9]
2021-06-29 21:49:02.097423: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at sparse_to_dense_op.cc:128 : Invalid argument: indices[206] = [49,9] is out of bounds: need 0 <= index < [200,9]
2021-06-29 21:49:02.308567: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at sparse_to_dense_op.cc:128 : Invalid argument: indices[34] = [12,9] is out of bounds: need 0 <= index < [200,9]
2021-06-29 21:49:02.312928: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at sparse_to_dense_op.cc:128 : Invalid argument: indices[22] = [3,9] is out of bounds: need 0 <= index < [200,9]
urialon commented 3 years ago

Hi @yrahul3910 , Thank you for your interest in code2seq and sorry for the late reply.

My answer here is the same as in the other issue - I cannot provide support for Kolkir's implementation. If you prefer to use our implementation (based on TF 1.x), I'll be glad to help.

Best, Uri