# IndexError: tuple index out of range problem

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Findexerror-tuple-index-out-of-range-problem%2F14225%3E%5C
**Category:** 🤗Transformers\
**Created:** [January 30, 2022, 3:51am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Findexerror-tuple-index-out-of-range-problem%2F14225 "2022-01-30T03:51:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![toyl](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@toyl](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Ftoyl)%5C
**Post date:** [January 30, 2022, 3:51am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Findexerror-tuple-index-out-of-range-problem%2F14225%2F1 "2022-01-30T03:51:00Z")

</div>

```auto
tokens_tensor = torch.tensor([indexed_tokens])
encode_layers,_ = BERTModel(tokens_tensor)
embedding =encode_layers[11].squeeze(0)

```

what is the equivalent manner for those lines if I need to import BERT from transformer instead Pytorch? as i got

```auto
/transformers/file_utils.py", line 2329, in __getitem__
    return self.to_tuple()[k]
IndexError: tuple index out of range

```

---

<div class="post-metadata">

**Author:** ![toyl](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@toyl](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Ftoyl)%5C
**Post date:** [January 30, 2022, 1:47pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Findexerror-tuple-index-out-of-range-problem%2F14225%2F2 "2022-01-30T13:47:19Z")

</div>

is there any help please ?
