# How to add a new input layer to BERT / RoBERTa?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-add-a-new-input-layer-to-bert-roberta%2F17183%3E%5C
**Category:** Beginners\
**Created:** [April 26, 2022, 1:37am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-add-a-new-input-layer-to-bert-roberta%2F17183 "2022-04-26T01:37:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SilasCheung](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@SilasCheung](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FSilasCheung)%5C
**Post date:** [April 26, 2022, 1:37am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-add-a-new-input-layer-to-bert-roberta%2F17183%2F1 "2022-04-26T01:37:33Z")

</div>

Hello, I learned that we can modify Class BertEmbeddings [https://github.com/huggingface/transformers/blob/main/src/transformers/models/bert/modeling\_bert.py#L166](https://github.com/huggingface/transformers/blob/main/src/transformers/models/bert/modeling_bert.py#L166) to use an additional 768-dimension input layer except for the original 3 input layers.

I am wondering is there a convenient way to modify the original class like using an API? Or should I just modify the original .py file? Is there some difference when I’m using RoberTa?

Thank you for your help.
