Closed davidkoski closed 6 months ago
Ah, we didn't see an issue in WhisperKit because we download multiple files at a time so one of the fractions looks ok (portion: 0)
but I can confirm that we also see the 0 of 100 for (portion: 1)
, for individual file progress:
<NSProgress: 0x600001daf380> : Parent: 0x0 (portion: 0) / Fraction completed: 0.9545 / Completed: 21 of 22
<NSProgress: 0x600001d74680> : Parent: 0x600001daf380 (portion: 1) / Fraction completed: 0.0000 / Completed: 0 of 100
I'm not sure why -1 is coming back from this, especially since totalBytesExpectedToWrite
is accurate, but a workaround could be special handling to use let progressFraction = totalBytesWritten / totalBytesExpectedToWrite
when it is -1.
I also checked the headers and they have valid Content-Length as far as I can tell
"Content-Length" = (
13476985472
);
Yeah, agreed it is an odd one since the totalBytesExpected
is set correctly -- I am not sure where else it would get the total amount :-)
Workaround applied in #83 by @maiqingqiang
See also #59 and #61
The progress callback on HubApi() no longer works – it is called over and over (unlike #59) but the progress is always 0. In particular the Downloader’s delegate method to observe progress uses the downloadTask.progress:
https://github.com/huggingface/swift-transformers/blob/main/Sources/Hub/Downloader.swift#L108
but the progress is always returning 0 (seemingly because it is indeterminate?):
However the
totalBytesWritten
andtotalBytesExpected
do contain the proper data to provide progress. It appears that this behavior changed when moving off the background download session, e.g. with #64.