You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
code is
w = Whisper.from_pretrained('/Users/haowmazs/testdata/whisper.cpp-master/models/ggml-medium.bin')
throw exception
RuntimeError: '/Users/haowmazs/testdata/whisper.cpp-master/models/ggml-medium.bin' is not a valid preconverted model. Choose one of ['tiny.en', 'tiny', 'base.en', 'base', 'small.en', 'small', 'medium.en', 'medium', 'large-v1', 'large']
Seeing the same. At a glance looks like the problem is this piece of code here:
ifmodel_namenotinutils.MODELS_URLandnot_os.path.isfile(model_name):
raiseRuntimeError(
f"'{model_name}' is not a valid preconverted model or a file path. \ Choose one of {list(utils.MODELS_URL)}"
)
The second part of this conditional appears to be failing. It's odd because I tried using the same absolute path with os.path.isfile in a local python shell and it works - even if you import os as _os.
Not a huge issue anyway as you can just download the model with the predefined ones in MODELS_URL but hopefully this adds some context.
OS details in case related:
OS: OSX Ventura 13.0.1
Python version: 3.10.0
EDIT: Cache Workaround
In the meantime, you can just populate the cache yourself with your own model.
This library looks in one of two directories for the models based on the existence of the XDG_DATA_HOME env variable. You can put your local model into this directory and it should work as expected.
# move your model into the cache
cp whisper.cpp/models/ggml-base.bin ~/.local/share/whispercpp # OR $XDG_DATA_HOME/whispercpp
fromwhispercppimportWhisper# use the local dir with your pretrained whisper modelwhisper=Whisper.from_pretrained("base")
if model_name not in utils.MODELS_URL:
raise RuntimeError(
f"'{model_name}' is not a valid preconverted model. Choose one of {list(utils.MODELS_URL)}"
)
Activity
lostz commentedon Jun 30, 2023
same sa i
shogunpurple commentedon Jul 5, 2023
Seeing the same. At a glance looks like the problem is this piece of code here:
The second part of this conditional appears to be failing. It's odd because I tried using the same absolute path with
os.path.isfilein a local python shell and it works - even if youimport os as _os.Not a huge issue anyway as you can just download the model with the predefined ones in
MODELS_URLbut hopefully this adds some context.OS details in case related:
OS: OSX Ventura 13.0.1
Python version: 3.10.0
EDIT: Cache Workaround
In the meantime, you can just populate the cache yourself with your own model.
This library looks in one of two directories for the models based on the existence of the
XDG_DATA_HOMEenv variable. You can put your local model into this directory and it should work as expected.marcoacierno commentedon Aug 17, 2023
if anyone still has this issue, it should be because the version on pypi is older than what's on the repo (I noticed the error message is different!)
https://pypi.org/project/whispercpp/#files -> the source code only has
I fixed the error by installing from git