# Getting the CLS token from ViTMAEForPreTraining

**URL:** <https://discuss.huggingface.co/t/getting-the-cls-token-from-vitmaeforpretraining/21682>\
**Category:** Models\
**Created:** [August 16, 2022, 1:54pm UTC](https://discuss.huggingface.co/t/getting-the-cls-token-from-vitmaeforpretraining/21682 "2022-08-16T13:54:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alzaia](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@alzaia](https://discuss.huggingface.co/u/alzaia)\
**Post date:** [August 16, 2022, 1:54pm UTC](https://discuss.huggingface.co/t/getting-the-cls-token-from-vitmaeforpretraining/21682/1 "2022-08-16T13:54:44Z")

</div>

Hello, I’m using the ViT MAE implementation from HuggingFace for a self-supervised task and I wanted to use the CLS token for downstream tasks such as classifications. I see the cls token appearing all around in the implementation, but it is then discarded at the end when producing the hidden states of the output. Is there some way (like an input argument) that I could use to keep the cls token in the hidden states of the model? There is an argument [here](https://github.com/huggingface/transformers/blob/f0d496828d3da3bf1e3c8fbed394d7847e839fa6/src/transformers/models/vit_mae/modeling_vit_mae.py#L138) and the cls token is discarded [here](https://github.com/huggingface/transformers/blob/f0d496828d3da3bf1e3c8fbed394d7847e839fa6/src/transformers/models/vit_mae/modeling_vit_mae.py#L827).
