Get BERT sentence encoding
I am trying to access to encoding of sentences in the vaious layers in pre-trained BERT model.
So it should be something like this:

```
sentence = 'We bought a new car'
bert_encoder = load_encoder('bert-base-uncased')
enc = bert_encoder.encode(sentence)
enc.get_layer[0] #this is the first layer
enc.get_layer[-1] #this is the last layer

```
What is the best way to do it?
Thanks!
I believe you can't do like that, you have to run the model just as is with all the necessary inputs(pertaining to the sentence) as mentioned in the docs : https://huggingface.co/transformers/model_doc/bert.html#transformers.BertModel
and then add the configuration : `config.output_hidden_states=True` for getting the embeddings  from each intermediate encoding layers. <|||||>@Sriharsha-hatwar Thanks, do you have a code sample maybe?<|||||>This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
