Closed ch-au closed 11 months ago
Dear @ch-au, Sorry for the late reply! I accidentally missed this issue.
I think changing all asyncio.run
in factool.py to await
will work. Since Jupyter Notebook is already running an event loop, starting another event loop with asyncio.run()
won't be possible.
You could follow the installation instructions for developers. First clone the repo. Next, replace all asyncio.run
in factool.py to await
. Finally, reinstall the package after you've made the changes to the code.
Let me know if you have more questions!
Thanks, Ethan. That worked.
Von: Ethan Chern @.> Antworten an: GAIR-NLP/factool @.> Datum: Mittwoch, 13. September 2023 um 8:43 PM An: GAIR-NLP/factool @.> Cc: ch-au @.>, Mention @.***> Betreff: Re: [GAIR-NLP/factool] RuntimeError in Jupyter Notebook (Issue #33)
Dear @ch-auhttps://github.com/ch-au, Sorry for the late reply! I accidentally missed this issue.
I think changing all asyncio.run in factool.pyhttps://github.com/GAIR-NLP/factool/blob/main/factool/factool.py to await will work. Since Jupyter Notebook is already running an event loop, starting another event loop with asyncio.run() won't be possible.
Let me know if you have more questions!
— Reply to this email directly, view it on GitHubhttps://github.com/GAIR-NLP/factool/issues/33#issuecomment-1717467780, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGFDFJNS2FGMHET6OH4HHNDX2GL7TANCNFSM6AAAAAA4J64GZI. You are receiving this because you were mentioned.Message ID: @.***>
If I run the exmaple code for KBQA in a jupyter notebook I get the following error message: "RuntimeError: asyncio.run() cannot be called from a running event loop"
Any idea what the issue might be / how to fix it? Thank!
---- (executed code) ----- from factool import Factool
Initialize a Factool instance with the specified keys. foundation_model could be either "gpt-3.5-turbo" or "gpt-4"
factool_instance = Factool("gpt-4")
inputs = [ { "prompt": "Introduce Graham Neubig", "response": "Graham Neubig is a professor at MIT", "category": "kbqa" }, ] response_list = factool_instance.run(inputs)
print(response_list)