# Use only encoder to generate the image embeddings in a VisionEncoderDecoderModel such as Donut

**URL:** <https://discuss.huggingface.co/t/use-only-encoder-to-generate-the-image-embeddings-in-a-visionencoderdecodermodel-such-as-donut/44727>\
**Category:** Models\
**Created:** [June 27, 2023, 11:27am UTC](https://discuss.huggingface.co/t/use-only-encoder-to-generate-the-image-embeddings-in-a-visionencoderdecodermodel-such-as-donut/44727 "2023-06-27T11:27:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon86149130](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@anon86149130](https://discuss.huggingface.co/u/anon86149130)\
**Post date:** [June 27, 2023, 11:27am UTC](https://discuss.huggingface.co/t/use-only-encoder-to-generate-the-image-embeddings-in-a-visionencoderdecodermodel-such-as-donut/44727/1 "2023-06-27T11:27:12Z")

</div>

I want to use the pre-trained checkpoint of the Donut model on my document images to generate the embeddings for each image that I can use in a subsequent pipeline. I don’t want the decoder output, just need the image embeddings that are fed into the decoder to generate the text completion. Any ideas or code samples on how I can achieve that?

---

<div class="post-metadata">

**Author:** ![anonymous-developer](https://avatars.discourse-cdn.com/v4/letter/a/74df32/32.png) [@anonymous-developer](https://discuss.huggingface.co/u/anonymous-developer)\
**Post date:** [February 6, 2024, 4:10pm UTC](https://discuss.huggingface.co/t/use-only-encoder-to-generate-the-image-embeddings-in-a-visionencoderdecodermodel-such-as-donut/44727/2 "2024-02-06T16:10:18Z")

</div>

I am also searching for this answer, let me know if you get the solution for this.
