# Speech Encoder Decoder training

**URL:** <https://discuss.huggingface.co/t/speech-encoder-decoder-training/9788>\
**Category:** 🤗Transformers\
**Created:** [September 8, 2021, 1:54am UTC](https://discuss.huggingface.co/t/speech-encoder-decoder-training/9788 "2021-09-08T01:54:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![adalbertojunior](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/adalbertojunior/32/2667_2.png) [@adalbertojunior](https://discuss.huggingface.co/u/adalbertojunior)\
**Post date:** [September 8, 2021, 1:54am UTC](https://discuss.huggingface.co/t/speech-encoder-decoder-training/9788/1 "2021-09-08T01:54:19Z")

</div>

Hello, I’m trying to train the new speech encoder decoder model using wav2vec2 as encoder and a Bert as decoder.  
I did’t find any tutorial so a tried to adapt a wav2vec2 training script, but I’m having this error when I try to run the training:

> KeyError Traceback (most recent call last)
> 
> in () ----\> 1 trainer.train()
> 
> 3 frames
> 
> [/usr/local/lib/python3.7/dist-packages/transformers/file\_utils.py] in **getitem** (self, k) 1934 if isinstance(k, str): 1935 inner\_dict = {k: v for (k, v) in self.items()} → 1936 return inner\_dict[k] 1937 else: 1938 return self.to\_tuple()[k]
> 
> KeyError: ‘loss’

the code is also available here: [Google Colab](https://colab.research.google.com/drive/1B4gBosZDLINKz-4lgpb4khg3VYLrp-27?usp=sharing)

Any Idea on how to fix this? 😅
