# Call ViTMAE Forward Embedding

**URL:** <https://discuss.huggingface.co/t/call-vitmae-forward-embedding/34959>\
**Category:** Models\
**Created:** [March 29, 2023, 4:48am UTC](https://discuss.huggingface.co/t/call-vitmae-forward-embedding/34959 "2023-03-29T04:48:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kormonster](https://avatars.discourse-cdn.com/v4/letter/k/87869e/32.png) [@kormonster](https://discuss.huggingface.co/u/kormonster)\
**Post date:** [March 29, 2023, 4:48am UTC](https://discuss.huggingface.co/t/call-vitmae-forward-embedding/34959/1 "2023-03-29T04:48:15Z")

</div>

Hi!  
I would like to save the mask produced by the ViTMAEForPreTraining forward pass on one image, and apply that mask on another image. To do so, I believe that need to gain access to the [forward\_encoder](https://github.com/facebookresearch/mae/blob/6a2ba402291005b003a70e99f7c87d1a2c376b0d/models_mae.py#L123) and decoder. However, the pretrained model doesn’t have forward\_encoder as an attribute. Any ideas on how to work around this?

---

<div class="post-metadata">

**Author:** ![kormonster](https://avatars.discourse-cdn.com/v4/letter/k/87869e/32.png) [@kormonster](https://discuss.huggingface.co/u/kormonster)\
**Post date:** [March 30, 2023, 6:28pm UTC](https://discuss.huggingface.co/t/call-vitmae-forward-embedding/34959/2 "2023-03-30T18:28:28Z")

</div>

Solved this. Was looking at the FB MAE code rather than huggingface’s.
