-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added fever and goemotions and new mixins (#976)
- Loading branch information
Showing
9 changed files
with
258 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#! /usr/bin/env python | ||
# coding=utf-8 | ||
# Copyright (c) 2019 Uber Technologies, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ============================================================================== | ||
from ludwig.datasets.base_dataset import BaseDataset, DEFAULT_CACHE_LOCATION | ||
from ludwig.datasets.mixins.process import MultifileJoinProcessMixin | ||
from ludwig.datasets.mixins.download import UncompressedFileDownloadMixin | ||
from ludwig.datasets.mixins.load import CSVLoadMixin | ||
|
||
|
||
def load(cache_dir=DEFAULT_CACHE_LOCATION): | ||
dataset = Fever(cache_dir=cache_dir) | ||
return dataset.load() | ||
|
||
|
||
class Fever(UncompressedFileDownloadMixin, MultifileJoinProcessMixin, CSVLoadMixin, BaseDataset): | ||
"""The Fever dataset. | ||
This pulls in an array of mixins for different types of functionality | ||
which belongs in the workflow for ingesting and transforming training data into a destination | ||
dataframe that can fit into Ludwig's training API. | ||
""" | ||
|
||
def __init__(self, cache_dir=DEFAULT_CACHE_LOCATION): | ||
super().__init__(dataset_name="fever", cache_dir=cache_dir) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 1.0 | ||
download_urls: | ||
- https://s3-eu-west-1.amazonaws.com/fever.public/train.jsonl | ||
- https://s3-eu-west-1.amazonaws.com/fever.public/paper_dev.jsonl | ||
- https://s3-eu-west-1.amazonaws.com/fever.public/paper_test.jsonl | ||
split_filenames: | ||
train_file: train.jsonl | ||
test_file: paper_dev.jsonl | ||
val_file: paper_test.jsonl | ||
download_file_type: jsonl | ||
csv_filename: fever.csv |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#! /usr/bin/env python | ||
# coding=utf-8 | ||
# Copyright (c) 2019 Uber Technologies, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ============================================================================== | ||
from ludwig.datasets.base_dataset import BaseDataset, DEFAULT_CACHE_LOCATION | ||
from ludwig.datasets.mixins.process import MultifileJoinProcessMixin | ||
from ludwig.datasets.mixins.download import UncompressedFileDownloadMixin | ||
from ludwig.datasets.mixins.load import CSVLoadMixin | ||
|
||
|
||
def load(cache_dir=DEFAULT_CACHE_LOCATION): | ||
dataset = GoEmotions(cache_dir=cache_dir) | ||
return dataset.load() | ||
|
||
|
||
class GoEmotions(UncompressedFileDownloadMixin, MultifileJoinProcessMixin, CSVLoadMixin, BaseDataset): | ||
"""The GoEmotions dataset. | ||
This pulls in an array of mixins for different types of functionality | ||
which belongs in the workflow for ingesting and transforming training data into a destination | ||
dataframe that can fit into Ludwig's training API. | ||
""" | ||
|
||
def __init__(self, cache_dir=DEFAULT_CACHE_LOCATION): | ||
super().__init__(dataset_name="goemotions", cache_dir=cache_dir) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 1.0 | ||
download_urls: | ||
- https://raw.githubusercontent.com/google-research/google-research/master/goemotions/data/train.tsv | ||
- https://raw.githubusercontent.com/google-research/google-research/master/goemotions/data/dev.tsv | ||
- https://raw.githubusercontent.com/google-research/google-research/master/goemotions/data/test.tsv | ||
split_filenames: | ||
train_file: train.tsv | ||
test_file: test.tsv | ||
val_file: dev.tsv | ||
download_file_type: tsv | ||
csv_filename: goemotions.csv |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
version: 1.0 | ||
download_url: http://boston.lti.cs.cmu.edu/classes/95-865-K/HW/HW2/ohsumed-allcats-6.zip | ||
download_urls: | ||
- http://boston.lti.cs.cmu.edu/classes/95-865-K/HW/HW2/ohsumed-allcats-6.zip | ||
csv_filename: ohsumed-allcats.csv |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
version: 1.0 | ||
download_url: http://boston.lti.cs.cmu.edu/classes/95-865-K/HW/HW2/reuters-allcats-6.zip | ||
download_urls: | ||
- http://boston.lti.cs.cmu.edu/classes/95-865-K/HW/HW2/reuters-allcats-6.zip | ||
csv_filename: reuters-allcats.csv |
This file contains 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