tech-srl / code2vec

TensorFlow code for the neural network presented in the paper: "code2vec: Learning Distributed Representations of Code"
https://code2vec.org
MIT License
1.11k stars 286 forks source link

Error continuing training with an existing model #148

Open smyoder opened 2 years ago

smyoder commented 2 years ago

Hello,

Whenever I attempt to continue training a pre-trained model using python code2vec.py --load <model path> --data <data path> --save <save path> I get the following error: File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\client\session.py", line 1377, in _do_call return fn(*args) File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\client\session.py", line 1360, in _run_fn return self._call_tf_sessionrun(options, feed_dict, fetch_list, File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\client\session.py", line 1453, in _call_tf_sessionrun return tf_session.TF_SessionRun_wrapper(self._session, options, feed_dict, tensorflow.python.framework.errors_impl.NotFoundError: NewRandomAccessFile failed to Create/Open: : The system cannot find the path specified. ; No such process [[{{node IteratorGetNext_1}}]]

This error occurs both for the pre-trained model available for download here and a model I trained from scratch on my own data using train.sh.

I am running on Windows.

urialon commented 2 years ago

Hi @smyoder , Thank you for your interest in our work!

This indeed sounds like a Windows compatibility issue with file paths.

Is this the full error that you're seeing? If not, can you paste here the full error?

smyoder commented 2 years ago

Thanks for your prompt response. Here is the full error.

`Traceback (most recent call last): File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\client\session.py", line 1375, in _do_call return fn(*args) File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\client\session.py", line 1359, in _run_fn return self._call_tf_sessionrun(options, feed_dict, fetch_list, File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\client\session.py", line 1451, in _call_tf_sessionrun return tf_session.TF_SessionRun_wrapper(self._session, options, feed_dict, tensorflow.python.framework.errors_impl.NotFoundError: NewRandomAccessFile failed to Create/Open: : The system cannot find the path specified. ; No such process [[{{node IteratorGetNext_1}}]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\User\\code2vec.py", line 23, in model.train() File "C:\Users\User\\tensorflow_model.py", line 95, in train evaluation_results = self.evaluate() File "C:\Users\User\\tensorflow_model.py", line 158, in evaluate top_words, top_scores, original_names, code_vectors = self.sess.run( File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\client\session.py", line 967, in run result = self._run(None, fetches, feed_dict, options_ptr, File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\client\session.py", line 1190, in _run results = self._do_run(handle, final_targets, final_fetches, File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\client\session.py", line 1368, in _do_run return self._do_call(_run_fn, feeds, fetches, targets, options, File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\client\session.py", line 1394, in _do_call raise type(e)(node_def, op, message) # pylint: disable=no-value-for-parameter tensorflow.python.framework.errors_impl.NotFoundError: NewRandomAccessFile failed to Create/Open: : The system cannot find the path specified. ; No such process [[node IteratorGetNext_1 (defined at \\tensorflow_model.py:122) ]]

Errors may have originated from an input operation. Input Source operations connected to node IteratorGetNext_1: IteratorV2_1 (defined at \\tensorflow_model.py:120)

Original stack trace for 'IteratorGetNext_1': File "\\code2vec.py", line 23, in model.train() File "\\tensorflow_model.py", line 95, in train evaluation_results = self.evaluate() File "\\tensorflow_model.py", line 122, in evaluate input_tensors = input_iterator.get_next() File "\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\data\ops\iterator_ops.py", line 416, in get_next flat_ret = gen_dataset_ops.iterator_get_next( File "\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\ops\gen_dataset_ops.py", line 2747, in iterator_getnext , _, _op, _outputs = _op_def_library._apply_op_helper( File "\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 748, in _apply_op_helper op = g._create_op_internal(op_type_name, inputs, dtypes=None, File "\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\framework\ops.py", line 3561, in _create_op_internal ret = Operation( File "\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\framework\ops.py", line 2045, in init self._traceback = tf_stack.extract_stack_for_node(self._c_op)`

urialon commented 2 years ago

Hi, It looks like the data path was not found, or at least, not parsed well on windows.

I suggest running on Linux. Best, Uri