# How to see BERT,BART... output dimensions?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-see-bert-bart-output-dimensions%2F6517%3E%5C
**Category:** Beginners\
**Created:** [June 2, 2021, 6:40am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-see-bert-bart-output-dimensions%2F6517 "2021-06-02T06:40:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![knightiran](https://avatars.discourse-cdn.com/v4/letter/k/54ee81/32.png) [@knightiran](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fknightiran)%5C
**Post date:** [June 2, 2021, 6:40am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-see-bert-bart-output-dimensions%2F6517%2F1 "2021-06-02T06:40:44Z")

</div>

how can i see the output dimensions for BERT Large,BART Large,RoBERTa Large, BART Large CNN, XLM RoBERTa Large?

---

<div class="post-metadata">

**Author:** ![knightiran](https://avatars.discourse-cdn.com/v4/letter/k/54ee81/32.png) [@knightiran](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fknightiran)%5C
**Post date:** [June 3, 2021, 6:12am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-see-bert-bart-output-dimensions%2F6517%2F2 "2021-06-03T06:12:40Z")

</div>

really no one knows?!

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnielsr)%5C
**Post date:** [June 4, 2021, 9:13am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-see-bert-bart-output-dimensions%2F6517%2F3 "2021-06-04T09:13:58Z")

</div>

The output dimensions can be derived from the documentation of the respective models.

For example, BERT-large outputs `hidden_states` of shape `(batch_size, sequence_len, hidden_size)` as can be seen in the [documentation](https://huggingface.co/transformers/model_doc/bert.html#bertmodel) of `BertModel` (see `last_hidden_state` under “Returns” of the forward method). You can check what the `hidden_size` is of BERT-large by checking it’s configuration, like so:

```auto
from transformers import BertConfig

config = BertConfig.from_pretrained("bert-large-uncased")
print(config.hidden_size)

```

This prints 1024. Note that you can also directly read the various attributes (among which the `hidden_size`) on the [hub](https://huggingface.co/bert-large-uncased/blob/main/config.json).

So if you send a batch of sentences through BERT (for example a batch size of 4), and the sentences are padded up to a sequence length of 512 tokens, then the output of BERT-large will be of shape (4, 512, 1024).

RoBERTa (and XLM-RoBERTa), which are based on BERT, follow the same dimensions, so the hidden\_size will also be 1024.

BART on the other hand is an encoder-decoder model (whereas BERT, RoBERTa and XLM-RoBERTa are encoder-only models). It also returns hidden\_states of shape `(batch_size, sequence_len, hidden_size)`. Looking at the [config on the hub of BART-large](https://huggingface.co/facebook/bart-large/blob/main/config.json), it looks like the hidden\_size is also 1024 (the `hidden_size` of BART-large is called `d_model`, but these mean the same thing).
