πŸ“„ Ms MyΒΆ

MASSIVE is a parallel dataset of > 1M utterances across 51 languages with annotations for the Natural Language Understanding tasks of intent prediction and slot annotation. Utterances span 60 intents and include 55 slot types. MASSIVE was created by localizing the SLURP dataset, composed of general Intelligent Voice Assistant single-shot interactions. See the full description on the dataset page: https://huggingface.co/datasets/AmazonScience/massive.

Tags: annotations_creators:expert-generated, arxiv:2204.08582, flags:['natural-language-understanding'], language_creators:found, license:cc-by-4.0, multilinguality:['af-ZA', 'am-ET', 'ar-SA', 'az-AZ', 'bn-BD', 'ca-ES', 'cy-GB', 'da-DK', 'de-DE', 'el-GR', 'en-US', 'es-ES', 'fa-IR', 'fi-FI', 'fr-FR', 'he-IL', 'hi-IN', 'hu-HU', 'hy-AM', 'id-ID', 'is-IS', 'it-IT', 'ja-JP', 'jv-ID', 'ka-GE', 'km-KH', 'kn-IN', 'ko-KR', 'lv-LV', 'ml-IN', 'mn-MN', 'ms-MY', 'my-MM', 'nb-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ro-RO', 'ru-RU', 'sl-SL', 'sq-AL', 'sv-SE', 'sw-KE', 'ta-IN', 'te-IN', 'th-TH', 'tl-PH', 'tr-TR', 'ur-PK', 'vi-VN', 'zh-CN', 'zh-TW'], region:us, size_categories:100K<n<1M, source_datasets:original, task_categories:text-classification, task_ids:['intent-classification', 'multi-class-classification']

cards.amazon_mass.ms_MY

type: TaskCard
loader: 
  type: LoadHF
  path: AmazonScience/massive
  name: ms-MY
preprocess_steps: 
  - type: MapInstanceValues
    mappers: 
      intent: 
        0: datetime_query
        1: iot_hue_lightchange
        2: transport_ticket
        3: takeaway_query
        4: qa_stock
        5: general_greet
        6: recommendation_events
        7: music_dislikeness
        8: iot_wemo_off
        9: cooking_recipe
        10: qa_currency
        11: transport_traffic
        12: general_quirky
        13: weather_query
        14: audio_volume_up
        15: email_addcontact
        16: takeaway_order
        17: email_querycontact
        18: iot_hue_lightup
        19: recommendation_locations
        20: play_audiobook
        21: lists_createoradd
        22: news_query
        23: alarm_query
        24: iot_wemo_on
        25: general_joke
        26: qa_definition
        27: social_query
        28: music_settings
        29: audio_volume_other
        30: calendar_remove
        31: iot_hue_lightdim
        32: calendar_query
        33: email_sendemail
        34: iot_cleaning
        35: audio_volume_down
        36: play_radio
        37: cooking_query
        38: datetime_convert
        39: qa_maths
        40: iot_hue_lightoff
        41: iot_hue_lighton
        42: transport_query
        43: music_likeness
        44: email_query
        45: play_music
        46: audio_volume_mute
        47: social_post
        48: alarm_set
        49: qa_factoid
        50: calendar_set
        51: play_game
        52: alarm_remove
        53: lists_remove
        54: transport_taxi
        55: recommendation_movies
        56: iot_coffee
        57: music_query
        58: play_podcasts
        59: lists_query
  - type: Rename
    field_to_field: 
      utt: text
      intent: label
  - type: Set
    fields: 
      classes: 
        - datetime_query
        - iot_hue_lightchange
        - transport_ticket
        - takeaway_query
        - qa_stock
        - general_greet
        - recommendation_events
        - music_dislikeness
        - iot_wemo_off
        - cooking_recipe
        - qa_currency
        - transport_traffic
        - general_quirky
        - weather_query
        - audio_volume_up
        - email_addcontact
        - takeaway_order
        - email_querycontact
        - iot_hue_lightup
        - recommendation_locations
        - play_audiobook
        - lists_createoradd
        - news_query
        - alarm_query
        - iot_wemo_on
        - general_joke
        - qa_definition
        - social_query
        - music_settings
        - audio_volume_other
        - calendar_remove
        - iot_hue_lightdim
        - calendar_query
        - email_sendemail
        - iot_cleaning
        - audio_volume_down
        - play_radio
        - cooking_query
        - datetime_convert
        - qa_maths
        - iot_hue_lightoff
        - iot_hue_lighton
        - transport_query
        - music_likeness
        - email_query
        - play_music
        - audio_volume_mute
        - social_post
        - alarm_set
        - qa_factoid
        - calendar_set
        - play_game
        - alarm_remove
        - lists_remove
        - transport_taxi
        - recommendation_movies
        - iot_coffee
        - music_query
        - play_podcasts
        - lists_query
      text_type: sentence
      type_of_class: intent
task: tasks.classification.multi_class
templates: templates.classification.multi_class.all
[source]

Explanation about TaskCardΒΆ

TaskCard delineates the phases in transforming the source dataset into model input, and specifies the metrics for evaluation of model output.

Attributes:

loader: specifies the source address and the loading operator that can access that source and transform it into a unitxt multistream.

preprocess_steps: list of unitxt operators to process the data source into model input.

task: specifies the fields (of the already (pre)processed instance) making the inputs, the fields making the outputs, and the metrics to be used for evaluating the model output.

templates: format strings to be applied on the input fields (specified by the task) and the output fields. The template also carries the instructions and the list of postprocessing steps, to be applied to the model output.

Explanation about MapInstanceValuesΒΆ

A class used to map instance values into other values.

This class is a type of InstanceOperator, it maps values of instances in a stream using predefined mappers.

Attributes:
mappers (Dict[str, Dict[str, Any]]): The mappers to use for mapping instance values.

Keys are the names of the fields to undergo mapping, and values are dictionaries that define the mapping from old values to new values.

strict (bool): If True, the mapping is applied strictly. That means if a value

does not exist in the mapper, it will raise a KeyError. If False, values that are not present in the mapper are kept as they are.

process_every_value (bool): If True, all fields to be mapped should be lists, and the mapping

is to be applied to their individual elements. If False, mapping is only applied to a field containing a single value.

Examples:

MapInstanceValues(mappers={β€œa”: {β€œ1”: β€œhi”, β€œ2”: β€œbye”}}) replaces β€˜1’ with β€˜hi’ and β€˜2’ with β€˜bye’ in field β€˜a’ in all instances of all streams: instance {β€œa”:”1”, β€œb”: 2} becomes {β€œa”:”hi”, β€œb”: 2}.

MapInstanceValues(mappers={β€œa”: {β€œ1”: β€œhi”, β€œ2”: β€œbye”}}, process_every_value=True) Assuming field β€˜a’ is a list of values, potentially including β€œ1”-s and β€œ2”-s, this replaces each such β€œ1” with β€œhi” and β€œ2” – with β€œbye” in all instances of all streams: instance {β€œa”: [β€œ1”, β€œ2”], β€œb”: 2} becomes {β€œa”: [β€œhi”, β€œbye”], β€œb”: 2}.

MapInstanceValues(mappers={β€œa”: {β€œ1”: β€œhi”, β€œ2”: β€œbye”}}, strict=True) To ensure that all values of field β€˜a’ are mapped in every instance, use strict=True. Input instance {β€œa”:”3”, β€œb”: 2} will raise an exception per the above call, because β€œ3” is not a key in the mapper of β€œa”.

MapInstanceValues(mappers={β€œa”: {str([1,2,3,4]): β€˜All’, str([]): β€˜None’}}, strict=True) replaces a list [1,2,3,4] with the string β€˜All’ and an empty list by string β€˜None’. Note that mapped values are defined by their string representation, so mapped values must be converted to strings.

Explanation about LoadHFΒΆ

Loads datasets from the HuggingFace Hub.

It supports loading with or without streaming, and it can filter datasets upon loading.

Args:

path: The path or identifier of the dataset on the HuggingFace Hub. name: An optional dataset name. data_dir: Optional directory to store downloaded data. split: Optional specification of which split to load. data_files: Optional specification of particular data files to load. revision: Optional. The revision of the dataset. Often the commit id. Use in case you want to set the dataset version. streaming: Bool indicating if streaming should be used. filtering_lambda: A lambda function for filtering the data after loading. num_proc: Optional integer to specify the number of processes to use for parallel dataset loading.

Example:

Loading glue’s mrpc dataset

load_hf = LoadHF(path='glue', name='mrpc')

Explanation about SetΒΆ

Adds specified fields to each instance in a given stream or all streams (default) If fields exist, updates them.

Args:
fields (Dict[str, object]): The fields to add to each instance.

Use β€˜/’ to access inner fields

use_deepcopy (bool) : Deep copy the input value to avoid later modifications

Examples:

# Add a β€˜classes’ field with a value of a list β€œpositive” and β€œnegative” to all streams Set(fields={β€œclasses”: [β€œpositive”,”negatives”]})

# Add a β€˜start’ field under the β€˜span’ field with a value of 0 to all streams Set(fields={β€œspan/start”: 0}

# Add a β€˜classes’ field with a value of a list β€œpositive” and β€œnegative” to β€˜train’ stream Set(fields={β€œclasses”: [β€œpositive”,”negatives”], apply_to_stream=[β€œtrain”]})

# Add a β€˜classes’ field on a given list, prevent modification of original list # from changing the instance. Set(fields={β€œclasses”: alist}), use_deepcopy=True) # if now alist is modified, still the instances remain intact.

Explanation about RenameΒΆ

Renames fields.

Move value from one field to another, potentially, if field name contains a /, from one branch into another. Remove the from field, potentially part of it in case of / in from_field.

Examples:

Rename(field_to_field={β€œb”: β€œc”}) will change inputs [{β€œa”: 1, β€œb”: 2}, {β€œa”: 2, β€œb”: 3}] to [{β€œa”: 1, β€œc”: 2}, {β€œa”: 2, β€œc”: 3}]

Rename(field_to_field={β€œb”: β€œc/d”}) will change inputs [{β€œa”: 1, β€œb”: 2}, {β€œa”: 2, β€œb”: 3}] to [{β€œa”: 1, β€œc”: {β€œd”: 2}}, {β€œa”: 2, β€œc”: {β€œd”: 3}}]

Rename(field_to_field={β€œb”: β€œb/d”}) will change inputs [{β€œa”: 1, β€œb”: 2}, {β€œa”: 2, β€œb”: 3}] to [{β€œa”: 1, β€œb”: {β€œd”: 2}}, {β€œa”: 2, β€œb”: {β€œd”: 3}}]

Rename(field_to_field={β€œb/c/e”: β€œb/d”}) will change inputs [{β€œa”: 1, β€œb”: {β€œc”: {β€œe”: 2, β€œf”: 20}}}] to [{β€œa”: 1, β€œb”: {β€œc”: {β€œf”: 20}, β€œd”: 2}}]

References: templates.classification.multi_class.all, tasks.classification.multi_class

Read more about catalog usage here.