Skip to content

Commit 46699bd

Browse files
fix: improve progress tracking in LLM record processing
1 parent 92a5912 commit 46699bd

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

run_ac.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ def parse_data_to_record_dict(record_chunk):
126126
print("Running attribute calculation.")
127127
calculated_attribute_by_record_id = {}
128128
idx = 0
129-
progress_size = 100
130129
amount = len(record_dict_list)
131-
current_progress = 0.0
132-
__print_progress(current_progress)
130+
progress_size = min(100, amount // 10)
131+
processed_records = 0
132+
__print_progress(processed_records / amount)
133133

134134
async def process_llm_record_batch(record_dict_batch: list):
135135
"""Process a batch of record_dicts, writes results into shared var calculated_attribute_by_record_id."""
@@ -148,10 +148,10 @@ async def process_llm_record_batch(record_dict_batch: list):
148148
f"{str(py_data_types) if len(py_data_types) > 1 else str(py_data_types[0])}."
149149
)
150150
calculated_attribute_by_record_id[record_dict["id"]] = attr_value
151-
152-
global current_progress
153-
current_progress = current_progress + len(record_dict_batch) / amount
154-
__print_progress(round(current_progress, 2))
151+
global processed_records
152+
processed_records = processed_records + 1
153+
if processed_records % progress_size == 0:
154+
__print_progress(round(processed_records / amount, 2))
155155

156156
async def process_async_llm_calls(record_dict_list):
157157
batch_size = max(

0 commit comments

Comments
 (0)