Skip to content

Commit 36bb6be

Browse files
committed
fix: use get_running_loop instead of get_event_loop in async env
1 parent d2c4135 commit 36bb6be

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

graphgen/models/evaluator/length_evaluator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def __init__(self, tokenizer_name: str = "cl100k_base", max_concurrent: int = 10
1313

1414
async def evaluate_single(self, pair: QAPair) -> float:
1515
# In async context, we should use the running loop
16-
loop = asyncio.get_event_loop()
16+
loop = asyncio.get_running_loop()
1717
return await loop.run_in_executor(None, self._calculate_length, pair.answer)
1818

1919
def _calculate_length(self, text: str) -> float:

graphgen/models/evaluator/mtld_evaluator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(self, max_concurrent: int = 100):
2020
async def evaluate_single(self, pair: QAPair) -> float:
2121
# In async context, we should use the running loop
2222
import asyncio
23-
loop = asyncio.get_event_loop()
23+
loop = asyncio.get_running_loop()
2424
return await loop.run_in_executor(None, self._calculate_mtld_score, pair.answer)
2525

2626
def _calculate_mtld_score(self, text: str, threshold=0.72) -> float:

0 commit comments

Comments
 (0)