Error: can't load model
See original GitHub issuehi, I tried some wav2vec models, but there was always error: the code is `import torch import fairseq
cp_path = ‘/path/to/wav2vec.pt’ model, cfg, task = fairseq.checkpoint_utils.load_model_ensemble_and_task([cp_path]) model = model[0] model.eval()`
and the error : the model: https://dl.fbaipublicfiles.com/fairseq/wav2vec/wav2vec_large.pt Error:KeyError: ‘speech_pretraining’ the model:https://dl.fbaipublicfiles.com/fairseq/wav2vec/vq-wav2vec.pt Error:KeyError: ‘binary_cross_entropy’ the model:https://dl.fbaipublicfiles.com/fairseq/wav2vec/vq-wav2vec_kmeans.pt KeyError: ‘binary_cross_entropy’ the model:https://dl.fbaipublicfiles.com/fairseq/wav2vec/xlsr_53_56k.pt AttributeError: ‘NoneType’ object has no attribute ‘task’
is anywhere more examples for loading the model?
thanks
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
I have solved this problem. (1)You need to find out where is the location of fairseq, in my env is ~/miniconda3/envs/myconda/lib/python3.7/site-packages/fairseq/. (2)After that, you need to change your location, and modify the file checkpoint_utils.py cd ~/miniconda3/envs/myconda/lib/python3.7/site-packages/fairseq/ vi checkpoint_utils.py line 438 if choice is not None: change to if choice is not None and choice in REGISTRY[“registry”]:
(3) After save the checkpoint_utils.py, this is the workable example: cp = ‘path/to/vq-wav2vec.pt’ model, cfg, task = fairseq.checkpoint_utils.load_model_ensemble_and_task([cp]) model = model[0] model.eval()
same issue though fairseq is the latest version.