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

python_interpreter.py seems not support asyncio.run() #36920

Closed
4 tasks
gdw439 opened this issue Mar 24, 2025 · 3 comments
Closed
4 tasks

python_interpreter.py seems not support asyncio.run() #36920

gdw439 opened this issue Mar 24, 2025 · 3 comments
Labels

Comments

@gdw439
Copy link

gdw439 commented Mar 24, 2025

System Info

python_interpreter.py seems not support asyncio.run(),

when I use this code,
Image

it takes that error,
Image

Who can help?

No response

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

some error

Expected behavior

pass run code in python_interpreter.py, when define my tool function with asyncio.run()

@gdw439 gdw439 added the bug label Mar 24, 2025
@Rocketknight1
Copy link
Member

cc @aymeric-roucher, but note that transformers.agents is now deprecated in favour of smolagents, so we may not fix this!

@jecrs
Copy link

jecrs commented Mar 27, 2025

Not wanting to be a square, but asyncio isn't even used upstream of your code. This error happens when a closed loop is already running, but the only time an asyncio loop is created on a transformers.agents is on the testing_utils that this file doesn't seem to invoke. Please check out this and implement the nest_asyncio lib on your workflow, since this seems to be a problem with your env, not with huggingface

lots o' love

  • Jean

P.If you can trace the point where the asyncio loop is created upstream of your code, let me know and I'll eat my words.

@gdw439
Copy link
Author

gdw439 commented Mar 27, 2025

Okay, much appreciated. I'll try it later.

@gdw439 gdw439 closed this as completed Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants