# Iterating through BERT layers

**URL:** <https://discuss.huggingface.co/t/iterating-through-bert-layers/12182>\
**Category:** Beginners\
**Created:** [November 23, 2021, 4:30am UTC](https://discuss.huggingface.co/t/iterating-through-bert-layers/12182 "2021-11-23T04:30:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TG1](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@TG1](https://discuss.huggingface.co/u/TG1)\
**Post date:** [November 23, 2021, 4:30am UTC](https://discuss.huggingface.co/t/iterating-through-bert-layers/12182/1 "2021-11-23T04:30:00Z")

</div>

I am having trouble understanding how to iterate through the BERT layers in order to freeze/unfreeze them. It is my understanding that BERT models have 12 layers but when I do model.parameters() or model.bert.parameters(), I get\>100 iterations. This seems wrong but I don’t know what I should be doing. I am doing this on a BERTForMaskedLM.from\_pretrained model.

Thanks for any assistance
