This repository was archived by the owner on Sep 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 814
Demo T5 model on sentiment classification and translation #1872
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 tasks
parmeet
approved these changes
Aug 4, 2022
Contributor
parmeet
left a comment
There was a problem hiding this 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 :).
Nayef211
approved these changes
Aug 4, 2022
Contributor
Nayef211
left a comment
There was a problem hiding this 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
negandposwere changed tonegativeandpositiveto align with the labels that would be generated by the model. The input texts were also appended with the prefixsst2 sentenceto 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 Germanto 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=1since 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.pytot5_demo.py.Testing
Run
BUILD_GALLERY=1 make 'SPHINXOPTS=-W' htmlindocsand review rendered document indocs/build/html/tutorials/t5_demo.html