Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing Schema: End-to-end Task-oriented Dialogue System (WoZ) #237

Merged
merged 14 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 22 additions & 23 deletions seacrowd/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,25 @@
from enum import Enum
from types import SimpleNamespace

from seacrowd.utils.schemas import (image_text_features, kb_features,
pairs_features, pairs_features_score,
pairs_multi_features, qa_features,
seq_label_features, speech2speech_features,
speech_features, speech_multi_features,
speech_text_features, ssp_features,
text2text_features, text_features,
text_multi_features, video_features)
from seacrowd.utils.schemas import (
image_text_features,
kb_features,
pairs_features,
pairs_features_score,
pairs_multi_features,
qa_features,
seq_label_features,
speech2speech_features,
speech_features,
speech_multi_features,
speech_text_features,
ssp_features,
text2text_features,
text_features,
text_multi_features,
video_features,
tod_features,
)

METADATA: dict = {
"_LOCAL": bool,
Expand Down Expand Up @@ -74,6 +85,7 @@ class Tasks(Enum):

# Multi Text Generation
DIALOGUE_SYSTEM = "DS"
E2E_TASK_ORIENTED_DIALOGUE = "TOD"

# Self Supervised & Unsupervised Text
PROMPTING = "PRT"
Expand Down Expand Up @@ -194,34 +206,28 @@ class Licenses(Enum):
Tasks.WORD_ANALOGY: "T2T",
Tasks.KEYWORD_EXTRACTION: "SEQ_LABEL",
Tasks.COREFERENCE_RESOLUTION: "KB",

Tasks.DIALOGUE_SYSTEM: "T2T",

Tasks.E2E_TASK_ORIENTED_DIALOGUE: "TOD",
Tasks.NAMED_ENTITY_RECOGNITION: "SEQ_LABEL",
Tasks.POS_TAGGING: "SEQ_LABEL",
Tasks.KEYWORD_TAGGING: "SEQ_LABEL",
Tasks.SENTENCE_ORDERING: "SEQ_LABEL",
Tasks.TOKEN_LEVEL_LANGUAGE_IDENTIFICATION: "SEQ_LABEL",

Tasks.COMMONSENSE_REASONING: "QA",
Tasks.QUESTION_ANSWERING: "QA",

Tasks.NEXT_SENTENCE_PREDICTION: "PAIRS",
Tasks.TEXT_RETRIEVAL: "PAIRS",
Tasks.TEXTUAL_ENTAILMENT: "PAIRS",
Tasks.SEMANTIC_SIMILARITY: "PAIRS_SCORE",
Tasks.SHORT_ANSWER_GRADING: "PAIRS_SCORE",
Tasks.MORPHOLOGICAL_INFLECTION: "PAIRS_MULTI",

Tasks.INSTRUCTION_TUNING: "T2T",
Tasks.PARAPHRASING: "T2T",
Tasks.MACHINE_TRANSLATION: "T2T",
Tasks.SUMMARIZATION: "T2T",
Tasks.MULTILEXNORM: "T2T",
Tasks.TRANSLITERATION: "T2T",

Tasks.ASPECT_BASED_SENTIMENT_ANALYSIS: "TEXT_MULTI",

Tasks.SENTIMENT_ANALYSIS: "TEXT",
Tasks.TAX_COURT_VERDICT: "TEXT",
Tasks.EMOTION_CLASSIFICATION: "TEXT",
Expand All @@ -230,32 +236,24 @@ class Licenses(Enum):
Tasks.INTENT_CLASSIFICATION: "TEXT",
Tasks.RHETORIC_MODE_CLASSIFICATION: "TEXT",
Tasks.TOPIC_MODELING: "TEXT",

Tasks.PROMPTING: "SSP",
Tasks.SELF_SUPERVISED_PRETRAINING: "SSP",

Tasks.SPEECH_RECOGNITION: "SPTEXT",
Tasks.SPEECH_TO_TEXT_TRANSLATION: "SPTEXT",
Tasks.TEXT_TO_SPEECH: "SPTEXT",

Tasks.SPEECH_TO_SPEECH_TRANSLATION: "S2S",

Tasks.SPEECH_LANGUAGE_IDENTIFICATION: "SPEECH",
Tasks.SPEECH_EMOTION_RECOGNITION: "SPEECH",

Tasks.SPEECH_EMOTION_RECOGNITION_MULTILABEL: "SPEECH_MULTI",

Tasks.IMAGE_CAPTIONING: "IMTEXT",
Tasks.STYLIZED_IMAGE_CAPTIONING: "IMTEXT",
Tasks.VISUALLY_GROUNDED_REASONING: "IMTEXT",

Tasks.HOAX_NEWS_CLASSIFICATION: "TEXT",
Tasks.CONCEPT_ALIGNMENT_CLASSIFICATION: "PAIRS",
Tasks.SPAN_BASED_ABSA: "SEQ_LABEL",
Tasks.FACT_CHECKING: None,
Tasks.VIDEO_CAPTIONING: "VIDTEXT",
Tasks.VIDEO_TO_TEXT_RETRIEVAL: "VIDTEXT",

Tasks.CONCEPT_ALIGNMENT_CLASSIFICATION: "PAIRS",
Tasks.FACT_CHECKING: None,
}
Expand Down Expand Up @@ -285,6 +283,7 @@ class Licenses(Enum):
"SPEECH_MULTI": speech_multi_features(),
"IMTEXT": image_text_features(),
"VIDTEXT": video_features,
"TOD": tod_features,
}

TASK_TO_FEATURES = {
Expand Down
2 changes: 2 additions & 0 deletions seacrowd/utils/schemas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from .text_multilabel import features as text_multi_features
from .text_to_text import features as text2text_features
from .video import features as video_features
from .tod import features as tod_features

__all__ = [
"image_text_features",
Expand All @@ -32,4 +33,5 @@
"text_multi_features",
"text2text_features",
"video_features",
"tod_features",
]
74 changes: 74 additions & 0 deletions seacrowd/utils/schemas/tod.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
"""
End-to-end Task Oriented Dialogue Schema

This schema will adapt the WoZ schema that has been used in several end-to-end task-oriented dialogue (TOD) task.
URL: https://huggingface.co/datasets/woz_dialogue
"""
import datasets

"""
EXAMPLE:

[
{
"turn_label": [ [ "food", "eritrean" ] ],
"system_utterance": "",
"turn_idx": 0,
"belief_state": [ { "slots": [ [ "food", "eritrean" ] ], "act": "inform" } ],
"user_utterance": "Are there any eritrean restaurants in town?",
"system_acts": []
},
{
"turn_label": [ [ "food", "chinese" ] ],
"system_utterance": "No, there are no eritrean restaurants in town. Would you like a different restaurant? ",
"turn_idx": 1,
"belief_state": [ { "slots": [ [ "food", "chinese" ] ], "act": "inform" } ],
"user_utterance": "How about Chinese food?",
"system_acts": []
},
{
"turn_label": [ [ "area", "east" ] ],
"system_utterance": "There is a wide variety of Chinese restaurants, do you have an area preference or a price preference to narrow it down?",
"turn_idx": 2,
"belief_state": [ { "slots": [ [ "food", "chinese" ] ], "act": "inform" }, { "slots": [ [ "area", "east" ] ], "act": "inform" } ],
"user_utterance": "I would like the East part of town.",
"system_acts": [ [ "area" ] ]
},
{
"turn_label": [ [ "request", "postcode" ], [ "request", "phone" ], [ "request", "address" ] ],
"system_utterance": "Yu Garden is a chinese restaurant in the east area.",
"turn_idx": 3,
"belief_state": [ { "slots": [ [ "slot", "postcode" ] ], "act": "request" }, { "slots": [ [ "slot", "phone" ] ], "act": "request" }, { "slots": [ [ "slot", "address" ] ], "act": "request" }, { "slots": [ [ "food", "chinese" ] ], "act": "inform" }, { "slots": [ [ "area", "east" ] ], "act": "inform" } ],
"user_utterance": "Could I get the address, phone number, and postcode of Yu Garden?",
"system_acts": []
},
{
"turn_label": [],
"system_utterance": "Phone is 01223 248882, address and postcode are 529 Newmarket Road Fen Ditton C.B 5, 8 P.A",
"turn_idx": 4,
"belief_state": [ { "slots": [ [ "food", "chinese" ] ], "act": "inform" }, { "slots": [ [ "area", "east" ] ], "act": "inform" } ],
"user_utterance": "Thank you. That is all the information I needed. Bye bye!",
"system_acts": []}
]
"""

features = datasets.Features(
{
"dialogue_idx": datasets.Value("int32"),
"dialogue": [
{
"turn_label": datasets.Sequence(datasets.Sequence(datasets.Value("string"))),
"system_utterance": datasets.Value("string"),
"turn_idx": datasets.Value("int32"),
"belief_state": [
{
"slots": datasets.Sequence(datasets.Sequence(datasets.Value("string"))),
"act": datasets.Value("string"),
}
],
"user_utterance": datasets.Value("string"),
"system_acts": datasets.Sequence(datasets.Sequence(datasets.Value("string"))),
}
],
}
)