Skip to content

Commit 7d86271

Browse files
committed
fix: update asyncio event loop retrieval in evaluators and correct gene ID access in NCBISearch
1 parent d2c4135 commit 7d86271

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
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:

graphgen/models/searcher/db/ncbi_searcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def get_best_hit(self, keyword: str) -> Optional[dict]:
380380
search_results = Entrez.read(search_handle)
381381

382382
if len(gene_id := search_results.get("IdList", [])) > 0:
383-
result = self.get_by_gene_id(gene_id)
383+
result = self.get_by_gene_id(gene_id[0])
384384
return result
385385
except (RequestException, IncompleteRead):
386386
raise

0 commit comments

Comments
 (0)