Skip to content

Commit cee4294

Browse files
committed
feat(parallel): add support for iMatrix generation tracking
- add support for iMatrix generation tracking - don't adjust progress bar when indeterminate
1 parent c96380c commit cee4294

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

Diff for: src/AutoGGUF.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import importlib
22
import json
3-
import re
43
import shutil
54
import urllib.request
65
import urllib.error
@@ -1547,6 +1546,7 @@ def task_finished(self, thread, task_item) -> None:
15471546
if thread in self.quant_threads:
15481547
self.quant_threads.remove(thread)
15491548
task_item.update_status(COMPLETED)
1549+
self.setAttribute(Qt.WA_WindowModified, True) # Set modified flag
15501550

15511551
def show_task_details(self, item) -> None:
15521552
self.logger.debug(SHOWING_TASK_DETAILS_FOR.format(item.text()))
@@ -1649,7 +1649,7 @@ def generate_imatrix(self) -> None:
16491649
task_item = TaskListItem(
16501650
task_name,
16511651
log_file,
1652-
show_progress_bar=False,
1652+
show_progress_bar=True,
16531653
logger=self.logger,
16541654
quant_threads=self.quant_threads,
16551655
)
@@ -1658,7 +1658,12 @@ def generate_imatrix(self) -> None:
16581658
self.task_list.addItem(list_item)
16591659
self.task_list.setItemWidget(list_item, task_item)
16601660

1661+
imatrix_chunks = None
1662+
16611663
thread.status_signal.connect(task_item.update_status)
1664+
thread.output_signal.connect(
1665+
lambda line, ti=task_item: self.parse_progress(line, ti, imatrix_chunks)
1666+
)
16621667
thread.finished_signal.connect(
16631668
lambda: self.task_finished(thread, task_item)
16641669
)

Diff for: src/QuantizationThread.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,31 @@ def parse_model_info(self, line) -> None:
7979
f"{quant_type}: {tensors} tensors"
8080
)
8181

82-
def parse_progress(self, line, task_item) -> None:
82+
def parse_progress(self, line, task_item, imatrix_chunks=None) -> None:
8383
# Parses the output line for progress information and updates the task item.
8484
match = re.search(r"\[\s*(\d+)\s*/\s*(\d+)\s*].*", line)
85+
8586
if match:
8687
current = int(match.group(1))
8788
total = int(match.group(2))
8889
progress = int((current / total) * 100)
8990
task_item.update_progress(progress)
91+
else:
92+
imatrix_match = re.search(
93+
r"compute_imatrix: computing over (\d+) chunks with batch_size \d+",
94+
line,
95+
)
96+
if imatrix_match:
97+
imatrix_chunks = int(imatrix_match.group(1))
98+
elif imatrix_chunks is not None:
99+
save_match = re.search(
100+
r"save_imatrix: stored collected data after (\d+) chunks in .*",
101+
line,
102+
)
103+
if save_match:
104+
saved_chunks = int(save_match.group(1))
105+
progress = int((saved_chunks / self.imatrix_chunks) * 100)
106+
task_item.update_progress(progress)
90107

91108
def terminate(self) -> None:
92109
# Terminate the subprocess if it's still running

Diff for: src/TaskListItem.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ def update_progress(self, value=None) -> None:
162162
self.progress_value = value
163163
self.progress_bar.setValue(self.progress_value)
164164
else:
165-
# Set progress bar to zero for indeterminate progress
166-
self.progress_bar.setValue(0)
165+
return
167166

168167
def restart_task(self, task_item) -> None:
169168
self.logger.info(RESTARTING_TASK.format(task_item.task_name))

Diff for: src/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Config:
5151

5252

5353
class Task(BaseModel):
54-
id: str = Field(..., description="Unique identifier for the task")
54+
# id: str = Field(..., description="Unique identifier for the task")
5555
status: str = Field(..., description="Current status of the task")
5656
progress: float = Field(..., description="Progress of the task as a percentage")
5757

0 commit comments

Comments
 (0)