How can I run separately the Encoder and Decoder layers?

For the models that are built from distinct encoding and decoding phases, is there a simple way to use them separately (without changing the actual model code)?

use cases may include:

  • text from data (use the decoder on top of a linear layer)
  • style transfer (encode, “change style”, decode)

Hey @ophiry,

The code example at the end of this section in the Encoder-Decoder blog posts: https://huggingface.co/blog/encoder-decoder#decoder gives an example of how to run each part differently. In general the blog post should be helpful in answering your question. To try tweak the code examples the blog post is also available as a google colab.

1 Like