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

enable main() function execution in generated code #4

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

aarora79
Copy link
Contributor

@aarora79 aarora79 commented Jan 1, 2025

Often times the generated code by a model contained if __name__ == "__main__": but none of this code was getting executed because the exec_globals being passed to exec in unsafe_execute was an empty dictionary so the built-in __name__ global variable (like all global variables) did not exist anymore in the namespace for the generated code and hence the main function in the generated code never got called. The main function not getting called resulted in an empty .pred file (the file was created because the file open statement was added separately outside of the generated code's main function) and this resulted in the judge declaring that the answer to the unit test was wrong because it did not match the expected output (because it was comparing the empty prediction file contents with the ground truth file which was not empty).

@benshi34 benshi34 merged commit 46f18c8 into princeton-nlp:main Jan 14, 2025
1 check passed
@benshi34
Copy link
Collaborator

Thanks for the pr! Fixed this in my local repo but didn't push it to prod. Appreciate the contribution.

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

Successfully merging this pull request may close these issues.

2 participants