# How can you delete BERT Layers after Finetuning

**URL:** <https://discuss.huggingface.co/t/how-can-you-delete-bert-layers-after-finetuning/5885>\
**Category:** Intermediate\
**Created:** [April 30, 2021, 12:20pm UTC](https://discuss.huggingface.co/t/how-can-you-delete-bert-layers-after-finetuning/5885 "2021-04-30T12:20:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![theudster](https://avatars.discourse-cdn.com/v4/letter/t/97f17d/32.png) [@theudster](https://discuss.huggingface.co/u/theudster)\
**Post date:** [April 30, 2021, 12:20pm UTC](https://discuss.huggingface.co/t/how-can-you-delete-bert-layers-after-finetuning/5885/1 "2021-04-30T12:20:17Z")

</div>

Hello,

I was wondering if it is possible to finetune a BERT model on SQuAD, then delete the last x layers and then perform a SQuAD evaluation on the remaining layers? How would one go about doing this?  
Would this help?

```
transformers.modeling_utils.prune_layer

```

I am not exactly clear on what it does from reading the documentation but from my understanding, it only removes linear layers, not full BERT layers.

Any help would be greatly appreciated,  
Thank you
