facebookresearch / fairseq

Facebook AI Research Sequence-to-Sequence Toolkit written in Python.
MIT License
30.43k stars 6.4k forks source link

How to use the Pretrained data2vec 2.0? #5021

Open lcxsnow opened 1 year ago

lcxsnow commented 1 year ago

After download the data2vec Base and Large, how to use them?

When I used the below code:

cp_path = '/home/m11113013/ProjectCode/Others/base_libri.pt' models, cfg, task = fairseq.checkpoint_utils.load_model_ensemble_and_task([cp_path], strict=False)

It showed the below errors:

發生例外狀況: ConfigKeyError Key 'rebuild_batches' not in 'AudioPretrainingConfig' full_key: rebuild_batches reference_type=Optional[AudioPretrainingConfig] object_type=AudioPretrainingConfig File "/home/m11113013/ProjectCode/Others/input_speech_categories.py", line 71, in models, cfg, task = fairseq.checkpoint_utils.load_model_ensemble_and_task([cp_path], strict=False) omegaconf.errors.ConfigKeyError: Key 'rebuild_batches' not in 'AudioPretrainingConfig' full_key: rebuild_batches reference_type=Optional[AudioPretrainingConfig] object_type=AudioPretrainingConfig

xmz1009 commented 5 months ago

I had the same error as you. Did you fix it?