facebookresearch / av_hubert

A self-supervised learning framework for audio-visual speech
Other
805 stars 128 forks source link

No dictionary error when inference provided finetuned model #42

Open Kuzhuahu opened 2 years ago

Kuzhuahu commented 2 years ago

hi ,i want to inference the provided finetuned model,but only to get the follow error:-) Traceback (most recent call last): File "infer_model.py", line 49, in hypo = predict(mouth_roi_path, ckpt_path,user_dir) File "infer_model.py", line 23, in predict models, saved_cfg, task = checkpoint_utils.load_model_ensemble_and_task([ckpt_path]) File "/home/fairseq/fairseq/checkpoint_utils.py", line 469, in load_model_ensemble_and_task model = task.build_model(cfg.model, from_checkpoint=True) File "/home/fairseq/fairseq/tasks/fairseq_task.py", line 335, in build_model model = models.build_model(cfg, self, from_checkpoint) File "/home/fairseq/fairseq/models/init.py", line 106, in build_model return model.build_model(cfg, task) File "/home/av_hubert/avhubert/hubert_asr.py", line 469, in buildmodel encoder = task_pretrain.build_model(w2v_args.model) File "/home/fairseq/fairseq/tasks/fairseq_task.py", line 335, in build_model model = models.build_model(cfg, self, from_checkpoint) File "/home/fairseq/fairseq/models/init.py", line 106, in build_model return model.build_model(cfg, task) File "/home/av_hubert/avhubert/hubert.py", line 439, in build_model model = AVHubertModel(cfg, task.cfg, task.dictionaries, **kwargs) File "/home/av_hubert/avhubert/hubert_pretraining.py", line 196, in dictionaries return self.state.dictionaries File "/home/fairseq/fairseq/tasks/fairseq_task.py", line 41, in getattr self._state[name] = self._factories[name]() File "/home/av_hubert/avhubert/hubert_pretraining.py", line 200, in load_dictionaries dictionaries = [ File "/home/av_hubert/avhubert/hubert_pretraining.py", line 201, in Dictionary.load(f"{label_dir}/dict.{label}.txt") File "/home/fairseq/fairseq/data/dictionary.py", line 226, in load d.add_from_file(f) File "/home/fairseq/fairseq/data/dictionary.py", line 239, in add_from_file raise fnfe File "/home/fairseq/fairseq/data/dictionary.py", line 236, in add_from_file with open(PathManager.get_local_path(f), "r", encoding="utf-8") as fd: FileNotFoundError: [Errno 2] No such file or directory: '/checkpoint/bshi/data/lrs3//video/hubert/stitch-iters/envox-iter4-l12c2000//dict.km.txt'

so, how can i get the dictionary or how can i inference the finetuned model your released ?

chevalierNoir commented 2 years ago

Hi,

The dictionary is saved in the checkpoint and will be loaded automatically in checkpoint loading. A running example can be found in the demo. Did you install the same fairseq as is provided in the repo? Using a different version of fairseq can cause such error.

Kuzhuahu commented 2 years ago

Hi,

The dictionary is saved in the checkpoint and will be loaded automatically in checkpoint loading. A running example can be found in the demo. Did you install the same fairseq as is provided in the repo? Using a different version of fairseq can cause such error.

Thx! it works :-)

w2yoon commented 1 month ago

Hi, The dictionary is saved in the checkpoint and will be loaded automatically in checkpoint loading. A running example can be found in the demo. Did you install the same fairseq as is provided in the repo? Using a different version of fairseq can cause such error.

Thx! it works :-)

Can I know how you get that works?