josteece/github-issues huggingface dataset:
Fix/start token mask issue and update documentation
Opened by TristanThrush (closed)

This pr fixes a couple bugs:

1) the perplexity was calculated with a 0 in the attention mask for the start token, which was causing high perplexity scores that were not correct
2) the documentation was not updated

Comments:
_The documentation is not available anymore as the PR was closed or merged._

> Good catch ! Thanks :)
> 
> Next time can you describe your fix in the Pull Request description please ?

Thanks. Also whoops, sorry about not being very descriptive. I updated the pull request description, and will keep this in mind for future PRs.
No google drive URL for pubmed_qa
Opened by lhoestq (closed)

I hosted the data files in https://huggingface.co/datasets/pubmed_qa. This is allowed because the data is under the MIT license.

cc @stas00 

Comments:
_The documentation is not available anymore as the PR was closed or merged._

CI is failing because some sections are missing in the dataset card, but this is unrelated to this PR - Merging !
Replace data URL in SAMSum dataset and support streaming
Opened by albertvillanova (closed)

This PR replaces data URL in SAMSum dataset:
- original host (arxiv.org) does not allow HTTP Range requests
- we have hosted the data on the Hub (license: CC BY-NC-ND 4.0)

Moreover, it implements support for streaming.

Fix #4146.
Related to: #4236.

CC: @severo 

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Bump PyArrow Version to 6
Opened by dnaveenr (closed)

Fixes #4152 

This PR updates the PyArrow version to 6 in setup.py, CI job files .circleci/config.yaml and .github/workflows/benchmarks.yaml files.
This will fix ArrayND error which exists in pyarrow 5.

Comments:
_The documentation is not available anymore as the PR was closed or merged._

Updated meta.yaml as well. Thanks.

I'm OK with bumping PyArrow to version 6 to match the version in Colab, but maybe a better solution would be to stop using extension types in our codebase to avoid similar issues.

> but maybe a better solution would be to stop using extension types in our codebase to avoid similar issues.

I agree, not much attention has been payed to extension arrays in the latest developments of Arrow anyway.

Let's not use them more that what we do right now, and try to remove them at one point
The data preview of XGLUE
Opened by czq1999 (closed)

It seems that something wrong with the data previvew of XGLUE

Comments:
![image](https://user-images.githubusercontent.com/49108847/165700611-915b4343-766f-4b81-bdaa-b31950250f06.png)


Thanks for reporting @czq1999.

Note that the dataset viewer uses the dataset in streaming mode and that not all datasets support streaming yet.

That is the case for XGLUE dataset (as the error message points out): this must be refactored to support streaming. 

Fixed, thanks @albertvillanova !

https://huggingface.co/datasets/xglue

<img width="824" alt="Capture d’écran 2022-04-29 à 10 23 14" src="https://user-images.githubusercontent.com/1676121/165909391-9f98d98a-665a-4e57-822d-8baa2dc9b7c9.png">
Support to load dataset with TSV files by passing only dataset name
Opened by albertvillanova (closed)

This PR implements support to load a dataset (w/o script) containing TSV files by passing only the dataset name (no need to pass `sep='\t'`):
```python
ds = load_dataset("dataset/name")
```

The refactoring allows for future builder kwargs customizations based on file extension.

Related to #4238.

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Fix yield for crd3
Opened by shanyas10 (closed)

Modified the `_generate_examples` function to consider all the turns for a chunk id as a single example
Modified the features accordingly

```
"turns": [
                        {
                            "names": datasets.features.Sequence(datasets.Value("string")),
                            "utterances": datasets.features.Sequence(datasets.Value("string")),
                            "number": datasets.Value("int32"),
                        }
                    ],
                }
```

I wasn't able to run `datasets-cli dummy_data datasets` command. Is there a workaround for this? 

Comments:
I don't think you need to generate new dummy data, since they're in the same format as the original data.

The CI is failing because of this error:
```python
>                       turn["names"] = turn["NAMES"]
E                       TypeError: tuple indices must be integers or slices, not str
```

Do you know what could cause this ? If I understand correctly, `turn` is supposed to be a list of dictionaries right ?

> ```  
>   
> Do you know what could cause this ? If I understand correctly, turn is supposed to be a list of dictionaries right ?
> ```

This is strange. Let me look into this. As per https://github.com/RevanthRameshkumar/CRD3/blob/master/data/aligned%20data/c%3D2/C1E001_2_0.json TURNS is a list of dictionaries. So when we iterate over `row["TURNS]"` each `turn` is essentially a dictionary. Not sure why it's being considered a tuple here.
Replace data URL in big_patent dataset and support streaming
Opened by albertvillanova (closed)

This PR replaces the Google Drive URL with our Hub one, once the data owners have approved to host their data on the Hub.

Moreover, this PR makes the dataset streamable.

Fix #4217.

Comments:
_The documentation is not available anymore as the PR was closed or merged._

I first uploaded the data files to the Hub: I think it is a good option because we have git lfs to track versions and changes. Moreover people will be able to make PRs to propose updates on the data files.
- I would have preferred to upload it it to the "data" org namespace, but it is already taken (although not used): might be possible to take it?

As an alternative (and to be consistent with previous datasets), I also uploaded the data files to our AWS bucket.

We should decide which to use (now and for future datasets) and set it here before merging. We should remove the data files for the non-chosen option.

CC: @lhoestq @mariosasko @polinaeterna 

Would it make sense to make the dataset a community one (so, create an organization for it) and store the script and the data in a single repository? Just as it is for most of the datasets. That way we can also access the data using a relative path inside the repo (that's not the point though). The point is that to me it seems a bit more straightforward to store everything in one place. 

I guess the strong argument against this logic is that in this case the canonical version won't work... But maybe there is some redirecting mechanism I don't know about? :)

Anyway, I'm in favor of hosting data on the Hub instead of AWS :) 

I also think storing everything in one place/single repository is the best option.

@polinaeterna Canonical datasets also support data files (see the [`red_caps` repo](https://huggingface.co/datasets/red_caps/tree/main) for instance) 

Thanks @polinaeterna and @mariosasko for your comments.

Yes, definitely it is much better to have everything in the same repo. 

I'm transferring their data files to the Hub under "big_patent" and deleting them from the other repo and AWS.
How to load VERY LARGE dataset?
Opened by CaoYiqingT (closed)

### System Info

```shell
I am using transformer trainer while meeting the issue.
The trainer requests torch.utils.data.Dataset as input, which loads the whole dataset into the memory at once. Therefore, when the dataset is too large to load, there's nothing I can do except using IterDataset, which loads samples of data seperately, and results in low efficiency. 
I wonder if there are any tricks like Sharding in huggingface trainer.
Looking forward to your reply.
```


### Who can help?

Trainer: @sgugger

### Information

- [ ] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

None

### Expected behavior

```shell
I wonder if there are any tricks like fairseq Sharding very large datasets https://fairseq.readthedocs.io/en/latest/getting_started.html.
Thanks a lot!
```


Comments:
The `Trainer` support `IterableDataset`, not just datasets.
Autoeval config
Opened by nazneenrajani (closed)

Added autoeval config to imdb as pilot

Comments:
_The documentation is not available anymore as the PR was closed or merged._

Related to: https://github.com/huggingface/autonlp-backend/issues/414 and https://github.com/huggingface/autonlp-backend/issues/424

The tests are failing due to the changed metadata:

```
got an unexpected keyword argument 'train-eval-index'
```

I think you can fix this by updating the `DatasetMetadata` class and implementing an appropriate `validate_train_eval_index()` function

@lhoestq we are working with an arbitrary set of tags for `autoeval config`. See https://github.com/huggingface/autonlp-backend/issues/414
I need to add a validator function though for the tests to pass. Our set is not well-defined as in the rest https://github.com/huggingface/datasets/tree/master/src/datasets/utils/resources. What's a workaround for this?

On the question of validating the `train-eval-index` metadata, I think the simplest approach would be to validate that the required fields exist and not worry about their values (which are open-ended).

For me, the required fields include:

* `config`
* `task`
* `task_id`
* `splits` (train / validation / eval)
* `col_mapping`
* `metrics` (checking that each one has `type`, `name`) 

Here I'm using the spec defined in https://github.com/huggingface/autonlp-backend/issues/414 as a guide.

WDYT @lhoestq ?

Makes sense ! Currently the metadata type validator doesn't support subfields - let me open a PR to add it

I ended up improving the metadata validation in this PR x)

In particular:
- I added support YAML keys with dashes instead of underscores for `train-eval-index`
- I added `train-eval-index` validation  with `validate_train_eval_index`. It does nothing fancy, it just checks that it is a list if it exists in the YAML, but feel free to improve it if you want

Let me know if it sounds good to you ! I think we can improve `validate_train_eval_index` in another PR

Come on windows... I didn't do anything advanced...

Anyway, will try to fix this when I get back home x)

> Come on windows... I didn't do anything advanced...
> 
> Anyway, will try to fix this when I get back home x)

Hehe, thanks!

Thanks, @lhoestq this is great! 

Did I just fix it for windows and now it fails on linux ? xD

> Did I just fix it for windows and now it fails on linux ? xD

Looks like the Heisenberg uncertainty principle is at play here - you cannot simultaneously have unit tests passing in both Linux and Windows 😅 

The worst is that the tests pass locally both on my windows and my linux x)

Ok fixed it, the issue came from python 3.6 that doesn't return the right `__origin__` for Dict and List types

> Alright thanks for adding the first Autoeval config ! :D

Woohoo! Thank you so much 🤗 

This is cool!
Why the `conll2003` dataset on huggingface only contains the `en` subset? Where is the  German data?
Opened by beyondguo (closed)

![image](https://user-images.githubusercontent.com/37113676/165416606-96b5db18-b16c-4b6b-928c-de8620fd943e.png)

But on huggingface datasets:
![image](https://user-images.githubusercontent.com/37113676/165416649-8fd77980-ca0d-43f0-935e-f398ba8323a4.png)

Where is the  German data?

Comments:
Thanks for reporting @beyondguo.

Indeed, we generate this dataset from this raw data file URL: https://data.deepai.org/conll2003.zip
And that URL only contains the English version.

The German data requires payment

The [original task page](https://www.clips.uantwerpen.be/conll2003/ner/) states "The German data is a collection of articles from the Frankfurter Rundschau. The named entities have been annotated by people of the University of Antwerp. Only the annotations are available here. In order to build these data sets you need access to the ECI Multilingual Text Corpus. It can be ordered from the Linguistic Data Consortium (2003 non-member price: US$ 35.00)."

Inflation since 2003 has also affected LDC's prices, and today the dataset [LDC94T5](https://catalog.ldc.upenn.edu/LDC94T5) is available under license for $75 a copy. The [license](https://catalog.ldc.upenn.edu/license/eci-slash-mci-user-agreement.pdf) includes a non-distribution condition, which is probably why the data has not turned up openly.

The ACL hold copyright of this data; I'll mail them and anyone I can find at ECI to see if they'll open this up now. After all, it worked with Microsoft 3DMM, why not here too, after 28 years? :)


Closing this issue as we are not allowed to share publicly the German subset.
Add pearsonr mc, update functionality to match the original docs
Opened by emibaylor (closed)

- adds pearsonr metric card
- adds ability to return p-value
    - p-value was mentioned in the original docs as a return value, but there was no option to return it. I updated the _compute function slightly to have an option to return the p-value.

Comments:
_The documentation is not available anymore as the PR was closed or merged._

thank you @lhoestq!! :hugs:
Fix description links in dataset cards
Opened by albertvillanova (closed)

I noticed many links were not properly displayed (only text, no link) on the Hub because of wrong syntax, e.g.: https://huggingface.co/datasets/big_patent

This PR fixes all description links in dataset cards.

Comments:
_The documentation is not available anymore as the PR was closed or merged._

Non passing tests are due to other pre-existing errors in dataset cards: not related to this PR.
Dictionary Feature
Opened by jordiae (closed)

Hi, I'm trying to create the loading script for a dataset in which one feature is a list of dictionaries, which afaik doesn't fit very well the values and structures supported by Value and Sequence. Is there any suggested workaround, am I missing something?

Thank you in advance.

Comments:
Hi @jordiae,

Instead of the `Sequence` feature, you can use just a regular list: put the dict between `[` and `]`:
```python
"list_of_dict_feature": [
    {
        "key1_in_dict": datasets.Value("string"),
        "key2_in_dict": datasets.Value("int32"),
        ...
    }
],
```

Feel free to re-open this issue if that does not work for your use case.

> Hi @jordiae,
> 
> Instead of the `Sequence` feature, you can use just a regular list: put the dict between `[` and `]`:
> 
> ```python
> "list_of_dict_feature": [
>     {
>         "key1_in_dict": datasets.Value("string"),
>         "key2_in_dict": datasets.Value("int32"),
>         ...
>     }
> ],
> ```
> 
> Feel free to re-open this issue if that does not work for your use case.

Thank you
Altered faiss installation comment
Opened by vishalsrao (closed)


Comments:
_The documentation is not available anymore as the PR was closed or merged._

Hi ! Can you explain why this change is needed ?

Facebook recommends installing FAISS using conda (https://github.com/facebookresearch/faiss/blob/main/INSTALL.md). pip does not seem to have the latest version of FAISS. The latest version of faiss is 1.7.2 (https://anaconda.org/conda-forge/faiss), but the latest one available through pip is 1.5.3 (https://pypi.org/project/faiss/).
Big_Patent dataset broken
Opened by Matthew-Larsen (closed)

## Dataset viewer issue for '*big_patent*'

**Link:** *[link to the dataset viewer page](https://huggingface.co/datasets/big_patent/viewer/all/train)*

*Unable to view because it says FileNotFound, also cannot download it through the python API*

Am I the one who added this dataset ? No


Comments:
Thanks for reporting. The issue seems not to be directly related to the dataset viewer or the `datasets` library, but instead to it being hosted on Google Drive.

See related issues: https://github.com/huggingface/datasets/issues?q=is%3Aissue+is%3Aopen+drive.google.com

To quote [@lhoestq](https://github.com/huggingface/datasets/issues/4075#issuecomment-1087362551):

> PS: if possible, please try to not use Google Drive links in your dataset script, since Google Drive has download quotas and is not always reliable.



We should find out if the dataset license allows redistribution and contact the data owners to propose them to host their data on our Hub.

The data owners have agreed on hosting their data on the Hub.
Avoid recursion error in map if example is returned as dict value
Opened by mariosasko (closed)

I noticed this bug while answering [this question](https://discuss.huggingface.co/t/correct-way-to-create-a-dataset-from-a-csv-file/15686/11?u=mariosasko). 

This code replicates the bug:
```python
from datasets import Dataset
dset = Dataset.from_dict({"en": ["aa", "bb"], "fr": ["cc", "dd"]})
dset.map(lambda ex: {"translation": ex})
```
and this is the fix for it (before this PR):
```python
from datasets import Dataset
dset = Dataset.from_dict({"en": ["aa", "bb"], "fr": ["cc", "dd"]})
dset.map(lambda ex: {"translation": dict(ex)})
```

Internally, this can be fixed by merging two dicts via dict unpacking (instead of `dict.update) `in `Dataset.map`, which avoids creating recursive dictionaries.

P.S. `{**a, **b}` is slightly more performant than `a.update(b)` in my bencmarks.

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Skip checksum computation in Imagefolder by default
Opened by mariosasko (closed)

Avoids having to set `ignore_verifications=True` in `load_dataset("imagefolder", ...)` to skip checksum verification and speed up loading.

The user can still pass `DownloadConfig(record_checksums=True)` to not skip this part. 

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Add Recall Metric Card
Opened by emibaylor (closed)

What this PR mainly does:
- add metric card for recall metric
- update docs in recall python file

Note: I've also included a .json file with all of the metric card information. I've started compiling the relevant information in this type of .json files, and then using a script I wrote to generate the formatted metric card, as well as the docs to go in the .py file. I figured I'd upload the .json because it could be useful, especially if I also make a PR with the script I'm using (let me know if that's something you think would be beneficial!)

Comments:
_The documentation is not available anymore as the PR was closed or merged._

This looks good to me!
Add Precision Metric Card
Opened by emibaylor (closed)

What this PR mainly does:
- add metric card for precision metric
- update docs in precision python file

Note: I've also included a .json file with all of the metric card information. I've started compiling the relevant information in this type of .json files, and then using a script I wrote to generate the formatted metric card, as well as the docs to go in the .py file. I figured I'd upload the .json because it could be useful, especially if I also make a PR with the script I'm using (let me know if that's something you think would be beneficial!)

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Update GH template for dataset viewer issues
Opened by albertvillanova (closed)

Update template to use new issue forms instead.

With this PR we can check if this new feature is useful for us.

Once validated, we can update the other templates.

CC: @severo 

Comments:
_The documentation is not available anymore as the PR was closed or merged._

You can see rendering at: https://github.com/huggingface/datasets/blob/6b48fedbdafe12a42c7b6edcecc32820af1a4822/.github/ISSUE_TEMPLATE/dataset-viewer.yml
Add remove_columns=True
Opened by thomasw21 (closed)

This should fix all the issue we have with in place operations in mapping functions. This is crucial as where we do some weird things like:
```
def apply(batch):
    batch_size = len(batch["id"])
    batch["text"] = ["potato" for _ range(batch_size)]
    return {}

# Columns are: {"id": int}
dset.map(apply, batched=True, remove_columns="text") # crashes because `text` is not in the original columns
dset.map(apply, batched=True) # mapped datasets has `text` column
```

In this PR we suggest to have `remove_columns=True` so that we ignore the input completely, and just use the output to generate mapped dataset. This means that inplace operations won't have any effects anymore.

Comments:
_The documentation is not available anymore as the PR was closed or merged._

Any reason why we can't just do `[inputs.copy()]` in this line for in-place operations to not have effects anymore:
https://github.com/huggingface/datasets/blob/bf432011ff9155a5bc16c03956bc63e514baf80d/src/datasets/arrow_dataset.py#L2232.

(in the `batched` case, we can also copy the inputs' values (list objects) to ignore in-place modifications to the inputs' columns)

I think `remove_columns=True` has no meaning, so I'm not a fan of this change.

@mariosasko copy does have a cost associated with it ... and plus you'll have to consider `deepcopy` Imagine columnds that are list of list of list of list .... Though I have to agree that `remove_columns=True` doesn't make sense (but, IMO, neither does it in its current use-case as it should refer to `input_columns`) 

Okay closing this PR for the following reasons:
 - `remove_columns=True` was expected to keep the `.update`-like operator for `.map`. I initially thought it would be a good way to ignore function side effects and only keep output of that function (cf. PR description).
 - expected `remove_columns=True` is a bad API according to @mariosasko and introduces unecessary changes for little gain (strictly equivalent to `remove_columns=dset.column_names`)
Embed image and audio files in `save_to_disk`
Opened by lhoestq (closed)

Following https://github.com/huggingface/datasets/pull/4184, currently a dataset saved using `save_to_disk` doesn't actually contain the bytes of the image or audio files. Instead it stores the path to your local files. 

Adding `embed_external_files` and set it to True by default to save_to_disk would be kind of a breaking change since some users will get bigger Arrow files when updating the lib, but the advantages are nice:

- the resulting dataset is self contained, in case you want to delete your cache for example or share it with someone else
- users also upload these Arrow files to cloud storage via the fs parameter, and in this case they would expect to upload a self-contained dataset
- consistency with push_to_hub

This can be implemented at the same time as sharding for `save_to_disk` for efficiency, and reuse the helpers from `push_to_hub` to embed the external files.

cc @mariosasko 

Comments:
Document save_to_disk and push_to_hub on images and audio files
Opened by lhoestq (closed)

Following https://github.com/huggingface/datasets/pull/4187, I explained in the documentation of `save_to_disk` and `push_to_hub` how they handle image and audio data.

Comments:
_The documentation is not available anymore as the PR was closed or merged._

Good catch, I updated the docstrings
Deprecate `shard_size` in `push_to_hub` in favor of `max_shard_size`
Opened by mariosasko (closed)

This PR adds a `max_shard_size` param to `push_to_hub` and deprecates `shard_size` in favor of this new param to have a more descriptive name (a shard has at most the `shard_size` bytes in `push_to_hub`) for the param and to align the API with [Transformers](https://github.com/huggingface/transformers/blob/ff06b177917384137af2d9585697d2d76c40cdfc/src/transformers/modeling_utils.py#L1350).


Comments:
_The documentation is not available anymore as the PR was closed or merged._