Kevin Hu commited on
Commit
2118d99
·
1 Parent(s): 91751af

boost paralal of graphrag (#1924)

Browse files

### What problem does this PR solve?


### Type of change

- [x] Performance Improvement

Files changed (1) hide show
  1. graphrag/index.py +2 -2
graphrag/index.py CHANGED
@@ -61,11 +61,11 @@ def build_knowlege_graph_chunks(tenant_id: str, chunks: List[str], callback, ent
61
 
62
  assert left_token_count > 0, f"The LLM context length({llm_bdl.max_length}) is smaller than prompt({ext.prompt_token_count})"
63
 
64
- BATCH_SIZE=1
65
  texts, graphs = [], []
66
  cnt = 0
67
  threads = []
68
- exe = ThreadPoolExecutor(max_workers=12)
69
  for i in range(len(chunks)):
70
  tkn_cnt = num_tokens_from_string(chunks[i])
71
  if cnt+tkn_cnt >= left_token_count and texts:
 
61
 
62
  assert left_token_count > 0, f"The LLM context length({llm_bdl.max_length}) is smaller than prompt({ext.prompt_token_count})"
63
 
64
+ BATCH_SIZE=4
65
  texts, graphs = [], []
66
  cnt = 0
67
  threads = []
68
+ exe = ThreadPoolExecutor(max_workers=50)
69
  for i in range(len(chunks)):
70
  tkn_cnt = num_tokens_from_string(chunks[i])
71
  if cnt+tkn_cnt >= left_token_count and texts: