Spaces:
Running
on
Zero
Running
on
Zero
Update device_manager.py
Browse files- device_manager.py +5 -1
device_manager.py
CHANGED
@@ -89,7 +89,11 @@ def device_handler(func):
|
|
89 |
processed_kwargs = {k: process_arg(v) for k, v in kwargs.items()}
|
90 |
|
91 |
try:
|
92 |
-
|
|
|
|
|
|
|
|
|
93 |
|
94 |
# 處理輸出
|
95 |
if torch.is_tensor(result):
|
|
|
89 |
processed_kwargs = {k: process_arg(v) for k, v in kwargs.items()}
|
90 |
|
91 |
try:
|
92 |
+
# 如果函數是異步的,使用 await
|
93 |
+
if asyncio.iscoroutinefunction(func):
|
94 |
+
result = await func(*processed_args, **processed_kwargs)
|
95 |
+
else:
|
96 |
+
result = func(*processed_args, **processed_kwargs)
|
97 |
|
98 |
# 處理輸出
|
99 |
if torch.is_tensor(result):
|