[Issue] Getting error while loading the wav2vec model checkpoint.
State: closed | Pull request: no

I have tried to train wav2vec model using language other than English.  I refered to example scripts provided in `/examples/asr/experimental/wav2vec/wav2vec_pretrain.py`  [link](https://github.com/NVIDIA/NeMo/blob/main/examples/asr/experimental/wav2vec/wav2vec_pretrain.py) 

Models are saved in a experiment directory **nemo_experiments/Wav2vec_Pretrain/checkpoints/2021-02-17_09-21-19/checkpoints/Wav2vec_Pretrain---val_loss=34.53-epoch=64.ckpt**  

I have used config file defined in `examples/asr/experimental/wav2vec/configs/wav2vec_pretrain.yaml`  with changes in train_ds, val_ds, test_ds manifest_path.

I am using basic pytorch model load model script


`from omegaconf import OmegaConf
config_path = '/content/configs/wav2vec_pretrain.yaml'
params = OmegaConf.load(config_path)`

```
`wav2vec_encoder_model = Wav2VecEncoderModel(params)

wav2vec_encoder_model.load_state_dict(torch.load(PATH), strict=False)
```
where params is the DictConfig type


I am getting following error 

`ConfigKeyError: Key 'name' not in 'Wav2VecEncoderModelConfig'
	full_key: name
	reference_type=Optional[Wav2VecEncoderModelConfig]
	object_type=Wav2VecEncoderModelConfig`

Please review the error and suggest me other ways to load the model chekcpoints to generate wav2vec for audio files.


I am unable to generate vectors of audio files using trained wav2vec model checkpoints. What is the specific method to call to extract features of any input audio files. @titu1994 @okuchaiev 

@SeanNaren and @VahidooX 

I have created a class named ExtractWav2VecEmbeddingsModel using BaseClass Wav2VecEncoderModel.

`from pytorch_lightning import Trainer

from typing import Dict, Optional, Union

class ExtractWav2VecEmbeddingsModel(Wav2VecEncoderModel):
    
    """
    This Model class facilitates extraction of vector from a pretrained model.
    Respective embedding file is saved in self.vector dir passed through cfg
    """
    
    def __init__(self, cfg: DictConfig, trainer: Trainer = None):
        super().__init__(cfg=cfg, trainer=trainer)

    def setup_test_data(self, test_data_config: Optional[Union[DictConfig, Dict]]):
        if 'shuffle' not in test_data_config:
            test_data_config['shuffle'] = False
        # preserve config
        self._update_dataset_config(dataset_name='test', config=test_data_config)

        self._test_dl = self._setup_dataloader_from_config(config=test_data_config)
        self.test_manifest = test_data_config.get('manifest_filepath', None)

    def test_step(self, batch, batch_idx, dataloader_idx=0):
        loss, feature_loss, prob_ppl_loss, target = self._step(batch)
        self.log('test_loss', loss, prog_bar=True, on_epoch=True, sync_dist=True)
        return {'vec': target, 'idx': batch_idx}

    def _step(self, batch):
        audio_signal, audio_lengths, _, _ = batch

        padding_mask = self._create_padding_mask(audio_lengths)

        self._update_quantizer_temp()
        logits, targets, sampled_negatives, _, features_penalty, prob_ppl_loss, _ = self(
            source=audio_signal, padding_mask=padding_mask
        )
        loss, feature_loss, prob_ppl_loss = self.loss(
            logits=logits,
            targets=targets,
            negatives=sampled_negatives,
            prob_ppl_loss=prob_ppl_loss,
            feature_loss=features_penalty,
        )
        return loss, feature_loss, prob_ppl_loss, targets

    def test_epoch_end(self, outputs):
        print ( type(outputs), len(outputs), self.test_manifest)
        for emb in outputs:
          print (emb['vec'].shape, emb['idx'])
          
After that i called pytorch lightning Trainer.
 
`trainer = pl.Trainer(**params.trainer)

extract_vec_model = ExtractWav2VecEmbeddingsModel(cfg=params.model, trainer=trainer)

ckpt_PATH = "/content/drive/MyDrive/nemo_experiments/Wav2vec_Pretrain/2021-02-17_09-21-19/checkpoints/Wav2vec_Pretrain---val_loss=34.72-epoch=97.ckpt"

extract_vec_model.load_state_dict(torch.load(ckpt_PATH), strict=False)`

`test_config = OmegaConf.create(dict(
    manifest_filepath = '/content/hi_commonvoice_test_manifest.json',
    sample_rate = 16000,
    labels = None,
    batch_size = 1,
    shuffle = False,
    embedding_dir = './'
))
extract_vec_model.setup_test_data(test_config)`

  At the calling trainer test to evaluate the model
`trainer.test(extract_vec_model)`

Now i am getting the tensor of dimension described below for 4 test files

torch.Size([1, 103, 768]) 0
torch.Size([1, 78, 768]) 1
torch.Size([1, 88, 768]) 2
torch.Size([1, 73, 768]) 3

I guess 768 is the output dimension and 2nd pos of tensor shape is timestamp factor of audio file. But for same duration audio file i am getting different value.

Is my approach  correct ?   

i calling trainer model to inferrence ,the modes' weights is diffrent ,why ?here is my aligner code,training in gpu,inferring in cpu
```
@hydra_runner(config_path='conf', config_name='aligner')
def infer(cfg):
    from nemo.collections.asr.modules.audio_preprocessing import AudioToMelSpectrogramPreprocessor
    from nemo.collections.tts.models import AlignerModel
    from nemo.collections.asr.data.audio_to_text import AudioToCharWithPriorDataset,AudioToCharWithDursF0Dataset
    import torch
    from nemo.collections.asr.data.vocabs import Phonemes
    pho = Phonemes()
    AudioToCharWithPriorDataset_EXP = AudioToCharWithPriorDataset(
        attn_prior_folder="/storage2t/storage2/NeMo/examples/tts/ali1",
        manifest_filepath="/storage2t/storage2/NeMo/scripts/dataset_processing/ljspeech/ljspeech_same.json",
        vocab={"notation":"phonemes", "punct":True, "spaces":True, "stresses":False, "add_blank_at":None, "pad_with_space":True},
        sample_rate=22050
    )
   
    device = torch.device('cpu')
    model.load_from_checkpoint("/storage2t/storage2/NeMo/nemo_experiments/Aligner/2021-06-04_11-17-45/checkpoints/Aligner--val_forward_sum_loss=1.18-epoch=2349.ckpt",strict=True,map_location=device)
    model.freeze()
    for parameters in model.parameters():
        print(parameters)

    for name, parameters in model.named_parameters():
        print(name, parameters)
    print("==================================================")
    model.eval()
    with torch.no_grad():
        for item in range(AudioToCharWithPriorDataset_EXP.__len__()):
            audio, audio_len, text, text_len, attn_prior,tag = AudioToCharWithPriorDataset_EXP[item]
            a2p = AudioToMelSpectrogramPreprocessor(features=80,sample_rate=22050,pad_to=1,normalize=None,n_window_stride=256,n_fft=1024,n_window_size=1024,window_size=None,window_stride=None)
            audio = audio.unsqueeze(0)
            audio_len = audio_len.unsqueeze(0)
            text = text.unsqueeze(0)
            text_len = text_len.unsqueeze(0)
            spec, spec_len = a2p.get_features(audio, audio_len)
            # print(audio)
            for name, parameters in model.named_parameters():
                print(name, parameters)
           

Closing. @sam1373  re-open if issue is still relevant.