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

在jupyter运行cli_demo.py里面的代码时遇到RuntimeError: This event loop is already running #65

Open
yuunnn-w opened this issue Sep 13, 2023 · 0 comments

Comments

@yuunnn-w
Copy link

RuntimeError Traceback (most recent call last)
Cell In[4], line 22
20 break
21 final_results = {}
---> 22 for results in webglm.stream_query(question):
23 final_results.update(results)
24 if "references" in results:

File ~/rknn/WebGLM/model/modeling_webglm.py:36, in WebGLM.stream_query(self, question)
35 def stream_query(self, question):
---> 36 refs = self.ref_retriever.query(question)
37 if not refs:
38 yield { "references": [], "answer": "" }

File ~/rknn/WebGLM/model/retriever/init.py:27, in ReferenceRetiever.query(self, question)
24 return None
26 print("[System] Fetching ...")
---> 27 fetch_results = self.fetcher.fetch(urls)
28 cnt = sum([len(fetch_results[key]) for key in fetch_results])
29 print("[System] Count of available fetch results: ", cnt)

File ~/rknn/WebGLM/model/retriever/fetching/init.py:28, in Fetcher.fetch(self, urls)
24 def fetch(self, urls: List[str]) -> Dict[str, List[str]]:
26 urls = self._pre_handle_urls(urls)
---> 28 self.loop.run_until_complete(get_raw_pages(urls, close_browser=True))
29 responses = [playwright_based_crawl_new.results[url] for url in urls]
31 ret = dict()

File ~/anaconda3/lib/python3.10/asyncio/base_events.py:625, in BaseEventLoop.run_until_complete(self, future)
614 """Run until the Future is done.
615
616 If the argument is a coroutine, it is wrapped in a Task.
(...)
622 Return the Future's result, or raise its exception.
623 """
624 self._check_closed()
--> 625 self._check_running()
627 new_task = not futures.isfuture(future)
628 future = tasks.ensure_future(future, loop=self)

File ~/anaconda3/lib/python3.10/asyncio/base_events.py:584, in BaseEventLoop._check_running(self)
582 def _check_running(self):
583 if self.is_running():
--> 584 raise RuntimeError('This event loop is already running')
585 if events._get_running_loop() is not None:
586 raise RuntimeError(
587 'Cannot run the event loop while another loop is running')

RuntimeError: This event loop is already running

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

1 participant