-
Notifications
You must be signed in to change notification settings - Fork 43
Progress bar not displaying when using 'print_progress=True' #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
fix(print_progress): print progress callback #97
Thanks @SirDaXll, for reporting the issue, I noticed that res = model.transcribe(media="audio.mp3", print_progress=True, progress_callback=lambda progress: print(progress)) Please pull the latest commit and try again. Let me know if you have any further issues. |
@absadiki What seems most relevant to me about the output is the time elapsed/time remaining in progress (how output should be: |
@SirDaXll, if you are just looking for a progress bar like effect, you can achieve that easily by using tqdm and the progress_callback I mentioned earlier: with tqdm(total=100) as pbar:
res = model.transcribe(media="audio.mp3",
print_progress=True,
progress_callback=lambda progress: (setattr(pbar, 'n', progress), pbar.refresh()),
) however, |
@absadiki It is a good solution in the absence of the progress bar, it only works as a reference, since in the absence of having a function that obtains the total frames of the audio and indicates it to tqdm (as Whisper does), the progress will not be precise. I tried the frames thing with pydub, I still didn't get good results, so for the moment I'll stick with what there is. |
@absadiki After the update I did not try to execute from the command line, only from a .py file, and now I have an error when receiving the parameters. I tried in 2 computers, with and without venv, just to check.
|
@SirDaXll, it seems that the Python getattr function is having issues with converting the new progress_callback function I added in the previous commit, I think we can ignore it. |
@absadiki With that last commit I found the problem that now some parameters entered by the command prompt did not work (in the .py file there are no problems), so I went into the model.py code to find the problem, locating different log captures in the terminal and see what happens, well I found that it captured the parameters but reset them to certain default values in "_init_model", so I commented a line and the problem was solved. In the pull request I better describe what happened. def _init_model(self) -> None:
"""
Private method to initialize the method from the bindings, it will be called automatically from the __init__
:return:
"""
logger.info("Initializing the model ...")
with utils.redirect_stderr(to=self.redirect_whispercpp_logs_to):
self._ctx = pw.whisper_init_from_file(self.model_path)
# Don't set the params to the default ones here, as it will overwrite the user's params
# self._params = pw.whisper_full_default_params(pw.whisper_sampling_strategy.WHISPER_SAMPLING_GREEDY) |
Uh oh!
There was an error while loading. Please reload this page.
I noticed that
Whisper
usestqdm
to show a progress bar whenverbose=False
. In thewhisper.cpp
project, there's a function namedprint_progress
for this purpose, which is also present inpywhispercpp
insideconstants.py
underPARAMS_SCHEMA
(also referenced in the API documentation).However, when I try to use this functionality, I don't see any progress bar—only the final transcription result is returned.
I tried using in the command line:
And in Python:
print_realtime
works fine and are in the same location as the otherI installed the package from the source, use
Windows 11
andPython 1.12.6
.This functionality is currently supported in
pywhispercpp
or if additional configuration is required?The text was updated successfully, but these errors were encountered: