Reputation: 4209
I'm confused about the technical difference between the two huggingface pipelines TextGeneration and Text2TextGeneration.
In the TextGeneration it is stated that:
Language generation pipeline using any ModelWithLMHead. This pipeline predicts the words that will follow a specified text prompt.
But isn't any language model doing that? "predicting the next words"? So how is this pipeline different than Text2TextGeneration? Isn't Text2TextGeneration going to predict the next probable words?
I also tried some models using "Text2TextGeneration" pipeline, and despite of HuggingFace's warning "The model is not supported for text2text-generation" it actually worked and generated some outputs.
If someone can explain the technical difference it will be appreciated.
Upvotes: 9
Views: 4588
Reputation: 11
I think TextGeneration are models that follow transformer decoder architecture while Text2Text models follow transformer encoder-decoder (also called seq2seq) architecture.
Upvotes: 1
Reputation: 39
As far as i understant, text-generation is the process of generating text that follows after the given input text (or "predicting the next word"), whereas text2text-generation refers to transforming text, like you would do when you translate text into another language or auto-correcting spelling in a text. This isn't necessarily an architectual difference rather than what the model was trained to do.
In the context of common language models one could argue that transformer encoder models like BERT are more on the text2text generation side and transformer encoder-decoder models like GPT are more on the text-generation side, however both can still be used in both contexts. So the warning you get really only tells you that the model is not meant to do that task, but it still may work if you give it the right input like:
"Eng: Hello World! Ger:"
given to a GPT-like text-generation model to translate some text.
Upvotes: 3