diff --git a/docs/source/model_doc/t5.rst b/docs/source/model_doc/t5.rst index 7defbdbb74..3c1cd0a064 100644 --- a/docs/source/model_doc/t5.rst +++ b/docs/source/model_doc/t5.rst @@ -74,6 +74,10 @@ token. T5 can be trained / fine-tuned both in a supervised and unsupervised fash .. code-block:: + from transformers import T5ForConditionalGeneration, T5Tokenizer + model = T5ForConditionalGeneration.from_pretrained("t5-small") + tokenizer = T5Tokenizer.from_pretrained("t5-small") + input_ids = tokenizer('The walks in park', return_tensors='pt').input_ids labels = tokenizer(' cute dog the ', return_tensors='pt').input_ids # the forward function automatically creates the correct decoder_input_ids @@ -87,6 +91,10 @@ token. T5 can be trained / fine-tuned both in a supervised and unsupervised fash .. code-block:: + from transformers import T5ForConditionalGeneration, T5Tokenizer + model = T5ForConditionalGeneration.from_pretrained("t5-small") + tokenizer = T5Tokenizer.from_pretrained("t5-small") + input_ids = tokenizer('translate English to German: The house is wonderful.', return_tensors='pt').input_ids labels = tokenizer('Das Haus ist wunderbar.', return_tensors='pt').input_ids # the forward function automatically creates the correct decoder_input_ids