apostofes
apostofes

Reputation: 3693

Is this how nn.Transformer works?

If I want to transform an image to another image, then

transformer_model = nn.Transformer(img_size, n_heads)
transformer_model(source_image, target_image)

is this the correct way to use nn.Transformer?

Upvotes: 2

Views: 231

Answers (1)

David Marx
David Marx

Reputation: 8558

No, this is not what the Transformer module does. The Transformer is primarily used for pre-training general use models for NLP on large bodies of text. If you're curious to learn more, I strongly recommend you read the article which introduced the architecture, "Attention is All You Need". If you've heard of models like BERT or GPT-2, these are examples of transformers.

It's not entirely clear what you are trying to accomplish when you ask how to "transform an image into another image." I'm thinking maybe you are looking for something this? https://junyanz.github.io/CycleGAN/

In any event, to re-answer your question: no, that's not how you use nn.Transformer. You should try to clarify what you are trying to accomplish with "transforming one picture into another," and post that description as a separate question.

Upvotes: 3

Related Questions