staedi commited on
Commit
4f99dd1
·
verified ·
1 Parent(s): 8a88503

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +4 -2
agent.py CHANGED
@@ -9,7 +9,7 @@ def init_async():
9
  torch.classes.__path__ = [] # add this line to manually set it to empty.
10
 
11
 
12
- def run_async_task(async_func, *args):
13
  """
14
  Run an asynchronous function in a new event loop.
15
 
@@ -25,7 +25,9 @@ def run_async_task(async_func, *args):
25
 
26
  try:
27
  loop = asyncio.new_event_loop()
28
- loop.run_until_complete(async_func(*args))
 
 
29
  except:
30
  # Close the existing loop if open
31
  if loop is not None:
 
9
  torch.classes.__path__ = [] # add this line to manually set it to empty.
10
 
11
 
12
+ def run_async_task(async_func, **kwargs):
13
  """
14
  Run an asynchronous function in a new event loop.
15
 
 
25
 
26
  try:
27
  loop = asyncio.new_event_loop()
28
+ values = [val for val in kwargs.values()]
29
+
30
+ loop.run_until_complete(async_func(values))
31
  except:
32
  # Close the existing loop if open
33
  if loop is not None: