# Roberta Model concat last hidden layers

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Froberta-model-concat-last-hidden-layers%2F36104%3E%5C
**Category:** 🤗Transformers\
**Created:** [April 10, 2023, 9:11am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Froberta-model-concat-last-hidden-layers%2F36104 "2023-04-10T09:11:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shivaays](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@shivaays](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fshivaays)%5C
**Post date:** [April 10, 2023, 9:11am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Froberta-model-concat-last-hidden-layers%2F36104%2F1 "2023-04-10T09:11:52Z")

</div>

Hi All,

I am trying to get last 4 hidden layers from roberta model, concatenate it and then add a linear ==\> softmax layers, to check how the model is performing. Basically I am trying to experiment with the model.

In one of my experiment I was able to get last 4 hidden layers and apply max\_pool/avg\_pool on the layers and was able to train the model.

But when trying to get last 4 layers and trying to concat it, I am getting error. Does anyone have a clue? I am trying this architecture from BERT paper reference.

Have tried some of the code from here, but not working :[Sequence Classification pooled output vs last hidden state · Issue #1328 · huggingface/transformers · GitHub](https://github.com/huggingface/transformers/issues/1328)
