Make infinity adapt to condition exist. (#4657)

### What problem does this PR solve?

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Kevin Hu
2025-01-26 18:45:36 +08:00
committed by GitHub
parent b4303f6010
commit c354239b79
4 changed files with 69 additions and 15 deletions

View File

@ -71,7 +71,7 @@ class RecursiveAbstractiveProcessing4TreeOrganizedRetrieval:
start, end = 0, len(chunks)
if len(chunks) <= 1:
return
chunks = [(s, a) for s, a in chunks if len(a) > 0]
chunks = [(s, a) for s, a in chunks if s and len(a) > 0]
def summarize(ck_idx, lock):
nonlocal chunks
@ -125,6 +125,8 @@ class RecursiveAbstractiveProcessing4TreeOrganizedRetrieval:
threads = []
for c in range(n_clusters):
ck_idx = [i + start for i in range(len(lbls)) if lbls[i] == c]
if not ck_idx:
continue
threads.append(executor.submit(summarize, ck_idx, lock))
wait(threads, return_when=ALL_COMPLETED)
for th in threads: