Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am getting TimeError while using code2seq to predict long method #119

Open
konL opened this issue Apr 28, 2022 · 2 comments
Open

I am getting TimeError while using code2seq to predict long method #119

konL opened this issue Apr 28, 2022 · 2 comments

Comments

@konL
Copy link

konL commented Apr 28, 2022

Hi! Thank you for your work!
I used the command

python code2seq.py --load models/java-large-model/model_iter52.release --predict

to predict a new name for a single method, and it works well a for shorter method. But for a longer method I get a TimeError, I have looked at the code and found that it is mainly related to the extract_paths
I think this is related to http requests, but I don't understand why it is related to method length. How should I solve this problem?
My error messages:

Modify the file: "Input.java" and press any key when ready, or "q" / "exit" to exit

Traceback (most recent call last):
  File "code2seq.py", line 47, in <module>
    predictor.predict()
  File "C:\project\code2vec\code2seq\interactive_predict.py", line 35, in predict
    predict_lines, pc_info_dict = self.path_extractor.extract_paths(user_input)
  File "C:\project\code2vec\code2seq\extractor.py", line 26, in extract_paths
    raise TimeoutError(response.text)
TimeoutError: {"errorMessage":"2022-04-28T07:36:18.957Z b760b69b-e698-40b5-8202-40f767a36039 Task timed out after 19.14 seconds"}

Thank you!

@konL
Copy link
Author

konL commented Apr 28, 2022

And is it possible to predict the names of identifiers at other granularities?(field, variable....)Thank you!

@urialon
Copy link
Contributor

urialon commented May 2, 2022

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

The extract_paths API is exactly the same as the JavaExtractor, which is included in the codebase, but wrapped in a class that makes it a Lambda function in AWS. This way, manual examination (interactive mode) could be performed faster and easier.

In too long examples, the extract_paths API just times out.
You can either create a test set from your long examples using the preprocess.sh script, and evaluate (run the model in --test mode, as explained here) these examples on your machine.
If you wish to keep this "interactive" behavior, you can wrap the JavaExtractor with a local server that accepts POST requests, but it will require a little more work.

see also:
#85

Best
Uri

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants