# Train phoneme recognizer using Wav2Vec2 intermediate features

**URL:** <https://discuss.huggingface.co/t/train-phoneme-recognizer-using-wav2vec2-intermediate-features/25326>\
**Category:** Beginners\
**Created:** [November 1, 2022, 11:47am UTC](https://discuss.huggingface.co/t/train-phoneme-recognizer-using-wav2vec2-intermediate-features/25326 "2022-11-01T11:47:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcsilva](https://avatars.discourse-cdn.com/v4/letter/j/f05b48/32.png) [@jcsilva](https://discuss.huggingface.co/u/jcsilva)\
**Post date:** [November 1, 2022, 11:47am UTC](https://discuss.huggingface.co/t/train-phoneme-recognizer-using-wav2vec2-intermediate-features/25326/1 "2022-11-01T11:47:03Z")

</div>

Figure 2 of [Unsupervised Speech Recognition](https://scontent.fipn10-1.fna.fbcdn.net/v/t39.2365-6/246775151_898207977770500_6801514079308210826_n.pdf?_nc_cat=107&ccb=1-7&_nc_sid=3c67a6&_nc_ohc=PBQj2ihI6MgAX97Qtli&_nc_ht=scontent.fipn10-1.fna&oh=00_AfCLtu0EzNQz_hCzncRlnH3zTBgQStUCtidZM9Qw2CsLAQ&oe=6366B52F) suggests that using intermediate blocks from wav2vec 2.0 provides better features for training a phoneme recognizer. I would like to try this hypothesis using HuggingFace API, but I don’t know how to do it.

I tried to do something similar to what is show at in the [ASR fine-tuning tutorial](https://huggingface.co/blog/fine-tune-xlsr-wav2vec2), but I couldn’t how to inform the training algorithm which intermediate hidden state it should use. I though that maybe the Trainer class (from transformers module) could be parameterized to use a specific layer output during the fine-tuning, but it does seem possible.

Could anyone please give me some hints about how could I fine-tune a wav2vec 2.0 model using intermediate layer output?

Thank you
