Insert task templates for text classification
MEMBER
Update: found a few datasets that slipped through the net. Adding them shortly!
2021-05-21T08:52:18Z
https://github.com/huggingface/datasets/pull/2389#issuecomment-845794984
https://api.github.com/repos/huggingface/datasets/issues/2389
MDEyOklzc3VlQ29tbWVudDg0NTc5NDk4NA==
https://api.github.com/repos/huggingface/datasets/issues/comments/845794984/reactions
2021-05-21T08:52:18Z
https://api.github.com/repos/huggingface/datasets/issues/comments/845794984
https://avatars.githubusercontent.com/u/26859204?v=4
https://api.github.com/users/lewtun/events{/privacy}
https://api.github.com/users/lewtun/followers
https://api.github.com/users/lewtun/following{/other_user}
https://api.github.com/users/lewtun/gists{/gist_id}
https://github.com/lewtun
lewtun
MDQ6VXNlcjI2ODU5MjA0
https://api.github.com/users/lewtun/orgs
https://api.github.com/users/lewtun/received_events
https://api.github.com/users/lewtun/repos
https://api.github.com/users/lewtun/starred{/owner}{/repo}
https://api.github.com/users/lewtun/subscriptions
User
https://api.github.com/users/lewtun
public
MEMBER
You might have thought about this already, but would it make sense to use the `datasets.features.ClassLabel` values when possible instead of declaring the list once for the `feature` and once for the `template`?
2021-05-21T11:34:12Z
https://github.com/huggingface/datasets/pull/2389#issuecomment-845887571
https://api.github.com/repos/huggingface/datasets/issues/2389
MDEyOklzc3VlQ29tbWVudDg0NTg4NzU3MQ==
https://api.github.com/repos/huggingface/datasets/issues/comments/845887571/reactions
2021-05-21T11:34:12Z
https://api.github.com/repos/huggingface/datasets/issues/comments/845887571
https://avatars.githubusercontent.com/u/10469459?v=4
https://api.github.com/users/yjernite/events{/privacy}
https://api.github.com/users/yjernite/followers
https://api.github.com/users/yjernite/following{/other_user}
https://api.github.com/users/yjernite/gists{/gist_id}
https://github.com/yjernite
yjernite
MDQ6VXNlcjEwNDY5NDU5
https://api.github.com/users/yjernite/orgs
https://api.github.com/users/yjernite/received_events
https://api.github.com/users/yjernite/repos
https://api.github.com/users/yjernite/starred{/owner}{/repo}
https://api.github.com/users/yjernite/subscriptions
User
https://api.github.com/users/yjernite
public
MEMBER
> You might have thought about this already, but would it make sense to use the `datasets.features.ClassLabel` values when possible instead of declaring the list once for the `feature` and once for the `template`?

hi @yjernite, these code insertions are auto-generated so could certainly be improved :) 

just so i understand, your idea is that instead of doing something like

```python
class AGNews(datasets.GeneratorBasedBuilder):
    """AG News topic classification dataset."""

    def _info(self):
        return datasets.DatasetInfo(
            description=_DESCRIPTION,
            features=datasets.Features(
                {
                    "text": datasets.Value("string"),
                    "label": datasets.features.ClassLabel(
                        names=["World", "Sports", "Business", "Sci/Tech"]
                    ),
                }
            ),
            homepage="http://groups.di.unipi.it/~gulli/AG_corpus_of_news_articles.html",
            citation=_CITATION,
            task_templates=[
                TextClassification(
                    labels=("Business", "Sci/Tech", "Sports", "World"),
                    text_column="text",
                    label_column="label",
                )
            ],
        )
```

we could do the following:

```python
class AGNews(datasets.GeneratorBasedBuilder):
    """AG News topic classification dataset."""

    def _info(self):
        info = datasets.DatasetInfo(
            description=_DESCRIPTION,
            features=datasets.Features(
                {
                    "text": datasets.Value("string"),
                    "label": datasets.features.ClassLabel(
                        names=["World", "Sports", "Business", "Sci/Tech"]
                    ),
                }
            ),
            homepage="http://groups.di.unipi.it/~gulli/AG_corpus_of_news_articles.html",
            citation=_CITATION,
        )

        info.task_templates = [
            TextClassification(
                labels=info.features.names,
                text_column="text",
                label_column="label",
            )
        ]
        return info
```


2021-05-21T12:18:03Z
https://github.com/huggingface/datasets/pull/2389#issuecomment-845910296
https://api.github.com/repos/huggingface/datasets/issues/2389
MDEyOklzc3VlQ29tbWVudDg0NTkxMDI5Ng==
https://api.github.com/repos/huggingface/datasets/issues/comments/845910296/reactions
2021-05-21T12:18:03Z
https://api.github.com/repos/huggingface/datasets/issues/comments/845910296
https://avatars.githubusercontent.com/u/26859204?v=4
https://api.github.com/users/lewtun/events{/privacy}
https://api.github.com/users/lewtun/followers
https://api.github.com/users/lewtun/following{/other_user}
https://api.github.com/users/lewtun/gists{/gist_id}
https://github.com/lewtun
lewtun
MDQ6VXNlcjI2ODU5MjA0
https://api.github.com/users/lewtun/orgs
https://api.github.com/users/lewtun/received_events
https://api.github.com/users/lewtun/repos
https://api.github.com/users/lewtun/starred{/owner}{/repo}
https://api.github.com/users/lewtun/subscriptions
User
https://api.github.com/users/lewtun
public
MEMBER
Or we could simply not specify the labels and update the template in the DatasetInfo postinit to give it the labels ?
2021-05-21T13:10:39Z
https://github.com/huggingface/datasets/pull/2389#issuecomment-845939683
https://api.github.com/repos/huggingface/datasets/issues/2389
MDEyOklzc3VlQ29tbWVudDg0NTkzOTY4Mw==
https://api.github.com/repos/huggingface/datasets/issues/comments/845939683/reactions
2021-05-21T13:10:39Z
https://api.github.com/repos/huggingface/datasets/issues/comments/845939683
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
MEMBER
> Or we could simply not specify the labels and update the template in the DatasetInfo postinit to give it the labels ?

Oh yes, that would be great! It does mean enforcing that people use the right feature type (sometimes people still use a `string` feature still because they don't want to enumerate the classes, but I guess you've been catching most of those in reviews @lhoestq )

There might be reasons where there should be a legitimate difference, but I can't really think of nay right now, and we can always duplicate the feature
2021-05-21T14:46:51Z
https://github.com/huggingface/datasets/pull/2389#issuecomment-846004089
https://api.github.com/repos/huggingface/datasets/issues/2389
MDEyOklzc3VlQ29tbWVudDg0NjAwNDA4OQ==
https://api.github.com/repos/huggingface/datasets/issues/comments/846004089/reactions
2021-05-21T14:46:51Z
https://api.github.com/repos/huggingface/datasets/issues/comments/846004089
https://avatars.githubusercontent.com/u/10469459?v=4
https://api.github.com/users/yjernite/events{/privacy}
https://api.github.com/users/yjernite/followers
https://api.github.com/users/yjernite/following{/other_user}
https://api.github.com/users/yjernite/gists{/gist_id}
https://github.com/yjernite
yjernite
MDQ6VXNlcjEwNDY5NDU5
https://api.github.com/users/yjernite/orgs
https://api.github.com/users/yjernite/received_events
https://api.github.com/users/yjernite/repos
https://api.github.com/users/yjernite/starred{/owner}{/repo}
https://api.github.com/users/yjernite/subscriptions
User
https://api.github.com/users/yjernite
public
MEMBER
Let's ignore the CI fails since they are unrelated to your changes. They're about dataset cards issues
2021-05-28T15:26:16Z
https://github.com/huggingface/datasets/pull/2389#issuecomment-850496907
https://api.github.com/repos/huggingface/datasets/issues/2389
MDEyOklzc3VlQ29tbWVudDg1MDQ5NjkwNw==
https://api.github.com/repos/huggingface/datasets/issues/comments/850496907/reactions
2021-05-28T15:26:16Z
https://api.github.com/repos/huggingface/datasets/issues/comments/850496907
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
This PR inserts text-classification templates for datasets with the following properties:

* Only one config
* At most two features of `(Value, ClassLabel)` type

Note that this misses datasets like `sentiment140` which only has `Value` type features - these will be handled in a separate PR