Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Conversation

@pmabbo13
Copy link
Contributor

@pmabbo13 pmabbo13 commented Aug 3, 2022

Description

Update T5 tutorial to include demonstrations of how to use model for sentiment classification on IMDB dataset and English to German translation on Multi30k dataset.

Process

The IMDB dataset was loaded and processed so that the labels neg and pos were changed to negative and positive to align with the labels that would be generated by the model. The input texts were also appended with the prefix sst2 sentence to indicate that the task is sentiment classification (this is the prefix which T5 was trained on for this task).

The Multi30k datasets was loaded and processed so that the english text was pre-pended with the prefix translate English to German to indicate the task to the model.

The same logic used to generate the summarization sequences from CNNDM text was also used to generate the outputs for the IMDB and Multi30k texts. Note that for sentiment translation we use a beam_size=1 since we are looking for the most probable sequence label, which should always be one word.

Also, given that the tutorial will now demo the T5 model on 3 tasks, I've changed the title to "T5-Base Model for Summarization, Sentiment Classification, and Translation", and the file name from cnndm_summarization.py to t5_demo.py.

Testing

Run BUILD_GALLERY=1 make 'SPHINXOPTS=-W' html in docs and review rendered document in docs/build/html/tutorials/t5_demo.html

Copy link
Contributor

@parmeet parmeet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pmabbo13! Overall looks great :).

Copy link
Contributor

@Nayef211 Nayef211 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as well. Can we just check why the sentiment output looks different from the summarization and translation output in the generated doc

@pmabbo13 pmabbo13 merged commit e1b6984 into pytorch:main Aug 8, 2022
@pmabbo13 pmabbo13 deleted the feature/t5-demo-extended branch August 8, 2022 16:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants