mirror of
https://github.com/yusufipk/dikte.git
synced 2026-09-11 10:56:10 +00:00
Count a model bigger than two gigabytes upwards
Qt's int is C++'s 32-bit one, so the progress of a 2.3 GB download arrived at the other end of the signal as -1805209440, which is the real figure less 2^32. The file was landing correctly; only the line under it was wrong, reading "1.0 MB of -1805209440 B (-1%)".
This commit is contained in:
+3
-1
@@ -119,7 +119,9 @@ class LocalModelBox(QGroupBox):
|
||||
|
||||
_listed = pyqtSignal(list, str)
|
||||
_quants = pyqtSignal(list, str)
|
||||
_progress = pyqtSignal(int, int)
|
||||
# qint64 rather than int, which is C++'s 32-bit one: a 2.3 GB model is more
|
||||
# than fits in it, and the count comes out the far side negative.
|
||||
_progress = pyqtSignal("qint64", "qint64")
|
||||
_finished = pyqtSignal(str, str)
|
||||
_installed = pyqtSignal(str, str)
|
||||
|
||||
|
||||
@@ -305,6 +305,16 @@ class LocalModels(DikteTest):
|
||||
window = self.window(cfg.Config())
|
||||
self.assertTrue(window.local_whisper._pending)
|
||||
|
||||
def test_a_model_bigger_than_two_gigabytes_counts_up_rather_than_down(self):
|
||||
# Qt's int is C++'s 32-bit one, and a 2.3 GB model is more than fits in
|
||||
# it: the count came out the far side negative, at "-1%".
|
||||
box = self.window(cfg.Config()).local_llm
|
||||
box._downloading = True
|
||||
box._report(1_048_576, 2_489_757_856)
|
||||
_app.processEvents()
|
||||
self.assertIn("2.3 GB", box.status.text())
|
||||
self.assertNotIn("-", box.status.text())
|
||||
|
||||
def test_the_hosted_boxes_go_away_when_the_work_happens_here(self):
|
||||
window = self.window(self.config(transcribe_provider="openai"))
|
||||
self.assertTrue(window.hosted_stt.isVisibleTo(window))
|
||||
|
||||
Reference in New Issue
Block a user