Skip to content

Commit 8f09637

Browse files
committed
Update mapreduce.py
1 parent 208b11b commit 8f09637

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

optillm/plugins/longcepo/mapreduce.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ def fetch_map_response(client, model, chunk, query, system_prompt, summary):
158158
tokenizer,
159159
cb_log,
160160
longcepo_config,
161+
irrelevance_tags,
161162
)
162-
result = remove_chunks(result, irrelevance_tags)
163163
if not result:
164164
return "No information", cb_log
165165

@@ -200,6 +200,7 @@ def collapse_chunks(
200200
tokenizer,
201201
cb_log: CBLog,
202202
longcepo_config: LongCepoConfig,
203+
irrelevance_tags: Tuple[str] = ("[NO INFORMATION]",),
203204
) -> Tuple[List[str], CBLog]:
204205
"""
205206
Collapses context chunk pairs in sliding window until the total token count fits within the context window.
@@ -269,6 +270,7 @@ def fetch_collapse_response(client, model, docs, query, system_prompt):
269270
system_prompt,
270271
cb_log,
271272
)
273+
context_chunks = remove_chunks(context_chunks, irrelevance_tags)
272274
merge_pair_idx = (merge_pair_idx + 1) % max(len(context_chunks) - 1, 1)
273275
num_tokens = get_prompt_length(format_chunk_list(context_chunks), tokenizer)
274276
collapse_step += 1

0 commit comments

Comments
 (0)