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

For loop support in python interpreter of Transformer agent #24362

Closed
dcy0577 opened this issue Jun 19, 2023 · 4 comments · Fixed by #24429
Closed

For loop support in python interpreter of Transformer agent #24362

dcy0577 opened this issue Jun 19, 2023 · 4 comments · Fixed by #24429

Comments

@dcy0577
Copy link

dcy0577 commented Jun 19, 2023

Feature request

Hello, I would like to add for loop support in https://github.com/huggingface/transformers/blame/c2393cad085e3875ee2206d917d46d15e50602a3/src/transformers/tools/python_interpreter.py
Any idea about how to implement this?

Motivation

For loop is quite common in generated code. Usually it will not cause infinite loop.

Your contribution

An additional 'elif' for 'ast.For' before the 'else' will be nice: https://github.com/huggingface/transformers/blame/c2393cad085e3875ee2206d917d46d15e50602a3/src/transformers/tools/python_interpreter.py#L132

@amyeroberts
Copy link
Collaborator

cc @sgugger

@sgugger
Copy link
Collaborator

sgugger commented Jun 20, 2023

Would you like to open a PR for this?

@dcy0577
Copy link
Author

dcy0577 commented Jun 21, 2023

I would like to, but I don't know how to implement it yet. Do you have any suggestions?

@sgugger
Copy link
Collaborator

sgugger commented Jun 22, 2023

Should be added with the PR mentioned above :-)

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 a pull request may close this issue.

3 participants