html_url
stringlengths
48
51
title
stringlengths
5
155
comments
stringlengths
63
15.7k
body
stringlengths
0
17.7k
comment_length
int64
16
949
text
stringlengths
164
23.7k
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
I like this feature! I think the first question we should decide on is how to convert all datasets into the same format. In T5, the authors decided to format every dataset into a text-to-text format. If the dataset had "multiple" inputs like MNLI, the inputs were concatenated. So in MNLI the input: > - **Hypothesis**: The St. Louis Cardinals have always won. > > - **Premise**: yeah well losing is i mean i’m i’m originally from Saint Louis and Saint Louis Cardinals when they were there were uh a mostly a losing team but was flattened to a single input: > mnli hypothesis: The St. Louis Cardinals have always won. premise: > yeah well losing is i mean i’m i’m originally from Saint Louis and Saint Louis Cardinals > when they were there were uh a mostly a losing team but. This flattening is actually a very simple operation in `nlp` already. You would just need to do the following: ```python def flatten_inputs(example): return {"input": "mnli hypothesis: " + example['hypothesis'] + " premise: " + example['premise']} t5_ready_mnli_ds = mnli_ds.map(flatten_inputs, remove_columns=[<all columns except output>]) ``` So I guess converting the datasets into the same format can be left to the user for now. Then the question is how we can merge the datasets. I would probably be in favor of a simple ```python dataset.add() ``` function that checks if the dataset is of the same format and if yes merges the two datasets. Finally, how should the sampling be implemented? **Examples-proportional mixing** corresponds to just merging the datasets and shuffling. For the other two sampling approaches we would need some higher-level features, maybe even a `dataset.sample()` function for merged datasets. What are your thoughts on this @thomwolf @lhoestq @ghomasHudson @enzoampil ?
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
291
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. I like this feature! I think the first question we should decide on is how to convert all datasets into the same format. In T5, the authors decided to format every dataset into a text-to-text format. If the dataset had "multiple" inputs like MNLI, the inputs were concatenated. So in MNLI the input: > - **Hypothesis**: The St. Louis Cardinals have always won. > > - **Premise**: yeah well losing is i mean i’m i’m originally from Saint Louis and Saint Louis Cardinals when they were there were uh a mostly a losing team but was flattened to a single input: > mnli hypothesis: The St. Louis Cardinals have always won. premise: > yeah well losing is i mean i’m i’m originally from Saint Louis and Saint Louis Cardinals > when they were there were uh a mostly a losing team but. This flattening is actually a very simple operation in `nlp` already. You would just need to do the following: ```python def flatten_inputs(example): return {"input": "mnli hypothesis: " + example['hypothesis'] + " premise: " + example['premise']} t5_ready_mnli_ds = mnli_ds.map(flatten_inputs, remove_columns=[<all columns except output>]) ``` So I guess converting the datasets into the same format can be left to the user for now. Then the question is how we can merge the datasets. I would probably be in favor of a simple ```python dataset.add() ``` function that checks if the dataset is of the same format and if yes merges the two datasets. Finally, how should the sampling be implemented? **Examples-proportional mixing** corresponds to just merging the datasets and shuffling. For the other two sampling approaches we would need some higher-level features, maybe even a `dataset.sample()` function for merged datasets. What are your thoughts on this @thomwolf @lhoestq @ghomasHudson @enzoampil ?
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
I agree that we should leave the flattening of the dataset to the user for now. Especially because although the T5 framing seems obvious, there are slight variations on how the T5 authors do it in comparison to other approaches such as gpt-3 and decaNLP. In terms of sampling, Examples-proportional mixing does seem the simplest to implement so would probably be a good starting point. Temperature-scaled mixing would probably most useful, offering flexibility as it can simulate the other 2 methods by setting the temperature parameter. There is a [relevant part of the T5 repo](https://github.com/google-research/text-to-text-transfer-transformer/blob/03c94165a7d52e4f7230e5944a0541d8c5710788/t5/data/utils.py#L889-L1118) which should help with implementation. According to the T5 authors, equal-mixing performs worst. Among the other two methods, tuning the K value (the artificial dataset size limit) has a large impact.
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
126
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. I agree that we should leave the flattening of the dataset to the user for now. Especially because although the T5 framing seems obvious, there are slight variations on how the T5 authors do it in comparison to other approaches such as gpt-3 and decaNLP. In terms of sampling, Examples-proportional mixing does seem the simplest to implement so would probably be a good starting point. Temperature-scaled mixing would probably most useful, offering flexibility as it can simulate the other 2 methods by setting the temperature parameter. There is a [relevant part of the T5 repo](https://github.com/google-research/text-to-text-transfer-transformer/blob/03c94165a7d52e4f7230e5944a0541d8c5710788/t5/data/utils.py#L889-L1118) which should help with implementation. According to the T5 authors, equal-mixing performs worst. Among the other two methods, tuning the K value (the artificial dataset size limit) has a large impact.
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
I agree with going with temperature-scaled mixing for its flexibility! For the function that combines the datasets, I also find `dataset.add()` okay while also considering that users may want it to be easy to combine a list of say 10 data sources in one go. `dataset.sample()` should also be good. By the looks of it, we're planning to have as main parameters: `temperature`, and `K`. On converting the datasets to the same format, I agree that we can leave these to the users for now. But, I do imagine it'd be an awesome feature for the future to have this automatically handled, based on a chosen *approach* to formatting :smile: E.g. T5, GPT-3, decaNLP, original raw formatting, or a contributed way of formatting in text-to-text.
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
125
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. I agree with going with temperature-scaled mixing for its flexibility! For the function that combines the datasets, I also find `dataset.add()` okay while also considering that users may want it to be easy to combine a list of say 10 data sources in one go. `dataset.sample()` should also be good. By the looks of it, we're planning to have as main parameters: `temperature`, and `K`. On converting the datasets to the same format, I agree that we can leave these to the users for now. But, I do imagine it'd be an awesome feature for the future to have this automatically handled, based on a chosen *approach* to formatting :smile: E.g. T5, GPT-3, decaNLP, original raw formatting, or a contributed way of formatting in text-to-text.
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
This is an interesting discussion indeed and it would be nice to make multi-task easier. Probably the best would be to have a new type of dataset especially designed for that in order to easily combine and sample from the multiple datasets. This way we could probably handle the combination of datasets with differing schemas as well (unlike T5).
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
59
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. This is an interesting discussion indeed and it would be nice to make multi-task easier. Probably the best would be to have a new type of dataset especially designed for that in order to easily combine and sample from the multiple datasets. This way we could probably handle the combination of datasets with differing schemas as well (unlike T5).
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
@thomwolf Are you suggesting making a wrapper class which can take existing datasets as arguments and do all the required sampling/combining, to present the same interface as a normal dataset? That doesn't seem too complicated to implement.
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
37
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. @thomwolf Are you suggesting making a wrapper class which can take existing datasets as arguments and do all the required sampling/combining, to present the same interface as a normal dataset? That doesn't seem too complicated to implement.
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
I guess we're looking at the end user writing something like: ``` python ds = nlp.load_dataset('multitask-t5',datasets=["squad","cnn_dm",...], k=1000, t=2.0) ``` Using the t5 method of combining here (or this could be a function passed in as an arg) Passing kwargs to each 'sub-dataset' might become tricky.
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
45
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. I guess we're looking at the end user writing something like: ``` python ds = nlp.load_dataset('multitask-t5',datasets=["squad","cnn_dm",...], k=1000, t=2.0) ``` Using the t5 method of combining here (or this could be a function passed in as an arg) Passing kwargs to each 'sub-dataset' might become tricky.
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
From thinking upon @thomwolf 's suggestion, I've started experimenting: ```python class MultitaskDataset(DatasetBuilder): def __init__(self, *args, **kwargs): super(MultitaskDataset, self).__init__(*args, **kwargs) self._datasets = kwargs.get("datasets") def _info(self): return nlp.DatasetInfo( description=_DESCRIPTION, features=nlp.Features({ "source": nlp.Value("string"), "target": nlp.Sequence(nlp.Value("string")) }) ) def _get_common_splits(self): '''Finds the common splits present in all self._datasets''' min_set = None for dataset in self._datasets: if min_set != None: min_set.intersection(set(dataset.keys())) else: min_set = set(dataset.keys()) return min_set .... # Maybe this?: squad = nlp.load_dataset("squad") cnn_dm = nlp.load_dataset("cnn_dailymail","3.0.0") multitask_dataset = nlp.load_dataset( 'multitask_dataset', datasets=[squad,cnn_dailymail], k=1000, t=2.0 ) ``` Does anyone know what methods of `MultitaskDataset` I would need to implement? Maybe `as_dataset` and `download_and_prepare`? Most of these should be just calling the methods of the sub-datasets. I'm assuming DatasetBuilder is better than the more specific `GeneratorBasedBuilder`, `BeamBasedBuilder`, etc.... One of the other problems is that the dataset size is unknown till you construct it (as you can pick the sub-datasets). Am hoping not to need to make changes to `nlp.load_dataset` just for this class. I'd appreciate it if anyone more familiar with nlp's internal workings could tell me if I'm on the right track!
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
177
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. From thinking upon @thomwolf 's suggestion, I've started experimenting: ```python class MultitaskDataset(DatasetBuilder): def __init__(self, *args, **kwargs): super(MultitaskDataset, self).__init__(*args, **kwargs) self._datasets = kwargs.get("datasets") def _info(self): return nlp.DatasetInfo( description=_DESCRIPTION, features=nlp.Features({ "source": nlp.Value("string"), "target": nlp.Sequence(nlp.Value("string")) }) ) def _get_common_splits(self): '''Finds the common splits present in all self._datasets''' min_set = None for dataset in self._datasets: if min_set != None: min_set.intersection(set(dataset.keys())) else: min_set = set(dataset.keys()) return min_set .... # Maybe this?: squad = nlp.load_dataset("squad") cnn_dm = nlp.load_dataset("cnn_dailymail","3.0.0") multitask_dataset = nlp.load_dataset( 'multitask_dataset', datasets=[squad,cnn_dailymail], k=1000, t=2.0 ) ``` Does anyone know what methods of `MultitaskDataset` I would need to implement? Maybe `as_dataset` and `download_and_prepare`? Most of these should be just calling the methods of the sub-datasets. I'm assuming DatasetBuilder is better than the more specific `GeneratorBasedBuilder`, `BeamBasedBuilder`, etc.... One of the other problems is that the dataset size is unknown till you construct it (as you can pick the sub-datasets). Am hoping not to need to make changes to `nlp.load_dataset` just for this class. I'd appreciate it if anyone more familiar with nlp's internal workings could tell me if I'm on the right track!
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
I think I would probably go for a `MultiDataset` wrapper around a list of `Dataset`. I'm not sure we need to give it `k` and `t` parameters at creation, it can maybe be something along the lines of: ```python squad = nlp.load_dataset("squad") cnn_dm = nlp.load_dataset("cnn_dailymail","3.0.0") multitask_dataset = nlp.MultiDataset(squad, cnn_dm) batch = multitask_dataset.sample(10, temperature=2.0, k=1000) ``` The first proof-of-concept for multi-task datasets could definitely require that the provided datasets have the same name/type for columns (if needed you easily rename/cast a column prior to instantiating the `MultiDataset`). It's good to think about it for some time though and don't overfit too much on the T5 examples (in particular for the ways/kwargs for sampling among datasets).
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
114
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. I think I would probably go for a `MultiDataset` wrapper around a list of `Dataset`. I'm not sure we need to give it `k` and `t` parameters at creation, it can maybe be something along the lines of: ```python squad = nlp.load_dataset("squad") cnn_dm = nlp.load_dataset("cnn_dailymail","3.0.0") multitask_dataset = nlp.MultiDataset(squad, cnn_dm) batch = multitask_dataset.sample(10, temperature=2.0, k=1000) ``` The first proof-of-concept for multi-task datasets could definitely require that the provided datasets have the same name/type for columns (if needed you easily rename/cast a column prior to instantiating the `MultiDataset`). It's good to think about it for some time though and don't overfit too much on the T5 examples (in particular for the ways/kwargs for sampling among datasets).
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
The problem with changing `k` and `t` per sampling is that you'd have to somehow remember which examples you'd already returned while re-weighting the remaining examples based on the new `k` and `t`values. It seems possible but complicated (I can't really see a reason why you'd want to change the weighting of datasets after you constructed the multidataset). Wouldn't it be convenient if it implemented the dataset interface? Then if someone has code using a single nlp dataset, they can replace it with a multitask combination of more datasets without having to change other code. We would at least need to be able to pass it into a `DataLoader`.
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
109
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. The problem with changing `k` and `t` per sampling is that you'd have to somehow remember which examples you'd already returned while re-weighting the remaining examples based on the new `k` and `t`values. It seems possible but complicated (I can't really see a reason why you'd want to change the weighting of datasets after you constructed the multidataset). Wouldn't it be convenient if it implemented the dataset interface? Then if someone has code using a single nlp dataset, they can replace it with a multitask combination of more datasets without having to change other code. We would at least need to be able to pass it into a `DataLoader`.
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
A very janky (but working) implementation of `multitask_dataset.sample()` could be something like this: ```python import nlp import torch class MultiDataset(): def __init__(self, *args, temperature=2.0, k=1000, maximum=None, scale=1): self.datasets = args self._dataloaders = {} for split in self._get_common_splits(): split_datasets = [ds[split] for ds in self.datasets] mixing_rates = self._calc_mixing_rates(split_datasets,temperature, k, maximum, scale) weights = [] for i in range(len(self.datasets)): weights += [mixing_rates[i]]*len(self.datasets[i][split]) self._dataloaders[split] = torch.utils.data.DataLoader(torch.utils.data.ConcatDataset(split_datasets), sampler=torch.utils.data.sampler.WeightedRandomSampler( num_samples=len(weights), weights = weights, replacement=True), shuffle=False) def _get_common_splits(self): '''Finds the common splits present in all self.datasets''' min_set = None for dataset in self.datasets: if min_set != None: min_set.intersection(set(dataset.keys())) else: min_set = set(dataset.keys()) return min_set def _calc_mixing_rates(self,datasets, temperature=2.0, k=1000, maximum=None, scale=1): '''Work out the weighting of each dataset based on t and k''' mixing_rates = [] for dataset in datasets: rate = len(dataset) rate *= scale if maximum: rate = min(rate, maximum) if temperature != 1.0: rate = rate ** (1.0/temperature) mixing_rates.append(rate) return mixing_rates def sample(self,n,split): batch = [] for example in self._dataloaders[split]: batch.append(example) n -= 1 if n == 0: return batch def flatten(dataset,flatten_fn): for k in dataset.keys(): if isinstance(dataset[k],nlp.Dataset): dataset[k] = dataset[k].map(flatten_fn,remove_columns=dataset[k].column_names) # Squad def flatten_squad(example): return {"source": "squad context: " + example['context'] + " question: " + example['question'],"target":example["answers"]["text"]} squad = nlp.load_dataset("squad") flatten(squad,flatten_squad) # CNN_DM def flatten_cnn_dm(example): return {"source": "cnn_dm: " + example['article'],"target":[example["highlights"]]} cnn_dm = nlp.load_dataset("cnn_dailymail", "3.0.0") flatten(cnn_dm,flatten_cnn_dm) multitask_dataset = MultiDataset(squad, cnn_dm) batch = multitask_dataset.sample(100,"train") ``` There's definitely a more sensible way than embedding `DataLoader`s inside.
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
231
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. A very janky (but working) implementation of `multitask_dataset.sample()` could be something like this: ```python import nlp import torch class MultiDataset(): def __init__(self, *args, temperature=2.0, k=1000, maximum=None, scale=1): self.datasets = args self._dataloaders = {} for split in self._get_common_splits(): split_datasets = [ds[split] for ds in self.datasets] mixing_rates = self._calc_mixing_rates(split_datasets,temperature, k, maximum, scale) weights = [] for i in range(len(self.datasets)): weights += [mixing_rates[i]]*len(self.datasets[i][split]) self._dataloaders[split] = torch.utils.data.DataLoader(torch.utils.data.ConcatDataset(split_datasets), sampler=torch.utils.data.sampler.WeightedRandomSampler( num_samples=len(weights), weights = weights, replacement=True), shuffle=False) def _get_common_splits(self): '''Finds the common splits present in all self.datasets''' min_set = None for dataset in self.datasets: if min_set != None: min_set.intersection(set(dataset.keys())) else: min_set = set(dataset.keys()) return min_set def _calc_mixing_rates(self,datasets, temperature=2.0, k=1000, maximum=None, scale=1): '''Work out the weighting of each dataset based on t and k''' mixing_rates = [] for dataset in datasets: rate = len(dataset) rate *= scale if maximum: rate = min(rate, maximum) if temperature != 1.0: rate = rate ** (1.0/temperature) mixing_rates.append(rate) return mixing_rates def sample(self,n,split): batch = [] for example in self._dataloaders[split]: batch.append(example) n -= 1 if n == 0: return batch def flatten(dataset,flatten_fn): for k in dataset.keys(): if isinstance(dataset[k],nlp.Dataset): dataset[k] = dataset[k].map(flatten_fn,remove_columns=dataset[k].column_names) # Squad def flatten_squad(example): return {"source": "squad context: " + example['context'] + " question: " + example['question'],"target":example["answers"]["text"]} squad = nlp.load_dataset("squad") flatten(squad,flatten_squad) # CNN_DM def flatten_cnn_dm(example): return {"source": "cnn_dm: " + example['article'],"target":[example["highlights"]]} cnn_dm = nlp.load_dataset("cnn_dailymail", "3.0.0") flatten(cnn_dm,flatten_cnn_dm) multitask_dataset = MultiDataset(squad, cnn_dm) batch = multitask_dataset.sample(100,"train") ``` There's definitely a more sensible way than embedding `DataLoader`s inside.
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
Good spot! Here are my thoughts: - Aside: Adding `MultitaskModel` to transformers might be a thing to raise - even though having task-specific heads has become unfashionable in recent times in favour of text-to-text type models. - Adding the task name as an extra field also seems useful for these kind of models which have task-specific heads - There is some validation of our approach that the user should be expected to `map` datasets into a common form. - The size-proportional sampling (also called "Examples-proportional mixing") used here doesn't perform too badly in the T5 paper (it's comparable to temperature-scaled mixing in many cases but less flexible. This is only reasonable with a `K` maximum size parameter to prevent very large datasets dominating). This might be good for a first prototype using: ```python def __iter__(self): """ For each batch, sample a task, and yield a batch from the respective task Dataloader. We use size-proportional sampling, but you could easily modify this to sample from some-other distribution. """ task_choice_list = [] for i, task_name in enumerate(self.task_name_list): task_choice_list += [i] * self.num_batches_dict[task_name] task_choice_list = np.array(task_choice_list) np.random.shuffle(task_choice_list) dataloader_iter_dict = { task_name: iter(dataloader) for task_name, dataloader in self.dataloader_dict.items() } for task_choice in task_choice_list: task_name = self.task_name_list[task_choice] yield next(dataloader_iter_dict[task_name]) ``` We'd just need to pull samples from the raw datasets and not from `DataLoader`s for each task. We can assume the user has done `dataset.shuffle()` if they want to. Other sampling methods can later be implemented by changing how the `task_choice_list` is generated. This should allow more flexibility and not tie us to specific methods for sampling among datasets.
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
264
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. Good spot! Here are my thoughts: - Aside: Adding `MultitaskModel` to transformers might be a thing to raise - even though having task-specific heads has become unfashionable in recent times in favour of text-to-text type models. - Adding the task name as an extra field also seems useful for these kind of models which have task-specific heads - There is some validation of our approach that the user should be expected to `map` datasets into a common form. - The size-proportional sampling (also called "Examples-proportional mixing") used here doesn't perform too badly in the T5 paper (it's comparable to temperature-scaled mixing in many cases but less flexible. This is only reasonable with a `K` maximum size parameter to prevent very large datasets dominating). This might be good for a first prototype using: ```python def __iter__(self): """ For each batch, sample a task, and yield a batch from the respective task Dataloader. We use size-proportional sampling, but you could easily modify this to sample from some-other distribution. """ task_choice_list = [] for i, task_name in enumerate(self.task_name_list): task_choice_list += [i] * self.num_batches_dict[task_name] task_choice_list = np.array(task_choice_list) np.random.shuffle(task_choice_list) dataloader_iter_dict = { task_name: iter(dataloader) for task_name, dataloader in self.dataloader_dict.items() } for task_choice in task_choice_list: task_name = self.task_name_list[task_choice] yield next(dataloader_iter_dict[task_name]) ``` We'd just need to pull samples from the raw datasets and not from `DataLoader`s for each task. We can assume the user has done `dataset.shuffle()` if they want to. Other sampling methods can later be implemented by changing how the `task_choice_list` is generated. This should allow more flexibility and not tie us to specific methods for sampling among datasets.
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
Another thought: Multitasking over benchmarks (represented as Meta-datasets in nlp) is probably a common use case. Would be nice to pass an entire benchmark to our `MultiDataset` wrapper rather than having to pass individual components.
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
35
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. Another thought: Multitasking over benchmarks (represented as Meta-datasets in nlp) is probably a common use case. Would be nice to pass an entire benchmark to our `MultiDataset` wrapper rather than having to pass individual components.
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
Here's a fully working implementation based on the `__iter__` function of @zphang. - I've generated the task choice list in the constructor as it allows us to index into the MultiDataset just like a normal dataset. I'm changing `task_choice_list` into a list of `(dataset_idx, example_idx)` so each entry references a unique dataset example. The shuffling has to be done before this as we don't want to shuffle within each task (we assume this is done by the user if this is what they intend). - I'm slightly concerned this list could become very large if many large datasets were used. Can't see a way round it at the moment though. - I've used `task.info.builder_name` as the dataset name. Not sure if this is correct. - I'd love to add some of the other `Dataset` methods (map, slicing by column, etc...). Would be great to implement the whole interface so a single dataset can be simply replaced by this. - This does everything on the individual example-level. If some application required batches all from a single task in turn we can't really do that. ```python import nlp import numpy as np class MultiDataset: def __init__(self,tasks): self.tasks = tasks # Create random order of tasks # Using size-proportional sampling task_choice_list = [] for i, task in enumerate(self.tasks): task_choice_list += [i] * len(task) task_choice_list = np.array(task_choice_list) np.random.shuffle(task_choice_list) # Add index into each dataset # - We don't want to shuffle within each task counters = {} self.task_choice_list = [] for i in range(len(task_choice_list)): idx = counters.get(task_choice_list[i],0) self.task_choice_list.append((task_choice_list[i],idx)) counters[task_choice_list[i]] = idx + 1 def __len__(self): return np.sum([len(t) for t in self.tasks]) def __repr__(self): task_str = ", ".join([str(t) for t in self.tasks]) return f"MultiDataset(tasks: {task_str})" def __getitem__(self,key): if isinstance(key, int): task_idx, example_idx = self.task_choice_list[key] task = self.tasks[task_idx] example = task[example_idx] example["task_name"] = task.info.builder_name return example elif isinstance(key, slice): raise NotImplementedError() def __iter__(self): for i in range(len(self)): yield self[i] def load_multitask(*datasets): '''Create multitask datasets per split''' def _get_common_splits(datasets): '''Finds the common splits present in all self.datasets''' min_set = None for dataset in datasets: if min_set != None: min_set.intersection(set(dataset.keys())) else: min_set = set(dataset.keys()) return min_set common_splits = _get_common_splits(datasets) out = {} for split in common_splits: out[split] = MultiDataset([d[split] for d in datasets]) return out ########################################## # Dataset Flattening def flatten(dataset,flatten_fn): for k in dataset.keys(): if isinstance(dataset[k],nlp.Dataset): dataset[k] = dataset[k].map(flatten_fn,remove_columns=dataset[k].column_names) # Squad def flatten_squad(example): return {"source": "squad context: " + example['context'] + " question: " + example['question'], "target":example["answers"]["text"]} squad = nlp.load_dataset("squad") flatten(squad,flatten_squad) # CNN_DM def flatten_cnn_dm(example): return {"source": "cnn_dm: " + example['article'],"target":[example["highlights"]]} cnn_dm = nlp.load_dataset("cnn_dailymail", "3.0.0") flatten(cnn_dm,flatten_cnn_dm) ############################################# mtds = load_multitask(squad,cnn_dm) for example in mtds["train"]: print(example["task_name"],example["target"]) ``` Let me know if you have any thoughts. I've started using this in some of my projects and it seems to work. If people are happy with the general approach for a first version, I can make a pull request.
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
469
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. Here's a fully working implementation based on the `__iter__` function of @zphang. - I've generated the task choice list in the constructor as it allows us to index into the MultiDataset just like a normal dataset. I'm changing `task_choice_list` into a list of `(dataset_idx, example_idx)` so each entry references a unique dataset example. The shuffling has to be done before this as we don't want to shuffle within each task (we assume this is done by the user if this is what they intend). - I'm slightly concerned this list could become very large if many large datasets were used. Can't see a way round it at the moment though. - I've used `task.info.builder_name` as the dataset name. Not sure if this is correct. - I'd love to add some of the other `Dataset` methods (map, slicing by column, etc...). Would be great to implement the whole interface so a single dataset can be simply replaced by this. - This does everything on the individual example-level. If some application required batches all from a single task in turn we can't really do that. ```python import nlp import numpy as np class MultiDataset: def __init__(self,tasks): self.tasks = tasks # Create random order of tasks # Using size-proportional sampling task_choice_list = [] for i, task in enumerate(self.tasks): task_choice_list += [i] * len(task) task_choice_list = np.array(task_choice_list) np.random.shuffle(task_choice_list) # Add index into each dataset # - We don't want to shuffle within each task counters = {} self.task_choice_list = [] for i in range(len(task_choice_list)): idx = counters.get(task_choice_list[i],0) self.task_choice_list.append((task_choice_list[i],idx)) counters[task_choice_list[i]] = idx + 1 def __len__(self): return np.sum([len(t) for t in self.tasks]) def __repr__(self): task_str = ", ".join([str(t) for t in self.tasks]) return f"MultiDataset(tasks: {task_str})" def __getitem__(self,key): if isinstance(key, int): task_idx, example_idx = self.task_choice_list[key] task = self.tasks[task_idx] example = task[example_idx] example["task_name"] = task.info.builder_name return example elif isinstance(key, slice): raise NotImplementedError() def __iter__(self): for i in range(len(self)): yield self[i] def load_multitask(*datasets): '''Create multitask datasets per split''' def _get_common_splits(datasets): '''Finds the common splits present in all self.datasets''' min_set = None for dataset in datasets: if min_set != None: min_set.intersection(set(dataset.keys())) else: min_set = set(dataset.keys()) return min_set common_splits = _get_common_splits(datasets) out = {} for split in common_splits: out[split] = MultiDataset([d[split] for d in datasets]) return out ########################################## # Dataset Flattening def flatten(dataset,flatten_fn): for k in dataset.keys(): if isinstance(dataset[k],nlp.Dataset): dataset[k] = dataset[k].map(flatten_fn,remove_columns=dataset[k].column_names) # Squad def flatten_squad(example): return {"source": "squad context: " + example['context'] + " question: " + example['question'], "target":example["answers"]["text"]} squad = nlp.load_dataset("squad") flatten(squad,flatten_squad) # CNN_DM def flatten_cnn_dm(example): return {"source": "cnn_dm: " + example['article'],"target":[example["highlights"]]} cnn_dm = nlp.load_dataset("cnn_dailymail", "3.0.0") flatten(cnn_dm,flatten_cnn_dm) ############################################# mtds = load_multitask(squad,cnn_dm) for example in mtds["train"]: print(example["task_name"],example["target"]) ``` Let me know if you have any thoughts. I've started using this in some of my projects and it seems to work. If people are happy with the general approach for a first version, I can make a pull request.
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
Hey! Happy to jump into the discussion here. I'm still getting familiar with bits of this code, but the reasons I sampled over data loaders rather than datasets is 1) ensuring that each sampled batch corresponds to only 1 task (in case of different inputs formats/downstream models) and 2) potentially having different batch sizes per task (e.g. some tasks have very long/short inputs). How are you currently dealing with these in your PR?
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
73
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. Hey! Happy to jump into the discussion here. I'm still getting familiar with bits of this code, but the reasons I sampled over data loaders rather than datasets is 1) ensuring that each sampled batch corresponds to only 1 task (in case of different inputs formats/downstream models) and 2) potentially having different batch sizes per task (e.g. some tasks have very long/short inputs). How are you currently dealing with these in your PR?
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
The short answer is - I'm not! Everything is currently on a per-example basis. It would be fairly simple to add a `batch_size` argument which would ensure that every `batch_size` examples come from the same task. That should suit most use-cases (unless you wanted to ensure batches all came from the same task and apply something like `SortishSampler` on each task first) Your notebook was really inspiring by the way - thanks!
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
72
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. The short answer is - I'm not! Everything is currently on a per-example basis. It would be fairly simple to add a `batch_size` argument which would ensure that every `batch_size` examples come from the same task. That should suit most use-cases (unless you wanted to ensure batches all came from the same task and apply something like `SortishSampler` on each task first) Your notebook was really inspiring by the way - thanks!
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
@zphang is having different batch sizes per task actually helpful? Would be interesting to know as it's not something I've come across as a technique used by any MTL papers.
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
30
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. @zphang is having different batch sizes per task actually helpful? Would be interesting to know as it's not something I've come across as a technique used by any MTL papers.
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
> @zphang is having different batch sizes per task actually helpful? Would be interesting to know as it's not something I've come across as a technique used by any MTL papers. I think having different batch sizes per task is particularly helpful in some scenarios where each task has different amount of data. For example, the problem I'm currently facing is one task has tens of thousands of samples while one task has a couple hundreds. I think in this case different batch size could help. But if using the same batch size is a lot simpler to implement, I guess it makes sense to go with that.
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
108
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. > @zphang is having different batch sizes per task actually helpful? Would be interesting to know as it's not something I've come across as a technique used by any MTL papers. I think having different batch sizes per task is particularly helpful in some scenarios where each task has different amount of data. For example, the problem I'm currently facing is one task has tens of thousands of samples while one task has a couple hundreds. I think in this case different batch size could help. But if using the same batch size is a lot simpler to implement, I guess it makes sense to go with that.
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
I think that instead of proportional to size sampling you should specify weights or probabilities for drawing a batch from each dataset. We should also ensure that the smaller datasets are repeated so that the encoder layer doesn't overtrain on the largest dataset.
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
43
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. I think that instead of proportional to size sampling you should specify weights or probabilities for drawing a batch from each dataset. We should also ensure that the smaller datasets are repeated so that the encoder layer doesn't overtrain on the largest dataset.
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
Are there any references for people doing different batch sizes per task in the literature? I've only seen constant batch sizes with differing numbers of batches for each task which seems sufficient to prevent the impact of large datasets (Read 3.5.3 of the [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) for example).
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
47
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. Are there any references for people doing different batch sizes per task in the literature? I've only seen constant batch sizes with differing numbers of batches for each task which seems sufficient to prevent the impact of large datasets (Read 3.5.3 of the [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) for example).
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
Hi, regarding building T5 dataset , I think we can use datasets https://github.com/huggingface/datasets and then need something similar to tf.data.experimental.sample_from_datasets, do you know if similar functionality exist in pytorch? Which can sample multiple datasets with the given rates. thanks.
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
39
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. Hi, regarding building T5 dataset , I think we can use datasets https://github.com/huggingface/datasets and then need something similar to tf.data.experimental.sample_from_datasets, do you know if similar functionality exist in pytorch? Which can sample multiple datasets with the given rates. thanks.
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
> Here's a fully working implementation based on the `__iter__` function of @zphang. > > * I've generated the task choice list in the constructor as it allows us to index into the MultiDataset just like a normal dataset. I'm changing `task_choice_list` into a list of `(dataset_idx, example_idx)` so each entry references a unique dataset example. The shuffling has to be done before this as we don't want to shuffle within each task (we assume this is done by the user if this is what they intend). > * I'm slightly concerned this list could become very large if many large datasets were used. Can't see a way round it at the moment though. > * I've used `task.info.builder_name` as the dataset name. Not sure if this is correct. > * I'd love to add some of the other `Dataset` methods (map, slicing by column, etc...). Would be great to implement the whole interface so a single dataset can be simply replaced by this. > * This does everything on the individual example-level. If some application required batches all from a single task in turn we can't really do that. > > ```python > import nlp > import numpy as np > > class MultiDataset: > def __init__(self,tasks): > self.tasks = tasks > > # Create random order of tasks > # Using size-proportional sampling > task_choice_list = [] > for i, task in enumerate(self.tasks): > task_choice_list += [i] * len(task) > task_choice_list = np.array(task_choice_list) > np.random.shuffle(task_choice_list) > > # Add index into each dataset > # - We don't want to shuffle within each task > counters = {} > self.task_choice_list = [] > for i in range(len(task_choice_list)): > idx = counters.get(task_choice_list[i],0) > self.task_choice_list.append((task_choice_list[i],idx)) > counters[task_choice_list[i]] = idx + 1 > > > def __len__(self): > return np.sum([len(t) for t in self.tasks]) > > def __repr__(self): > task_str = ", ".join([str(t) for t in self.tasks]) > return f"MultiDataset(tasks: {task_str})" > > def __getitem__(self,key): > if isinstance(key, int): > task_idx, example_idx = self.task_choice_list[key] > task = self.tasks[task_idx] > example = task[example_idx] > example["task_name"] = task.info.builder_name > return example > elif isinstance(key, slice): > raise NotImplementedError() > > def __iter__(self): > for i in range(len(self)): > yield self[i] > > > def load_multitask(*datasets): > '''Create multitask datasets per split''' > > def _get_common_splits(datasets): > '''Finds the common splits present in all self.datasets''' > min_set = None > for dataset in datasets: > if min_set != None: > min_set.intersection(set(dataset.keys())) > else: > min_set = set(dataset.keys()) > return min_set > > common_splits = _get_common_splits(datasets) > out = {} > for split in common_splits: > out[split] = MultiDataset([d[split] for d in datasets]) > return out > > > ########################################## > # Dataset Flattening > > def flatten(dataset,flatten_fn): > for k in dataset.keys(): > if isinstance(dataset[k],nlp.Dataset): > dataset[k] = dataset[k].map(flatten_fn,remove_columns=dataset[k].column_names) > > # Squad > def flatten_squad(example): > return {"source": "squad context: " + example['context'] + " question: " + example['question'], > "target":example["answers"]["text"]} > squad = nlp.load_dataset("squad") > flatten(squad,flatten_squad) > > # CNN_DM > def flatten_cnn_dm(example): > return {"source": "cnn_dm: " + example['article'],"target":[example["highlights"]]} > cnn_dm = nlp.load_dataset("cnn_dailymail", "3.0.0") > flatten(cnn_dm,flatten_cnn_dm) > > ############################################# > > mtds = load_multitask(squad,cnn_dm) > > for example in mtds["train"]: > print(example["task_name"],example["target"]) > ``` > > Let me know if you have any thoughts. I've started using this in some of my projects and it seems to work. If people are happy with the general approach for a first version, I can make a pull request. Not sure if this is what I'm looking for, but I implemented a version of Examples-Proportional mixing supporting only the basic feature [here](https://stackoverflow.com/a/74070116/10732321), seems to work in my project.
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
604
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. > Here's a fully working implementation based on the `__iter__` function of @zphang. > > * I've generated the task choice list in the constructor as it allows us to index into the MultiDataset just like a normal dataset. I'm changing `task_choice_list` into a list of `(dataset_idx, example_idx)` so each entry references a unique dataset example. The shuffling has to be done before this as we don't want to shuffle within each task (we assume this is done by the user if this is what they intend). > * I'm slightly concerned this list could become very large if many large datasets were used. Can't see a way round it at the moment though. > * I've used `task.info.builder_name` as the dataset name. Not sure if this is correct. > * I'd love to add some of the other `Dataset` methods (map, slicing by column, etc...). Would be great to implement the whole interface so a single dataset can be simply replaced by this. > * This does everything on the individual example-level. If some application required batches all from a single task in turn we can't really do that. > > ```python > import nlp > import numpy as np > > class MultiDataset: > def __init__(self,tasks): > self.tasks = tasks > > # Create random order of tasks > # Using size-proportional sampling > task_choice_list = [] > for i, task in enumerate(self.tasks): > task_choice_list += [i] * len(task) > task_choice_list = np.array(task_choice_list) > np.random.shuffle(task_choice_list) > > # Add index into each dataset > # - We don't want to shuffle within each task > counters = {} > self.task_choice_list = [] > for i in range(len(task_choice_list)): > idx = counters.get(task_choice_list[i],0) > self.task_choice_list.append((task_choice_list[i],idx)) > counters[task_choice_list[i]] = idx + 1 > > > def __len__(self): > return np.sum([len(t) for t in self.tasks]) > > def __repr__(self): > task_str = ", ".join([str(t) for t in self.tasks]) > return f"MultiDataset(tasks: {task_str})" > > def __getitem__(self,key): > if isinstance(key, int): > task_idx, example_idx = self.task_choice_list[key] > task = self.tasks[task_idx] > example = task[example_idx] > example["task_name"] = task.info.builder_name > return example > elif isinstance(key, slice): > raise NotImplementedError() > > def __iter__(self): > for i in range(len(self)): > yield self[i] > > > def load_multitask(*datasets): > '''Create multitask datasets per split''' > > def _get_common_splits(datasets): > '''Finds the common splits present in all self.datasets''' > min_set = None > for dataset in datasets: > if min_set != None: > min_set.intersection(set(dataset.keys())) > else: > min_set = set(dataset.keys()) > return min_set > > common_splits = _get_common_splits(datasets) > out = {} > for split in common_splits: > out[split] = MultiDataset([d[split] for d in datasets]) > return out > > > ########################################## > # Dataset Flattening > > def flatten(dataset,flatten_fn): > for k in dataset.keys(): > if isinstance(dataset[k],nlp.Dataset): > dataset[k] = dataset[k].map(flatten_fn,remove_columns=dataset[k].column_names) > > # Squad > def flatten_squad(example): > return {"source": "squad context: " + example['context'] + " question: " + example['question'], > "target":example["answers"]["text"]} > squad = nlp.load_dataset("squad") > flatten(squad,flatten_squad) > > # CNN_DM > def flatten_cnn_dm(example): > return {"source": "cnn_dm: " + example['article'],"target":[example["highlights"]]} > cnn_dm = nlp.load_dataset("cnn_dailymail", "3.0.0") > flatten(cnn_dm,flatten_cnn_dm) > > ############################################# > > mtds = load_multitask(squad,cnn_dm) > > for example in mtds["train"]: > print(example["task_name"],example["target"]) > ``` > > Let me know if you have any thoughts. I've started using this in some of my projects and it seems to work. If people are happy with the general approach for a first version, I can make a pull request. Not sure if this is what I'm looking for, but I implemented a version of Examples-Proportional mixing supporting only the basic feature [here](https://stackoverflow.com/a/74070116/10732321), seems to work in my project.
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
You can use `interleave_datasets` to mix several datasets together. By default it alternates between all the datasets, but you can also provide sampling probabilities if you want to oversample from one of the datasets ```python from datasets import load_dataset, interleave_datasets squad = load_dataset("squad", split="train") cnn_dm = load_dataset("cnn_dailymail", "3.0.0", split="train") ds = interleave_datasets([squad, cnn_dm]) print(ds[0]) # {'id': '5733be284776f41900661182', # 'title': 'University_of_Notre_Dame', # 'context': 'Architecturally, the school has a Catholic character...', # 'question': 'To whom did the Virgin Mary allegedly appear in 1858 in Lourdes France?', # 'answers': {'text': ['Saint Bernadette Soubirous'], 'answer_start': [515]}, # 'article': None, # 'highlights': None} print(ds[1]) # {'id': '42c027e4ff9730fbb3de84c1af0d2c506e41c3e4', # 'title': None, # 'context': None, # 'question': None, # 'answers': None, # 'article': 'LONDON, England (Reuters) -- Harry Potter star Daniel Radcliffe...', # 'highlights': "Harry Potter star Daniel Radcliffe..."} ``` see docs at https://huggingface.co/docs/datasets/v2.6.1/en/package_reference/main_classes#datasets.interleave_datasets
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
137
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. You can use `interleave_datasets` to mix several datasets together. By default it alternates between all the datasets, but you can also provide sampling probabilities if you want to oversample from one of the datasets ```python from datasets import load_dataset, interleave_datasets squad = load_dataset("squad", split="train") cnn_dm = load_dataset("cnn_dailymail", "3.0.0", split="train") ds = interleave_datasets([squad, cnn_dm]) print(ds[0]) # {'id': '5733be284776f41900661182', # 'title': 'University_of_Notre_Dame', # 'context': 'Architecturally, the school has a Catholic character...', # 'question': 'To whom did the Virgin Mary allegedly appear in 1858 in Lourdes France?', # 'answers': {'text': ['Saint Bernadette Soubirous'], 'answer_start': [515]}, # 'article': None, # 'highlights': None} print(ds[1]) # {'id': '42c027e4ff9730fbb3de84c1af0d2c506e41c3e4', # 'title': None, # 'context': None, # 'question': None, # 'answers': None, # 'article': 'LONDON, England (Reuters) -- Harry Potter star Daniel Radcliffe...', # 'highlights': "Harry Potter star Daniel Radcliffe..."} ``` see docs at https://huggingface.co/docs/datasets/v2.6.1/en/package_reference/main_classes#datasets.interleave_datasets
https://github.com/huggingface/datasets/issues/217
Multi-task dataset mixing
I also have this implementation of multi-task sampler here which I used it to tune T5: https://github.com/rabeehk/hyperformer/blob/main/hyperformer/data/multitask_sampler.py
It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly.
17
Multi-task dataset mixing It seems like many of the best performing models on the GLUE benchmark make some use of multitask learning (simultaneous training on multiple tasks). The [T5 paper](https://arxiv.org/pdf/1910.10683.pdf) highlights multiple ways of mixing the tasks together during finetuning: - **Examples-proportional mixing** - sample from tasks proportionally to their dataset size - **Equal mixing** - sample uniformly from each task - **Temperature-scaled mixing** - The generalized approach used by multilingual BERT which uses a temperature T, where the mixing rate of each task is raised to the power 1/T and renormalized. When T=1 this is equivalent to equal mixing, and becomes closer to equal mixing with increasing T. Following this discussion https://github.com/huggingface/transformers/issues/4340 in [transformers](https://github.com/huggingface/transformers), @enzoampil suggested that the `nlp` library might be a better place for this functionality. Some method for combining datasets could be implemented ,e.g. ``` dataset = nlp.load_multitask(['squad','imdb','cnn_dm'], temperature=2.0, ...) ``` We would need a few additions: - Method of identifying the tasks - how can we support adding a string to each task as an identifier: e.g. 'summarisation: '? - Method of combining the metrics - a standard approach is to use the specific metric for each task and add them together for a combined score. It would be great to support common use cases such as pretraining on the GLUE benchmark before fine-tuning on each GLUE task in turn. I'm willing to write bits/most of this I just need some guidance on the interface and other library details so I can integrate it properly. I also have this implementation of multi-task sampler here which I used it to tune T5: https://github.com/rabeehk/hyperformer/blob/main/hyperformer/data/multitask_sampler.py
https://github.com/huggingface/datasets/issues/216
❓ How to get ROUGE-2 with the ROUGE metric ?
For the rouge2 metric you can do ```python rouge = nlp.load_metric('rouge') with open("pred.txt") as p, open("ref.txt") as g: for lp, lg in zip(p, g): rouge.add(lp, lg) score = rouge.compute(rouge_types=["rouge2"]) ``` Note that I just did a PR to have both `.add` and `.add_batch` for metrics, that's why now this is `rouge.add(lp, lg)` and not `rouge.add([lp], [lg])`
I'm trying to use ROUGE metric, but I don't know how to get the ROUGE-2 metric. --- I compute scores with : ```python import nlp rouge = nlp.load_metric('rouge') with open("pred.txt") as p, open("ref.txt") as g: for lp, lg in zip(p, g): rouge.add([lp], [lg]) score = rouge.compute() ``` then : _(print only the F-score for readability)_ ```python for k, s in score.items(): print(k, s.mid.fmeasure) ``` It gives : >rouge1 0.7915168355671788 rougeL 0.7915168355671788 --- **How can I get the ROUGE-2 score ?** Also, it's seems weird that ROUGE-1 and ROUGE-L scores are the same. Did I made a mistake ? @lhoestq
56
❓ How to get ROUGE-2 with the ROUGE metric ? I'm trying to use ROUGE metric, but I don't know how to get the ROUGE-2 metric. --- I compute scores with : ```python import nlp rouge = nlp.load_metric('rouge') with open("pred.txt") as p, open("ref.txt") as g: for lp, lg in zip(p, g): rouge.add([lp], [lg]) score = rouge.compute() ``` then : _(print only the F-score for readability)_ ```python for k, s in score.items(): print(k, s.mid.fmeasure) ``` It gives : >rouge1 0.7915168355671788 rougeL 0.7915168355671788 --- **How can I get the ROUGE-2 score ?** Also, it's seems weird that ROUGE-1 and ROUGE-L scores are the same. Did I made a mistake ? @lhoestq For the rouge2 metric you can do ```python rouge = nlp.load_metric('rouge') with open("pred.txt") as p, open("ref.txt") as g: for lp, lg in zip(p, g): rouge.add(lp, lg) score = rouge.compute(rouge_types=["rouge2"]) ``` Note that I just did a PR to have both `.add` and `.add_batch` for metrics, that's why now this is `rouge.add(lp, lg)` and not `rouge.add([lp], [lg])`
https://github.com/huggingface/datasets/issues/216
❓ How to get ROUGE-2 with the ROUGE metric ?
Well I just tested with the official script and both rouge1 and rougeL return exactly the same thing for the input you gave, so this is actually fine ^^ I hope it helped :)
I'm trying to use ROUGE metric, but I don't know how to get the ROUGE-2 metric. --- I compute scores with : ```python import nlp rouge = nlp.load_metric('rouge') with open("pred.txt") as p, open("ref.txt") as g: for lp, lg in zip(p, g): rouge.add([lp], [lg]) score = rouge.compute() ``` then : _(print only the F-score for readability)_ ```python for k, s in score.items(): print(k, s.mid.fmeasure) ``` It gives : >rouge1 0.7915168355671788 rougeL 0.7915168355671788 --- **How can I get the ROUGE-2 score ?** Also, it's seems weird that ROUGE-1 and ROUGE-L scores are the same. Did I made a mistake ? @lhoestq
34
❓ How to get ROUGE-2 with the ROUGE metric ? I'm trying to use ROUGE metric, but I don't know how to get the ROUGE-2 metric. --- I compute scores with : ```python import nlp rouge = nlp.load_metric('rouge') with open("pred.txt") as p, open("ref.txt") as g: for lp, lg in zip(p, g): rouge.add([lp], [lg]) score = rouge.compute() ``` then : _(print only the F-score for readability)_ ```python for k, s in score.items(): print(k, s.mid.fmeasure) ``` It gives : >rouge1 0.7915168355671788 rougeL 0.7915168355671788 --- **How can I get the ROUGE-2 score ?** Also, it's seems weird that ROUGE-1 and ROUGE-L scores are the same. Did I made a mistake ? @lhoestq Well I just tested with the official script and both rouge1 and rougeL return exactly the same thing for the input you gave, so this is actually fine ^^ I hope it helped :)
https://github.com/huggingface/datasets/issues/215
NonMatchingSplitsSizesError when loading blog_authorship_corpus
I just ran it on colab and got this ``` [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=611607465, num_examples=533285, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=35652716, num_examples=30804, dataset_name='blog_authorship_corpus')}] ``` which is different from the `dataset_infos.json` and also different from yours. It looks like the script for generating examples is not consistent
Getting this error when i run `nlp.load_dataset('blog_authorship_corpus')`. ``` raise NonMatchingSplitsSizesError(str(bad_splits)) nlp.utils.info_utils.NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=616473500, num_examples=536323, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=30786661, num_examples=27766, dataset_name='blog_authorship_corpus')}] ``` Upon checking it seems like there is a disparity between the information in `datasets/blog_authorship_corpus/dataset_infos.json` and what was downloaded. Although I can get away with this by passing `ignore_verifications=True` in `load_dataset`, I'm thinking doing so might give problems later on.
53
NonMatchingSplitsSizesError when loading blog_authorship_corpus Getting this error when i run `nlp.load_dataset('blog_authorship_corpus')`. ``` raise NonMatchingSplitsSizesError(str(bad_splits)) nlp.utils.info_utils.NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=616473500, num_examples=536323, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=30786661, num_examples=27766, dataset_name='blog_authorship_corpus')}] ``` Upon checking it seems like there is a disparity between the information in `datasets/blog_authorship_corpus/dataset_infos.json` and what was downloaded. Although I can get away with this by passing `ignore_verifications=True` in `load_dataset`, I'm thinking doing so might give problems later on. I just ran it on colab and got this ``` [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=611607465, num_examples=533285, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=35652716, num_examples=30804, dataset_name='blog_authorship_corpus')}] ``` which is different from the `dataset_infos.json` and also different from yours. It looks like the script for generating examples is not consistent
https://github.com/huggingface/datasets/issues/215
NonMatchingSplitsSizesError when loading blog_authorship_corpus
The files provided by the authors are corrupted and the script seems to ignore the xml files that can't be decoded (it does `try:... except UnicodeDecodeError`). Maybe depending of the environment some files can be opened and some others don't but not sure why
Getting this error when i run `nlp.load_dataset('blog_authorship_corpus')`. ``` raise NonMatchingSplitsSizesError(str(bad_splits)) nlp.utils.info_utils.NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=616473500, num_examples=536323, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=30786661, num_examples=27766, dataset_name='blog_authorship_corpus')}] ``` Upon checking it seems like there is a disparity between the information in `datasets/blog_authorship_corpus/dataset_infos.json` and what was downloaded. Although I can get away with this by passing `ignore_verifications=True` in `load_dataset`, I'm thinking doing so might give problems later on.
44
NonMatchingSplitsSizesError when loading blog_authorship_corpus Getting this error when i run `nlp.load_dataset('blog_authorship_corpus')`. ``` raise NonMatchingSplitsSizesError(str(bad_splits)) nlp.utils.info_utils.NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=616473500, num_examples=536323, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=30786661, num_examples=27766, dataset_name='blog_authorship_corpus')}] ``` Upon checking it seems like there is a disparity between the information in `datasets/blog_authorship_corpus/dataset_infos.json` and what was downloaded. Although I can get away with this by passing `ignore_verifications=True` in `load_dataset`, I'm thinking doing so might give problems later on. The files provided by the authors are corrupted and the script seems to ignore the xml files that can't be decoded (it does `try:... except UnicodeDecodeError`). Maybe depending of the environment some files can be opened and some others don't but not sure why
https://github.com/huggingface/datasets/issues/215
NonMatchingSplitsSizesError when loading blog_authorship_corpus
Feel free to do `ignore_verifications=True` for now... The verifications only include a check on the checksums of the downloaded files, and a check on the number of examples in each splits.
Getting this error when i run `nlp.load_dataset('blog_authorship_corpus')`. ``` raise NonMatchingSplitsSizesError(str(bad_splits)) nlp.utils.info_utils.NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=616473500, num_examples=536323, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=30786661, num_examples=27766, dataset_name='blog_authorship_corpus')}] ``` Upon checking it seems like there is a disparity between the information in `datasets/blog_authorship_corpus/dataset_infos.json` and what was downloaded. Although I can get away with this by passing `ignore_verifications=True` in `load_dataset`, I'm thinking doing so might give problems later on.
31
NonMatchingSplitsSizesError when loading blog_authorship_corpus Getting this error when i run `nlp.load_dataset('blog_authorship_corpus')`. ``` raise NonMatchingSplitsSizesError(str(bad_splits)) nlp.utils.info_utils.NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=616473500, num_examples=536323, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=30786661, num_examples=27766, dataset_name='blog_authorship_corpus')}] ``` Upon checking it seems like there is a disparity between the information in `datasets/blog_authorship_corpus/dataset_infos.json` and what was downloaded. Although I can get away with this by passing `ignore_verifications=True` in `load_dataset`, I'm thinking doing so might give problems later on. Feel free to do `ignore_verifications=True` for now... The verifications only include a check on the checksums of the downloaded files, and a check on the number of examples in each splits.
https://github.com/huggingface/datasets/issues/215
NonMatchingSplitsSizesError when loading blog_authorship_corpus
I'm getting this same issue when loading the `imdb` corpus via `dataset = load_dataset("imdb")`. When I try `ignore_verifications=True`, no examples are read into the `train` portion of the dataset.
Getting this error when i run `nlp.load_dataset('blog_authorship_corpus')`. ``` raise NonMatchingSplitsSizesError(str(bad_splits)) nlp.utils.info_utils.NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=616473500, num_examples=536323, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=30786661, num_examples=27766, dataset_name='blog_authorship_corpus')}] ``` Upon checking it seems like there is a disparity between the information in `datasets/blog_authorship_corpus/dataset_infos.json` and what was downloaded. Although I can get away with this by passing `ignore_verifications=True` in `load_dataset`, I'm thinking doing so might give problems later on.
29
NonMatchingSplitsSizesError when loading blog_authorship_corpus Getting this error when i run `nlp.load_dataset('blog_authorship_corpus')`. ``` raise NonMatchingSplitsSizesError(str(bad_splits)) nlp.utils.info_utils.NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=616473500, num_examples=536323, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=30786661, num_examples=27766, dataset_name='blog_authorship_corpus')}] ``` Upon checking it seems like there is a disparity between the information in `datasets/blog_authorship_corpus/dataset_infos.json` and what was downloaded. Although I can get away with this by passing `ignore_verifications=True` in `load_dataset`, I'm thinking doing so might give problems later on. I'm getting this same issue when loading the `imdb` corpus via `dataset = load_dataset("imdb")`. When I try `ignore_verifications=True`, no examples are read into the `train` portion of the dataset.
https://github.com/huggingface/datasets/issues/215
NonMatchingSplitsSizesError when loading blog_authorship_corpus
> I'm getting this same issue when loading the `imdb` corpus via `dataset = load_dataset("imdb")`. When I try `ignore_verifications=True`, no examples are read into the `train` portion of the dataset. When the checksums don't match, it may mean that the file you downloaded is corrupted. In this case you can try to load the dataset again `load_dataset("imdb", download_mode="force_redownload")` Also I just checked on my side and it worked fine: ```python from datasets import load_dataset dataset = load_dataset("imdb") print(len(dataset["train"])) # 25000 ``` Let me know if redownloading fixes your issue @EmilyAlsentzer . If not, feel free to open a separate issue.
Getting this error when i run `nlp.load_dataset('blog_authorship_corpus')`. ``` raise NonMatchingSplitsSizesError(str(bad_splits)) nlp.utils.info_utils.NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=616473500, num_examples=536323, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=30786661, num_examples=27766, dataset_name='blog_authorship_corpus')}] ``` Upon checking it seems like there is a disparity between the information in `datasets/blog_authorship_corpus/dataset_infos.json` and what was downloaded. Although I can get away with this by passing `ignore_verifications=True` in `load_dataset`, I'm thinking doing so might give problems later on.
100
NonMatchingSplitsSizesError when loading blog_authorship_corpus Getting this error when i run `nlp.load_dataset('blog_authorship_corpus')`. ``` raise NonMatchingSplitsSizesError(str(bad_splits)) nlp.utils.info_utils.NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=616473500, num_examples=536323, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=30786661, num_examples=27766, dataset_name='blog_authorship_corpus')}] ``` Upon checking it seems like there is a disparity between the information in `datasets/blog_authorship_corpus/dataset_infos.json` and what was downloaded. Although I can get away with this by passing `ignore_verifications=True` in `load_dataset`, I'm thinking doing so might give problems later on. > I'm getting this same issue when loading the `imdb` corpus via `dataset = load_dataset("imdb")`. When I try `ignore_verifications=True`, no examples are read into the `train` portion of the dataset. When the checksums don't match, it may mean that the file you downloaded is corrupted. In this case you can try to load the dataset again `load_dataset("imdb", download_mode="force_redownload")` Also I just checked on my side and it worked fine: ```python from datasets import load_dataset dataset = load_dataset("imdb") print(len(dataset["train"])) # 25000 ``` Let me know if redownloading fixes your issue @EmilyAlsentzer . If not, feel free to open a separate issue.
https://github.com/huggingface/datasets/issues/215
NonMatchingSplitsSizesError when loading blog_authorship_corpus
I wasn't aware of the "force_redownload" option and manually removed the '/home/me/.cache/huggingface/datasets/' dir, this worked for me (dataset 'cnn_dailymail')
Getting this error when i run `nlp.load_dataset('blog_authorship_corpus')`. ``` raise NonMatchingSplitsSizesError(str(bad_splits)) nlp.utils.info_utils.NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=616473500, num_examples=536323, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=30786661, num_examples=27766, dataset_name='blog_authorship_corpus')}] ``` Upon checking it seems like there is a disparity between the information in `datasets/blog_authorship_corpus/dataset_infos.json` and what was downloaded. Although I can get away with this by passing `ignore_verifications=True` in `load_dataset`, I'm thinking doing so might give problems later on.
19
NonMatchingSplitsSizesError when loading blog_authorship_corpus Getting this error when i run `nlp.load_dataset('blog_authorship_corpus')`. ``` raise NonMatchingSplitsSizesError(str(bad_splits)) nlp.utils.info_utils.NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=616473500, num_examples=536323, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=30786661, num_examples=27766, dataset_name='blog_authorship_corpus')}] ``` Upon checking it seems like there is a disparity between the information in `datasets/blog_authorship_corpus/dataset_infos.json` and what was downloaded. Although I can get away with this by passing `ignore_verifications=True` in `load_dataset`, I'm thinking doing so might give problems later on. I wasn't aware of the "force_redownload" option and manually removed the '/home/me/.cache/huggingface/datasets/' dir, this worked for me (dataset 'cnn_dailymail')
https://github.com/huggingface/datasets/issues/215
NonMatchingSplitsSizesError when loading blog_authorship_corpus
Yes I think this might not be documented well enough. Let’s add it to the doc @lhoestq @SBrandeis. And everything on how to control the cache behavior better (removing, overriding, changing the path, etc)
Getting this error when i run `nlp.load_dataset('blog_authorship_corpus')`. ``` raise NonMatchingSplitsSizesError(str(bad_splits)) nlp.utils.info_utils.NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=616473500, num_examples=536323, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=30786661, num_examples=27766, dataset_name='blog_authorship_corpus')}] ``` Upon checking it seems like there is a disparity between the information in `datasets/blog_authorship_corpus/dataset_infos.json` and what was downloaded. Although I can get away with this by passing `ignore_verifications=True` in `load_dataset`, I'm thinking doing so might give problems later on.
34
NonMatchingSplitsSizesError when loading blog_authorship_corpus Getting this error when i run `nlp.load_dataset('blog_authorship_corpus')`. ``` raise NonMatchingSplitsSizesError(str(bad_splits)) nlp.utils.info_utils.NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=616473500, num_examples=536323, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=30786661, num_examples=27766, dataset_name='blog_authorship_corpus')}] ``` Upon checking it seems like there is a disparity between the information in `datasets/blog_authorship_corpus/dataset_infos.json` and what was downloaded. Although I can get away with this by passing `ignore_verifications=True` in `load_dataset`, I'm thinking doing so might give problems later on. Yes I think this might not be documented well enough. Let’s add it to the doc @lhoestq @SBrandeis. And everything on how to control the cache behavior better (removing, overriding, changing the path, etc)
https://github.com/huggingface/datasets/issues/215
NonMatchingSplitsSizesError when loading blog_authorship_corpus
Already fixed: ```python In [1]: from datasets import load_dataset In [2]: ds = load_dataset("blog_authorship_corpus") In [3]: ds Out[3]: DatasetDict({ train: Dataset({ features: ['text', 'date', 'gender', 'age', 'horoscope', 'job'], num_rows: 689793 }) validation: Dataset({ features: ['text', 'date', 'gender', 'age', 'horoscope', 'job'], num_rows: 37919 }) })
Getting this error when i run `nlp.load_dataset('blog_authorship_corpus')`. ``` raise NonMatchingSplitsSizesError(str(bad_splits)) nlp.utils.info_utils.NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=616473500, num_examples=536323, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=30786661, num_examples=27766, dataset_name='blog_authorship_corpus')}] ``` Upon checking it seems like there is a disparity between the information in `datasets/blog_authorship_corpus/dataset_infos.json` and what was downloaded. Although I can get away with this by passing `ignore_verifications=True` in `load_dataset`, I'm thinking doing so might give problems later on.
44
NonMatchingSplitsSizesError when loading blog_authorship_corpus Getting this error when i run `nlp.load_dataset('blog_authorship_corpus')`. ``` raise NonMatchingSplitsSizesError(str(bad_splits)) nlp.utils.info_utils.NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=616473500, num_examples=536323, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=30786661, num_examples=27766, dataset_name='blog_authorship_corpus')}] ``` Upon checking it seems like there is a disparity between the information in `datasets/blog_authorship_corpus/dataset_infos.json` and what was downloaded. Although I can get away with this by passing `ignore_verifications=True` in `load_dataset`, I'm thinking doing so might give problems later on. Already fixed: ```python In [1]: from datasets import load_dataset In [2]: ds = load_dataset("blog_authorship_corpus") In [3]: ds Out[3]: DatasetDict({ train: Dataset({ features: ['text', 'date', 'gender', 'age', 'horoscope', 'job'], num_rows: 689793 }) validation: Dataset({ features: ['text', 'date', 'gender', 'age', 'horoscope', 'job'], num_rows: 37919 }) })
https://github.com/huggingface/datasets/issues/215
NonMatchingSplitsSizesError when loading blog_authorship_corpus
In my case, I had to remove the cache datasets directory completely as @putssander suggested, the download_mode='forced_redownload' was insufficient. I had a private repository with data files that I loaded with a loading script. It was working fine until I pushed a new version of the data files and then the NonMatchingSplitsSizesError was raised.
Getting this error when i run `nlp.load_dataset('blog_authorship_corpus')`. ``` raise NonMatchingSplitsSizesError(str(bad_splits)) nlp.utils.info_utils.NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=616473500, num_examples=536323, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=30786661, num_examples=27766, dataset_name='blog_authorship_corpus')}] ``` Upon checking it seems like there is a disparity between the information in `datasets/blog_authorship_corpus/dataset_infos.json` and what was downloaded. Although I can get away with this by passing `ignore_verifications=True` in `load_dataset`, I'm thinking doing so might give problems later on.
54
NonMatchingSplitsSizesError when loading blog_authorship_corpus Getting this error when i run `nlp.load_dataset('blog_authorship_corpus')`. ``` raise NonMatchingSplitsSizesError(str(bad_splits)) nlp.utils.info_utils.NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='train', num_bytes=610252351, num_examples=532812, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='train', num_bytes=616473500, num_examples=536323, dataset_name='blog_authorship_corpus')}, {'expected': SplitInfo(name='validation', num_bytes=37500394, num_examples=31277, dataset_name='blog_authorship_corpus'), 'recorded': SplitInfo(name='validation', num_bytes=30786661, num_examples=27766, dataset_name='blog_authorship_corpus')}] ``` Upon checking it seems like there is a disparity between the information in `datasets/blog_authorship_corpus/dataset_infos.json` and what was downloaded. Although I can get away with this by passing `ignore_verifications=True` in `load_dataset`, I'm thinking doing so might give problems later on. In my case, I had to remove the cache datasets directory completely as @putssander suggested, the download_mode='forced_redownload' was insufficient. I had a private repository with data files that I loaded with a loading script. It was working fine until I pushed a new version of the data files and then the NonMatchingSplitsSizesError was raised.
https://github.com/huggingface/datasets/issues/211
[Arrow writer, Trivia_qa] Could not convert TagMe with type str: converting to null type
Here the full error trace: ``` ArrowInvalid Traceback (most recent call last) <ipython-input-1-7aaf3f011358> in <module> 1 import nlp 2 ds = nlp.load_dataset("trivia_qa", "rc", split="validation[:1%]") # this might take 2.3 min to download but it's cached afterwards... ----> 3 ds.map(lambda x: x, load_from_cache_file=False) ~/python_bin/nlp/arrow_dataset.py in map(self, function, with_indices, batched, batch_size, remove_columns, keep_in_memory, load_from_cache_file, cache_file_name, writer_batch_size, arrow_schema, disable_nullable) 549 550 if update_data: --> 551 writer.finalize() # close_stream=bool(buf_writer is None)) # We only close if we are writing in a file 552 553 # Create new Dataset from buffer or file ~/python_bin/nlp/arrow_writer.py in finalize(self, close_stream) 182 def finalize(self, close_stream=True): 183 if self.pa_writer is not None: --> 184 self.write_on_file() 185 self.pa_writer.close() 186 if close_stream: ~/python_bin/nlp/arrow_writer.py in write_on_file(self) 104 """ 105 if self.current_rows: --> 106 pa_array = pa.array(self.current_rows, type=self._type) 107 first_example = pa.array(self.current_rows[0:1], type=self._type)[0] 108 # Sanity check ~/hugging_face/venv_3.7/lib/python3.7/site-packages/pyarrow/array.pxi in pyarrow.lib.array() ~/hugging_face/venv_3.7/lib/python3.7/site-packages/pyarrow/array.pxi in pyarrow.lib._sequence_to_array() ~/hugging_face/venv_3.7/lib/python3.7/site-packages/pyarrow/error.pxi in pyarrow.lib.check_status() ArrowInvalid: Could not convert TagMe with type str: converting to null type ```
Running the following code ``` import nlp ds = nlp.load_dataset("trivia_qa", "rc", split="validation[:1%]") # this might take 2.3 min to download but it's cached afterwards... ds.map(lambda x: x, load_from_cache_file=False) ``` triggers a `ArrowInvalid: Could not convert TagMe with type str: converting to null type` error. On the other hand if we remove a certain column of `trivia_qa` which seems responsible for the bug, it works: ``` import nlp ds = nlp.load_dataset("trivia_qa", "rc", split="validation[:1%]") # this might take 2.3 min to download but it's cached afterwards... ds.map(lambda x: x, remove_columns=["entity_pages"], load_from_cache_file=False) ``` . Seems quite hard to debug what's going on here... @lhoestq @thomwolf - do you have a good first guess what the problem could be? **Note** BTW: I think this could be a good test to check that the datasets work correctly: Take a tiny portion of the dataset and check that it can be written correctly.
155
[Arrow writer, Trivia_qa] Could not convert TagMe with type str: converting to null type Running the following code ``` import nlp ds = nlp.load_dataset("trivia_qa", "rc", split="validation[:1%]") # this might take 2.3 min to download but it's cached afterwards... ds.map(lambda x: x, load_from_cache_file=False) ``` triggers a `ArrowInvalid: Could not convert TagMe with type str: converting to null type` error. On the other hand if we remove a certain column of `trivia_qa` which seems responsible for the bug, it works: ``` import nlp ds = nlp.load_dataset("trivia_qa", "rc", split="validation[:1%]") # this might take 2.3 min to download but it's cached afterwards... ds.map(lambda x: x, remove_columns=["entity_pages"], load_from_cache_file=False) ``` . Seems quite hard to debug what's going on here... @lhoestq @thomwolf - do you have a good first guess what the problem could be? **Note** BTW: I think this could be a good test to check that the datasets work correctly: Take a tiny portion of the dataset and check that it can be written correctly. Here the full error trace: ``` ArrowInvalid Traceback (most recent call last) <ipython-input-1-7aaf3f011358> in <module> 1 import nlp 2 ds = nlp.load_dataset("trivia_qa", "rc", split="validation[:1%]") # this might take 2.3 min to download but it's cached afterwards... ----> 3 ds.map(lambda x: x, load_from_cache_file=False) ~/python_bin/nlp/arrow_dataset.py in map(self, function, with_indices, batched, batch_size, remove_columns, keep_in_memory, load_from_cache_file, cache_file_name, writer_batch_size, arrow_schema, disable_nullable) 549 550 if update_data: --> 551 writer.finalize() # close_stream=bool(buf_writer is None)) # We only close if we are writing in a file 552 553 # Create new Dataset from buffer or file ~/python_bin/nlp/arrow_writer.py in finalize(self, close_stream) 182 def finalize(self, close_stream=True): 183 if self.pa_writer is not None: --> 184 self.write_on_file() 185 self.pa_writer.close() 186 if close_stream: ~/python_bin/nlp/arrow_writer.py in write_on_file(self) 104 """ 105 if self.current_rows: --> 106 pa_array = pa.array(self.current_rows, type=self._type) 107 first_example = pa.array(self.current_rows[0:1], type=self._type)[0] 108 # Sanity check ~/hugging_face/venv_3.7/lib/python3.7/site-packages/pyarrow/array.pxi in pyarrow.lib.array() ~/hugging_face/venv_3.7/lib/python3.7/site-packages/pyarrow/array.pxi in pyarrow.lib._sequence_to_array() ~/hugging_face/venv_3.7/lib/python3.7/site-packages/pyarrow/error.pxi in pyarrow.lib.check_status() ArrowInvalid: Could not convert TagMe with type str: converting to null type ```
https://github.com/huggingface/datasets/issues/211
[Arrow writer, Trivia_qa] Could not convert TagMe with type str: converting to null type
Actually thinking a bit more about it, it's probably a data sample that is not correct in `trivia_qa`. But I'm a bit surprised though that we managed to write it in .arrow format and now cannot write it anymore after an "identity" mapping.
Running the following code ``` import nlp ds = nlp.load_dataset("trivia_qa", "rc", split="validation[:1%]") # this might take 2.3 min to download but it's cached afterwards... ds.map(lambda x: x, load_from_cache_file=False) ``` triggers a `ArrowInvalid: Could not convert TagMe with type str: converting to null type` error. On the other hand if we remove a certain column of `trivia_qa` which seems responsible for the bug, it works: ``` import nlp ds = nlp.load_dataset("trivia_qa", "rc", split="validation[:1%]") # this might take 2.3 min to download but it's cached afterwards... ds.map(lambda x: x, remove_columns=["entity_pages"], load_from_cache_file=False) ``` . Seems quite hard to debug what's going on here... @lhoestq @thomwolf - do you have a good first guess what the problem could be? **Note** BTW: I think this could be a good test to check that the datasets work correctly: Take a tiny portion of the dataset and check that it can be written correctly.
43
[Arrow writer, Trivia_qa] Could not convert TagMe with type str: converting to null type Running the following code ``` import nlp ds = nlp.load_dataset("trivia_qa", "rc", split="validation[:1%]") # this might take 2.3 min to download but it's cached afterwards... ds.map(lambda x: x, load_from_cache_file=False) ``` triggers a `ArrowInvalid: Could not convert TagMe with type str: converting to null type` error. On the other hand if we remove a certain column of `trivia_qa` which seems responsible for the bug, it works: ``` import nlp ds = nlp.load_dataset("trivia_qa", "rc", split="validation[:1%]") # this might take 2.3 min to download but it's cached afterwards... ds.map(lambda x: x, remove_columns=["entity_pages"], load_from_cache_file=False) ``` . Seems quite hard to debug what's going on here... @lhoestq @thomwolf - do you have a good first guess what the problem could be? **Note** BTW: I think this could be a good test to check that the datasets work correctly: Take a tiny portion of the dataset and check that it can be written correctly. Actually thinking a bit more about it, it's probably a data sample that is not correct in `trivia_qa`. But I'm a bit surprised though that we managed to write it in .arrow format and now cannot write it anymore after an "identity" mapping.
https://github.com/huggingface/datasets/issues/211
[Arrow writer, Trivia_qa] Could not convert TagMe with type str: converting to null type
Actually, I know what the problem is...I'm quite sure it's a bug. Here we take some test inputs: https://github.com/huggingface/nlp/blob/0e0ef12c14d2175e0b0bd7d8aa814b09e2cd7e1f/src/nlp/arrow_dataset.py#L472 It might be that in the test inputs, a `Sequence` type value is an emtpy list. So in my case I have `ds[0]["entity_pages']["wiki_context"] = []`. => this leads to an `arrow_schema` equal to `null` for `["entity_pages']["wiki_context"]` => see line: https://github.com/huggingface/nlp/blob/0e0ef12c14d2175e0b0bd7d8aa814b09e2cd7e1f/src/nlp/arrow_dataset.py#L501 instead of list of string which it should for other examples. Guess it's an edge case, but it can happen.
Running the following code ``` import nlp ds = nlp.load_dataset("trivia_qa", "rc", split="validation[:1%]") # this might take 2.3 min to download but it's cached afterwards... ds.map(lambda x: x, load_from_cache_file=False) ``` triggers a `ArrowInvalid: Could not convert TagMe with type str: converting to null type` error. On the other hand if we remove a certain column of `trivia_qa` which seems responsible for the bug, it works: ``` import nlp ds = nlp.load_dataset("trivia_qa", "rc", split="validation[:1%]") # this might take 2.3 min to download but it's cached afterwards... ds.map(lambda x: x, remove_columns=["entity_pages"], load_from_cache_file=False) ``` . Seems quite hard to debug what's going on here... @lhoestq @thomwolf - do you have a good first guess what the problem could be? **Note** BTW: I think this could be a good test to check that the datasets work correctly: Take a tiny portion of the dataset and check that it can be written correctly.
79
[Arrow writer, Trivia_qa] Could not convert TagMe with type str: converting to null type Running the following code ``` import nlp ds = nlp.load_dataset("trivia_qa", "rc", split="validation[:1%]") # this might take 2.3 min to download but it's cached afterwards... ds.map(lambda x: x, load_from_cache_file=False) ``` triggers a `ArrowInvalid: Could not convert TagMe with type str: converting to null type` error. On the other hand if we remove a certain column of `trivia_qa` which seems responsible for the bug, it works: ``` import nlp ds = nlp.load_dataset("trivia_qa", "rc", split="validation[:1%]") # this might take 2.3 min to download but it's cached afterwards... ds.map(lambda x: x, remove_columns=["entity_pages"], load_from_cache_file=False) ``` . Seems quite hard to debug what's going on here... @lhoestq @thomwolf - do you have a good first guess what the problem could be? **Note** BTW: I think this could be a good test to check that the datasets work correctly: Take a tiny portion of the dataset and check that it can be written correctly. Actually, I know what the problem is...I'm quite sure it's a bug. Here we take some test inputs: https://github.com/huggingface/nlp/blob/0e0ef12c14d2175e0b0bd7d8aa814b09e2cd7e1f/src/nlp/arrow_dataset.py#L472 It might be that in the test inputs, a `Sequence` type value is an emtpy list. So in my case I have `ds[0]["entity_pages']["wiki_context"] = []`. => this leads to an `arrow_schema` equal to `null` for `["entity_pages']["wiki_context"]` => see line: https://github.com/huggingface/nlp/blob/0e0ef12c14d2175e0b0bd7d8aa814b09e2cd7e1f/src/nlp/arrow_dataset.py#L501 instead of list of string which it should for other examples. Guess it's an edge case, but it can happen.
https://github.com/huggingface/datasets/issues/211
[Arrow writer, Trivia_qa] Could not convert TagMe with type str: converting to null type
Good point, I think the schema should be infered at the writing stage where we have a `writer_batch_size` number of examples (typically 10k) so it's even less likely to run into this scenario.
Running the following code ``` import nlp ds = nlp.load_dataset("trivia_qa", "rc", split="validation[:1%]") # this might take 2.3 min to download but it's cached afterwards... ds.map(lambda x: x, load_from_cache_file=False) ``` triggers a `ArrowInvalid: Could not convert TagMe with type str: converting to null type` error. On the other hand if we remove a certain column of `trivia_qa` which seems responsible for the bug, it works: ``` import nlp ds = nlp.load_dataset("trivia_qa", "rc", split="validation[:1%]") # this might take 2.3 min to download but it's cached afterwards... ds.map(lambda x: x, remove_columns=["entity_pages"], load_from_cache_file=False) ``` . Seems quite hard to debug what's going on here... @lhoestq @thomwolf - do you have a good first guess what the problem could be? **Note** BTW: I think this could be a good test to check that the datasets work correctly: Take a tiny portion of the dataset and check that it can be written correctly.
33
[Arrow writer, Trivia_qa] Could not convert TagMe with type str: converting to null type Running the following code ``` import nlp ds = nlp.load_dataset("trivia_qa", "rc", split="validation[:1%]") # this might take 2.3 min to download but it's cached afterwards... ds.map(lambda x: x, load_from_cache_file=False) ``` triggers a `ArrowInvalid: Could not convert TagMe with type str: converting to null type` error. On the other hand if we remove a certain column of `trivia_qa` which seems responsible for the bug, it works: ``` import nlp ds = nlp.load_dataset("trivia_qa", "rc", split="validation[:1%]") # this might take 2.3 min to download but it's cached afterwards... ds.map(lambda x: x, remove_columns=["entity_pages"], load_from_cache_file=False) ``` . Seems quite hard to debug what's going on here... @lhoestq @thomwolf - do you have a good first guess what the problem could be? **Note** BTW: I think this could be a good test to check that the datasets work correctly: Take a tiny portion of the dataset and check that it can be written correctly. Good point, I think the schema should be infered at the writing stage where we have a `writer_batch_size` number of examples (typically 10k) so it's even less likely to run into this scenario.
https://github.com/huggingface/datasets/issues/207
Remove test set from NLP viewer
Appears that [two thirds of those polled on Twitter](https://twitter.com/srush_nlp/status/1265734497632477185) are in favor of _some_ mechanism for averting eyeballs from the test data.
While the new [NLP viewer](https://huggingface.co/nlp/viewer/) is a great tool, I think it would be best to outright remove the option of looking at the test sets. At the very least, a warning should be displayed to users before showing the test set. Newcomers to the field might not be aware of best practices, and small things like this can help increase awareness.
22
Remove test set from NLP viewer While the new [NLP viewer](https://huggingface.co/nlp/viewer/) is a great tool, I think it would be best to outright remove the option of looking at the test sets. At the very least, a warning should be displayed to users before showing the test set. Newcomers to the field might not be aware of best practices, and small things like this can help increase awareness. Appears that [two thirds of those polled on Twitter](https://twitter.com/srush_nlp/status/1265734497632477185) are in favor of _some_ mechanism for averting eyeballs from the test data.
https://github.com/huggingface/datasets/issues/206
[Question] Combine 2 datasets which have the same columns
We are thinking about ways to combine datasets for T5 in #217, feel free to share your thoughts about this.
Hi, I am using ``nlp`` to load personal datasets. I created summarization datasets in multi-languages based on wikinews. I have one dataset for english and one for german (french is getting to be ready as well). I want to keep these datasets independent because they need different pre-processing (add different task-specific prefixes for T5 : *summarize:* for english and *zusammenfassen:* for german) My issue is that I want to train T5 on the combined english and german datasets to see if it improves results. So I would like to combine 2 datasets (which have the same columns) to make one and train T5 on it. I was wondering if there is a proper way to do it? I assume that it can be done by combining all examples of each dataset but maybe you have a better solution. Hoping this is clear enough, Thanks a lot 😊 Best
20
[Question] Combine 2 datasets which have the same columns Hi, I am using ``nlp`` to load personal datasets. I created summarization datasets in multi-languages based on wikinews. I have one dataset for english and one for german (french is getting to be ready as well). I want to keep these datasets independent because they need different pre-processing (add different task-specific prefixes for T5 : *summarize:* for english and *zusammenfassen:* for german) My issue is that I want to train T5 on the combined english and german datasets to see if it improves results. So I would like to combine 2 datasets (which have the same columns) to make one and train T5 on it. I was wondering if there is a proper way to do it? I assume that it can be done by combining all examples of each dataset but maybe you have a better solution. Hoping this is clear enough, Thanks a lot 😊 Best We are thinking about ways to combine datasets for T5 in #217, feel free to share your thoughts about this.
https://github.com/huggingface/datasets/issues/197
Scientific Papers only downloading Pubmed
Hi so there are indeed two configurations in the datasets as you can see [here](https://github.com/huggingface/nlp/blob/master/datasets/scientific_papers/scientific_papers.py#L81-L82). You can load either one with: ```python dataset = nlp.load_dataset('scientific_papers', 'pubmed') dataset = nlp.load_dataset('scientific_papers', 'arxiv') ``` This issues is actually related to a similar user-experience issue with GLUE. When several configurations are available and the first configuration is loaded by default (see issue #152 and #130), it seems to be unexpected for users. I think we should maybe raise a (very explicit) error when there are several configurations available and the user doesn't specify one. What do you think @lhoestq @patrickvonplaten @mariamabarham ?
Hi! I have been playing around with this module, and I am a bit confused about the `scientific_papers` dataset. I thought that it would download two separate datasets, arxiv and pubmed. But when I run the following: ``` dataset = nlp.load_dataset('scientific_papers', data_dir='.', cache_dir='.') Downloading: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5.05k/5.05k [00:00<00:00, 2.66MB/s] Downloading: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 4.90k/4.90k [00:00<00:00, 2.42MB/s] Downloading and preparing dataset scientific_papers/pubmed (download: 4.20 GiB, generated: 2.33 GiB, total: 6.53 GiB) to ./scientific_papers/pubmed/1.1.1... Downloading: 3.62GB [00:40, 90.5MB/s] Downloading: 880MB [00:08, 101MB/s] Dataset scientific_papers downloaded and prepared to ./scientific_papers/pubmed/1.1.1. Subsequent calls will reuse this data. ``` only a pubmed folder is created. There doesn't seem to be something for arxiv. Are these two datasets merged? Or have I misunderstood something? Thanks!
98
Scientific Papers only downloading Pubmed Hi! I have been playing around with this module, and I am a bit confused about the `scientific_papers` dataset. I thought that it would download two separate datasets, arxiv and pubmed. But when I run the following: ``` dataset = nlp.load_dataset('scientific_papers', data_dir='.', cache_dir='.') Downloading: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5.05k/5.05k [00:00<00:00, 2.66MB/s] Downloading: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 4.90k/4.90k [00:00<00:00, 2.42MB/s] Downloading and preparing dataset scientific_papers/pubmed (download: 4.20 GiB, generated: 2.33 GiB, total: 6.53 GiB) to ./scientific_papers/pubmed/1.1.1... Downloading: 3.62GB [00:40, 90.5MB/s] Downloading: 880MB [00:08, 101MB/s] Dataset scientific_papers downloaded and prepared to ./scientific_papers/pubmed/1.1.1. Subsequent calls will reuse this data. ``` only a pubmed folder is created. There doesn't seem to be something for arxiv. Are these two datasets merged? Or have I misunderstood something? Thanks! Hi so there are indeed two configurations in the datasets as you can see [here](https://github.com/huggingface/nlp/blob/master/datasets/scientific_papers/scientific_papers.py#L81-L82). You can load either one with: ```python dataset = nlp.load_dataset('scientific_papers', 'pubmed') dataset = nlp.load_dataset('scientific_papers', 'arxiv') ``` This issues is actually related to a similar user-experience issue with GLUE. When several configurations are available and the first configuration is loaded by default (see issue #152 and #130), it seems to be unexpected for users. I think we should maybe raise a (very explicit) error when there are several configurations available and the user doesn't specify one. What do you think @lhoestq @patrickvonplaten @mariamabarham ?
https://github.com/huggingface/datasets/issues/197
Scientific Papers only downloading Pubmed
Now if you don't specify which part you want, it raises an error: ``` ValueError: Config name is missing. Please pick one among the available configs: ['pubmed', 'arxiv'] Example of usage: `load_dataset('scientific_papers', 'pubmed')` ```
Hi! I have been playing around with this module, and I am a bit confused about the `scientific_papers` dataset. I thought that it would download two separate datasets, arxiv and pubmed. But when I run the following: ``` dataset = nlp.load_dataset('scientific_papers', data_dir='.', cache_dir='.') Downloading: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5.05k/5.05k [00:00<00:00, 2.66MB/s] Downloading: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 4.90k/4.90k [00:00<00:00, 2.42MB/s] Downloading and preparing dataset scientific_papers/pubmed (download: 4.20 GiB, generated: 2.33 GiB, total: 6.53 GiB) to ./scientific_papers/pubmed/1.1.1... Downloading: 3.62GB [00:40, 90.5MB/s] Downloading: 880MB [00:08, 101MB/s] Dataset scientific_papers downloaded and prepared to ./scientific_papers/pubmed/1.1.1. Subsequent calls will reuse this data. ``` only a pubmed folder is created. There doesn't seem to be something for arxiv. Are these two datasets merged? Or have I misunderstood something? Thanks!
34
Scientific Papers only downloading Pubmed Hi! I have been playing around with this module, and I am a bit confused about the `scientific_papers` dataset. I thought that it would download two separate datasets, arxiv and pubmed. But when I run the following: ``` dataset = nlp.load_dataset('scientific_papers', data_dir='.', cache_dir='.') Downloading: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5.05k/5.05k [00:00<00:00, 2.66MB/s] Downloading: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 4.90k/4.90k [00:00<00:00, 2.42MB/s] Downloading and preparing dataset scientific_papers/pubmed (download: 4.20 GiB, generated: 2.33 GiB, total: 6.53 GiB) to ./scientific_papers/pubmed/1.1.1... Downloading: 3.62GB [00:40, 90.5MB/s] Downloading: 880MB [00:08, 101MB/s] Dataset scientific_papers downloaded and prepared to ./scientific_papers/pubmed/1.1.1. Subsequent calls will reuse this data. ``` only a pubmed folder is created. There doesn't seem to be something for arxiv. Are these two datasets merged? Or have I misunderstood something? Thanks! Now if you don't specify which part you want, it raises an error: ``` ValueError: Config name is missing. Please pick one among the available configs: ['pubmed', 'arxiv'] Example of usage: `load_dataset('scientific_papers', 'pubmed')` ```
https://github.com/huggingface/datasets/issues/193
[Tensorflow] Use something else than `from_tensor_slices()`
`from_generator` is not working on TPU, I met the following error : ``` File "/usr/local/lib/python3.6/contextlib.py", line 88, in __exit__ next(self.gen) File "/home/usr/.venv/bart/lib/python3.6/site-packages/tensorflow_core/python/eager/context.py", line 1900, in execution_mode executor_new.wait() File "/home/usr/.venv/bart/lib/python3.6/site-packages/tensorflow_core/python/eager/executor.py", line 67, in wait pywrap_tensorflow.TFE_ExecutorWaitForAllPendingNodes(self._handle) tensorflow.python.framework.errors_impl.NotFoundError: No registered 'PyFunc' OpKernel for 'CPU' devices compatible with node {{node PyFunc}} . Registered: <no registered kernels> [[PyFunc]] ``` --- @lhoestq It seems you merged some changes that allow lazy-loading. **Can you give an example of how to use ?** Maybe the Colab notebook should be updated with this method as well.
In the example notebook, the TF Dataset is built using `from_tensor_slices()` : ```python columns = ['input_ids', 'token_type_ids', 'attention_mask', 'start_positions', 'end_positions'] train_tf_dataset.set_format(type='tensorflow', columns=columns) features = {x: train_tf_dataset[x] for x in columns[:3]} labels = {"output_1": train_tf_dataset["start_positions"]} labels["output_2"] = train_tf_dataset["end_positions"] tfdataset = tf.data.Dataset.from_tensor_slices((features, labels)).batch(8) ``` But according to [official tensorflow documentation](https://www.tensorflow.org/guide/data#consuming_numpy_arrays), this will load the entire dataset to memory. **This defeats one purpose of this library, which is lazy loading.** Is there any other way to load the `nlp` dataset into TF dataset lazily ? --- For example, is it possible to use [Arrow dataset](https://www.tensorflow.org/io/api_docs/python/tfio/arrow/ArrowDataset) ? If yes, is there any code example ?
87
[Tensorflow] Use something else than `from_tensor_slices()` In the example notebook, the TF Dataset is built using `from_tensor_slices()` : ```python columns = ['input_ids', 'token_type_ids', 'attention_mask', 'start_positions', 'end_positions'] train_tf_dataset.set_format(type='tensorflow', columns=columns) features = {x: train_tf_dataset[x] for x in columns[:3]} labels = {"output_1": train_tf_dataset["start_positions"]} labels["output_2"] = train_tf_dataset["end_positions"] tfdataset = tf.data.Dataset.from_tensor_slices((features, labels)).batch(8) ``` But according to [official tensorflow documentation](https://www.tensorflow.org/guide/data#consuming_numpy_arrays), this will load the entire dataset to memory. **This defeats one purpose of this library, which is lazy loading.** Is there any other way to load the `nlp` dataset into TF dataset lazily ? --- For example, is it possible to use [Arrow dataset](https://www.tensorflow.org/io/api_docs/python/tfio/arrow/ArrowDataset) ? If yes, is there any code example ? `from_generator` is not working on TPU, I met the following error : ``` File "/usr/local/lib/python3.6/contextlib.py", line 88, in __exit__ next(self.gen) File "/home/usr/.venv/bart/lib/python3.6/site-packages/tensorflow_core/python/eager/context.py", line 1900, in execution_mode executor_new.wait() File "/home/usr/.venv/bart/lib/python3.6/site-packages/tensorflow_core/python/eager/executor.py", line 67, in wait pywrap_tensorflow.TFE_ExecutorWaitForAllPendingNodes(self._handle) tensorflow.python.framework.errors_impl.NotFoundError: No registered 'PyFunc' OpKernel for 'CPU' devices compatible with node {{node PyFunc}} . Registered: <no registered kernels> [[PyFunc]] ``` --- @lhoestq It seems you merged some changes that allow lazy-loading. **Can you give an example of how to use ?** Maybe the Colab notebook should be updated with this method as well.
https://github.com/huggingface/datasets/issues/193
[Tensorflow] Use something else than `from_tensor_slices()`
Could you send me the code you used to run create the dataset using `.from_generator` ? What version of tensorflow are you using ?
In the example notebook, the TF Dataset is built using `from_tensor_slices()` : ```python columns = ['input_ids', 'token_type_ids', 'attention_mask', 'start_positions', 'end_positions'] train_tf_dataset.set_format(type='tensorflow', columns=columns) features = {x: train_tf_dataset[x] for x in columns[:3]} labels = {"output_1": train_tf_dataset["start_positions"]} labels["output_2"] = train_tf_dataset["end_positions"] tfdataset = tf.data.Dataset.from_tensor_slices((features, labels)).batch(8) ``` But according to [official tensorflow documentation](https://www.tensorflow.org/guide/data#consuming_numpy_arrays), this will load the entire dataset to memory. **This defeats one purpose of this library, which is lazy loading.** Is there any other way to load the `nlp` dataset into TF dataset lazily ? --- For example, is it possible to use [Arrow dataset](https://www.tensorflow.org/io/api_docs/python/tfio/arrow/ArrowDataset) ? If yes, is there any code example ?
24
[Tensorflow] Use something else than `from_tensor_slices()` In the example notebook, the TF Dataset is built using `from_tensor_slices()` : ```python columns = ['input_ids', 'token_type_ids', 'attention_mask', 'start_positions', 'end_positions'] train_tf_dataset.set_format(type='tensorflow', columns=columns) features = {x: train_tf_dataset[x] for x in columns[:3]} labels = {"output_1": train_tf_dataset["start_positions"]} labels["output_2"] = train_tf_dataset["end_positions"] tfdataset = tf.data.Dataset.from_tensor_slices((features, labels)).batch(8) ``` But according to [official tensorflow documentation](https://www.tensorflow.org/guide/data#consuming_numpy_arrays), this will load the entire dataset to memory. **This defeats one purpose of this library, which is lazy loading.** Is there any other way to load the `nlp` dataset into TF dataset lazily ? --- For example, is it possible to use [Arrow dataset](https://www.tensorflow.org/io/api_docs/python/tfio/arrow/ArrowDataset) ? If yes, is there any code example ? Could you send me the code you used to run create the dataset using `.from_generator` ? What version of tensorflow are you using ?
https://github.com/huggingface/datasets/issues/193
[Tensorflow] Use something else than `from_tensor_slices()`
I'm using TF2.2 Here is my code : ``` import nlp from transformers import BartTokenizer tokenizer = BartTokenizer.from_pretrained('bart-large') def encode(sample): article_inputs = tokenizer.encode_plus(sample["article"], max_length=tokenizer.model_max_length, pad_to_max_length=True) summary_inputs = tokenizer.encode_plus(sample["highlights"], max_length=tokenizer.model_max_length, pad_to_max_length=True) article_inputs.update({"lm_labels": summary_inputs['input_ids']}) return article_inputs cnn_dm = nlp.load_dataset('cnn_dailymail', '3.0.0', split='test') cnn_dm = cnn_dm.map(encode) def gen(): for sample in cnn_dm: s = {} s['input_ids'] = sample['input_ids'] s['attention_mask'] = sample['attention_mask'] s['lm_labels'] = sample['lm_labels'] yield s dataset = tf.data.Dataset.from_generator(gen, output_types={k: tf.int32 for k in ['input_ids', 'attention_mask', 'lm_labels']}, output_shapes={k: tf.TensorShape([tokenizer.model_max_length]) for k in ['input_ids', 'attention_mask', 'lm_labels']} ```
In the example notebook, the TF Dataset is built using `from_tensor_slices()` : ```python columns = ['input_ids', 'token_type_ids', 'attention_mask', 'start_positions', 'end_positions'] train_tf_dataset.set_format(type='tensorflow', columns=columns) features = {x: train_tf_dataset[x] for x in columns[:3]} labels = {"output_1": train_tf_dataset["start_positions"]} labels["output_2"] = train_tf_dataset["end_positions"] tfdataset = tf.data.Dataset.from_tensor_slices((features, labels)).batch(8) ``` But according to [official tensorflow documentation](https://www.tensorflow.org/guide/data#consuming_numpy_arrays), this will load the entire dataset to memory. **This defeats one purpose of this library, which is lazy loading.** Is there any other way to load the `nlp` dataset into TF dataset lazily ? --- For example, is it possible to use [Arrow dataset](https://www.tensorflow.org/io/api_docs/python/tfio/arrow/ArrowDataset) ? If yes, is there any code example ?
82
[Tensorflow] Use something else than `from_tensor_slices()` In the example notebook, the TF Dataset is built using `from_tensor_slices()` : ```python columns = ['input_ids', 'token_type_ids', 'attention_mask', 'start_positions', 'end_positions'] train_tf_dataset.set_format(type='tensorflow', columns=columns) features = {x: train_tf_dataset[x] for x in columns[:3]} labels = {"output_1": train_tf_dataset["start_positions"]} labels["output_2"] = train_tf_dataset["end_positions"] tfdataset = tf.data.Dataset.from_tensor_slices((features, labels)).batch(8) ``` But according to [official tensorflow documentation](https://www.tensorflow.org/guide/data#consuming_numpy_arrays), this will load the entire dataset to memory. **This defeats one purpose of this library, which is lazy loading.** Is there any other way to load the `nlp` dataset into TF dataset lazily ? --- For example, is it possible to use [Arrow dataset](https://www.tensorflow.org/io/api_docs/python/tfio/arrow/ArrowDataset) ? If yes, is there any code example ? I'm using TF2.2 Here is my code : ``` import nlp from transformers import BartTokenizer tokenizer = BartTokenizer.from_pretrained('bart-large') def encode(sample): article_inputs = tokenizer.encode_plus(sample["article"], max_length=tokenizer.model_max_length, pad_to_max_length=True) summary_inputs = tokenizer.encode_plus(sample["highlights"], max_length=tokenizer.model_max_length, pad_to_max_length=True) article_inputs.update({"lm_labels": summary_inputs['input_ids']}) return article_inputs cnn_dm = nlp.load_dataset('cnn_dailymail', '3.0.0', split='test') cnn_dm = cnn_dm.map(encode) def gen(): for sample in cnn_dm: s = {} s['input_ids'] = sample['input_ids'] s['attention_mask'] = sample['attention_mask'] s['lm_labels'] = sample['lm_labels'] yield s dataset = tf.data.Dataset.from_generator(gen, output_types={k: tf.int32 for k in ['input_ids', 'attention_mask', 'lm_labels']}, output_shapes={k: tf.TensorShape([tokenizer.model_max_length]) for k in ['input_ids', 'attention_mask', 'lm_labels']} ```
https://github.com/huggingface/datasets/issues/193
[Tensorflow] Use something else than `from_tensor_slices()`
Apparently we'll have to wait for the next tensorflow release to use `.from_generator` and TPU. See https://github.com/tensorflow/tensorflow/issues/34346#issuecomment-598262489
In the example notebook, the TF Dataset is built using `from_tensor_slices()` : ```python columns = ['input_ids', 'token_type_ids', 'attention_mask', 'start_positions', 'end_positions'] train_tf_dataset.set_format(type='tensorflow', columns=columns) features = {x: train_tf_dataset[x] for x in columns[:3]} labels = {"output_1": train_tf_dataset["start_positions"]} labels["output_2"] = train_tf_dataset["end_positions"] tfdataset = tf.data.Dataset.from_tensor_slices((features, labels)).batch(8) ``` But according to [official tensorflow documentation](https://www.tensorflow.org/guide/data#consuming_numpy_arrays), this will load the entire dataset to memory. **This defeats one purpose of this library, which is lazy loading.** Is there any other way to load the `nlp` dataset into TF dataset lazily ? --- For example, is it possible to use [Arrow dataset](https://www.tensorflow.org/io/api_docs/python/tfio/arrow/ArrowDataset) ? If yes, is there any code example ?
17
[Tensorflow] Use something else than `from_tensor_slices()` In the example notebook, the TF Dataset is built using `from_tensor_slices()` : ```python columns = ['input_ids', 'token_type_ids', 'attention_mask', 'start_positions', 'end_positions'] train_tf_dataset.set_format(type='tensorflow', columns=columns) features = {x: train_tf_dataset[x] for x in columns[:3]} labels = {"output_1": train_tf_dataset["start_positions"]} labels["output_2"] = train_tf_dataset["end_positions"] tfdataset = tf.data.Dataset.from_tensor_slices((features, labels)).batch(8) ``` But according to [official tensorflow documentation](https://www.tensorflow.org/guide/data#consuming_numpy_arrays), this will load the entire dataset to memory. **This defeats one purpose of this library, which is lazy loading.** Is there any other way to load the `nlp` dataset into TF dataset lazily ? --- For example, is it possible to use [Arrow dataset](https://www.tensorflow.org/io/api_docs/python/tfio/arrow/ArrowDataset) ? If yes, is there any code example ? Apparently we'll have to wait for the next tensorflow release to use `.from_generator` and TPU. See https://github.com/tensorflow/tensorflow/issues/34346#issuecomment-598262489
https://github.com/huggingface/datasets/issues/192
[Question] Create Apache Arrow dataset from raw text file
We store every dataset in the Arrow format. This is convenient as it supports nested types and memory mapping. If you are curious feel free to check the [pyarrow documentation](https://arrow.apache.org/docs/python/) You can use this library to load your covid papers by creating a dataset script. You can find inspiration from the ones we've already written in `/datasets`. Here is a link to the steps to [add a dataset](https://github.com/huggingface/nlp/blob/master/CONTRIBUTING.md#how-to-add-a-dataset)
Hi guys, I have gathered and preprocessed about 2GB of COVID papers from CORD dataset @ Kggle. I have seen you have a text dataset as "Crime and punishment" in Apache arrow format. Do you have any script to do it from a raw txt file (preprocessed as for BERT like) or any guide? Is the worth of send it to you and add it to the NLP library? Thanks, Manu
68
[Question] Create Apache Arrow dataset from raw text file Hi guys, I have gathered and preprocessed about 2GB of COVID papers from CORD dataset @ Kggle. I have seen you have a text dataset as "Crime and punishment" in Apache arrow format. Do you have any script to do it from a raw txt file (preprocessed as for BERT like) or any guide? Is the worth of send it to you and add it to the NLP library? Thanks, Manu We store every dataset in the Arrow format. This is convenient as it supports nested types and memory mapping. If you are curious feel free to check the [pyarrow documentation](https://arrow.apache.org/docs/python/) You can use this library to load your covid papers by creating a dataset script. You can find inspiration from the ones we've already written in `/datasets`. Here is a link to the steps to [add a dataset](https://github.com/huggingface/nlp/blob/master/CONTRIBUTING.md#how-to-add-a-dataset)
https://github.com/huggingface/datasets/issues/192
[Question] Create Apache Arrow dataset from raw text file
Hello @mrm8488 and @lhoestq Is there a way to convert a dataset to Apache arrow format (locally/personal use) & use it before sending it to hugging face? Thanks :)
Hi guys, I have gathered and preprocessed about 2GB of COVID papers from CORD dataset @ Kggle. I have seen you have a text dataset as "Crime and punishment" in Apache arrow format. Do you have any script to do it from a raw txt file (preprocessed as for BERT like) or any guide? Is the worth of send it to you and add it to the NLP library? Thanks, Manu
29
[Question] Create Apache Arrow dataset from raw text file Hi guys, I have gathered and preprocessed about 2GB of COVID papers from CORD dataset @ Kggle. I have seen you have a text dataset as "Crime and punishment" in Apache arrow format. Do you have any script to do it from a raw txt file (preprocessed as for BERT like) or any guide? Is the worth of send it to you and add it to the NLP library? Thanks, Manu Hello @mrm8488 and @lhoestq Is there a way to convert a dataset to Apache arrow format (locally/personal use) & use it before sending it to hugging face? Thanks :)
https://github.com/huggingface/datasets/issues/192
[Question] Create Apache Arrow dataset from raw text file
> Is there a way to convert a dataset to Apache arrow format (locally/personal use) & use it before sending it to hugging face? Sure, to get a dataset in arrow format you can either: - [load from local files (txt, json, csv)](https://huggingface.co/nlp/loading_datasets.html?highlight=csv#from-local-files) - OR [load from python data (dict, pandas)](https://huggingface.co/nlp/loading_datasets.html?highlight=csv#from-in-memory-data) - OR [create your own dataset script](https://huggingface.co/nlp/loading_datasets.html?highlight=csv#using-a-custom-dataset-loading-script)
Hi guys, I have gathered and preprocessed about 2GB of COVID papers from CORD dataset @ Kggle. I have seen you have a text dataset as "Crime and punishment" in Apache arrow format. Do you have any script to do it from a raw txt file (preprocessed as for BERT like) or any guide? Is the worth of send it to you and add it to the NLP library? Thanks, Manu
58
[Question] Create Apache Arrow dataset from raw text file Hi guys, I have gathered and preprocessed about 2GB of COVID papers from CORD dataset @ Kggle. I have seen you have a text dataset as "Crime and punishment" in Apache arrow format. Do you have any script to do it from a raw txt file (preprocessed as for BERT like) or any guide? Is the worth of send it to you and add it to the NLP library? Thanks, Manu > Is there a way to convert a dataset to Apache arrow format (locally/personal use) & use it before sending it to hugging face? Sure, to get a dataset in arrow format you can either: - [load from local files (txt, json, csv)](https://huggingface.co/nlp/loading_datasets.html?highlight=csv#from-local-files) - OR [load from python data (dict, pandas)](https://huggingface.co/nlp/loading_datasets.html?highlight=csv#from-in-memory-data) - OR [create your own dataset script](https://huggingface.co/nlp/loading_datasets.html?highlight=csv#using-a-custom-dataset-loading-script)
https://github.com/huggingface/datasets/issues/192
[Question] Create Apache Arrow dataset from raw text file
> > Is there a way to convert a dataset to Apache arrow format (locally/personal use) & use it before sending it to hugging face? > > Sure, to get a dataset in arrow format you can either: > > * [load from local files (txt, json, csv)](https://huggingface.co/nlp/loading_datasets.html?highlight=csv#from-local-files) > > * OR [load from python data (dict, pandas)](https://huggingface.co/nlp/loading_datasets.html?highlight=csv#from-in-memory-data) > > * OR [create your own dataset script](https://huggingface.co/nlp/loading_datasets.html?highlight=csv#using-a-custom-dataset-loading-script) Links were broken. Updated links provided as below - [load from local files (txt, json, csv)](https://huggingface.co/docs/datasets/loading_datasets.html#from-local-or-remote-files) - [load from python data (dict, pandas)](https://huggingface.co/docs/datasets/loading_datasets.html#from-in-memory-data) - [create your own dataset script](https://huggingface.co/docs/datasets/loading_datasets.html#using-a-custom-dataset-loading-script)
Hi guys, I have gathered and preprocessed about 2GB of COVID papers from CORD dataset @ Kggle. I have seen you have a text dataset as "Crime and punishment" in Apache arrow format. Do you have any script to do it from a raw txt file (preprocessed as for BERT like) or any guide? Is the worth of send it to you and add it to the NLP library? Thanks, Manu
96
[Question] Create Apache Arrow dataset from raw text file Hi guys, I have gathered and preprocessed about 2GB of COVID papers from CORD dataset @ Kggle. I have seen you have a text dataset as "Crime and punishment" in Apache arrow format. Do you have any script to do it from a raw txt file (preprocessed as for BERT like) or any guide? Is the worth of send it to you and add it to the NLP library? Thanks, Manu > > Is there a way to convert a dataset to Apache arrow format (locally/personal use) & use it before sending it to hugging face? > > Sure, to get a dataset in arrow format you can either: > > * [load from local files (txt, json, csv)](https://huggingface.co/nlp/loading_datasets.html?highlight=csv#from-local-files) > > * OR [load from python data (dict, pandas)](https://huggingface.co/nlp/loading_datasets.html?highlight=csv#from-in-memory-data) > > * OR [create your own dataset script](https://huggingface.co/nlp/loading_datasets.html?highlight=csv#using-a-custom-dataset-loading-script) Links were broken. Updated links provided as below - [load from local files (txt, json, csv)](https://huggingface.co/docs/datasets/loading_datasets.html#from-local-or-remote-files) - [load from python data (dict, pandas)](https://huggingface.co/docs/datasets/loading_datasets.html#from-in-memory-data) - [create your own dataset script](https://huggingface.co/docs/datasets/loading_datasets.html#using-a-custom-dataset-loading-script)
https://github.com/huggingface/datasets/issues/189
[Question] BERT-style multiple choice formatting
Hi @sarahwie, can you details this a little more? I'm not sure I understand what you refer to and what you mean when you say "Previously, this was done by passing a list of InputFeatures to the dataloader instead of a list of InputFeature"
Hello, I am wondering what the equivalent formatting of a dataset should be to allow for multiple-choice answering prediction, BERT-style. Previously, this was done by passing a list of `InputFeatures` to the dataloader instead of a list of `InputFeature`, where `InputFeatures` contained lists of length equal to the number of answer choices in the MCQ instead of single items. I'm a bit confused on what the output of my feature conversion function should be when using `dataset.map()` to ensure similar behavior. Thanks!
44
[Question] BERT-style multiple choice formatting Hello, I am wondering what the equivalent formatting of a dataset should be to allow for multiple-choice answering prediction, BERT-style. Previously, this was done by passing a list of `InputFeatures` to the dataloader instead of a list of `InputFeature`, where `InputFeatures` contained lists of length equal to the number of answer choices in the MCQ instead of single items. I'm a bit confused on what the output of my feature conversion function should be when using `dataset.map()` to ensure similar behavior. Thanks! Hi @sarahwie, can you details this a little more? I'm not sure I understand what you refer to and what you mean when you say "Previously, this was done by passing a list of InputFeatures to the dataloader instead of a list of InputFeature"
https://github.com/huggingface/datasets/issues/189
[Question] BERT-style multiple choice formatting
I think I've resolved it. For others' reference: to convert from using the [`MultipleChoiceDataset` class](https://github.com/huggingface/transformers/blob/a34a9896ac2a4a33ff9cd805c76eed914c8d8965/examples/multiple-choice/utils_multiple_choice.py#L82)/[`run_multiple_choice.py`](https://github.com/huggingface/transformers/blob/a34a9896ac2a4a33ff9cd805c76eed914c8d8965/examples/multiple-choice/run_multiple_choice.py) script in Huggingface Transformers, I've done the following for hellaswag: 1. converted the `convert_examples_to_features()` function to only take one input and return a dictionary rather than a list: ``` def convert_examples_to_features(example, tokenizer, max_length): choices_inputs = defaultdict(list) for ending_idx, ending in enumerate(example['endings']['ending']): text_a = example['ctx'] text_b = ending inputs = tokenizer.encode_plus( text_a, text_b, add_special_tokens=True, max_length=max_length, pad_to_max_length=True, return_overflowing_tokens=True, ) if "num_truncated_tokens" in inputs and inputs["num_truncated_tokens"] > 0: logger.info( "Attention! you are cropping tokens (swag task is ok). " "If you are training ARC and RACE and you are poping question + options," "you need to try to use a bigger max seq length!" ) for key in inputs: choices_inputs[key].append(inputs[key]) choices_inputs['label'] = int(example['label']) return choices_inputs ``` 2. apply this directly (instance-wise) to dataset, convert dataset to torch tensors. Dataset is then ready to be passed to `Trainer` instance. ``` dataset['train'] = dataset['train'].map(lambda x: convert_examples_to_features(x, tokenizer, max_length), batched=False) columns = ['input_ids', 'token_type_ids', 'attention_mask', 'label'] dataset['train'].set_format(type='torch', columns=columns) ```
Hello, I am wondering what the equivalent formatting of a dataset should be to allow for multiple-choice answering prediction, BERT-style. Previously, this was done by passing a list of `InputFeatures` to the dataloader instead of a list of `InputFeature`, where `InputFeatures` contained lists of length equal to the number of answer choices in the MCQ instead of single items. I'm a bit confused on what the output of my feature conversion function should be when using `dataset.map()` to ensure similar behavior. Thanks!
168
[Question] BERT-style multiple choice formatting Hello, I am wondering what the equivalent formatting of a dataset should be to allow for multiple-choice answering prediction, BERT-style. Previously, this was done by passing a list of `InputFeatures` to the dataloader instead of a list of `InputFeature`, where `InputFeatures` contained lists of length equal to the number of answer choices in the MCQ instead of single items. I'm a bit confused on what the output of my feature conversion function should be when using `dataset.map()` to ensure similar behavior. Thanks! I think I've resolved it. For others' reference: to convert from using the [`MultipleChoiceDataset` class](https://github.com/huggingface/transformers/blob/a34a9896ac2a4a33ff9cd805c76eed914c8d8965/examples/multiple-choice/utils_multiple_choice.py#L82)/[`run_multiple_choice.py`](https://github.com/huggingface/transformers/blob/a34a9896ac2a4a33ff9cd805c76eed914c8d8965/examples/multiple-choice/run_multiple_choice.py) script in Huggingface Transformers, I've done the following for hellaswag: 1. converted the `convert_examples_to_features()` function to only take one input and return a dictionary rather than a list: ``` def convert_examples_to_features(example, tokenizer, max_length): choices_inputs = defaultdict(list) for ending_idx, ending in enumerate(example['endings']['ending']): text_a = example['ctx'] text_b = ending inputs = tokenizer.encode_plus( text_a, text_b, add_special_tokens=True, max_length=max_length, pad_to_max_length=True, return_overflowing_tokens=True, ) if "num_truncated_tokens" in inputs and inputs["num_truncated_tokens"] > 0: logger.info( "Attention! you are cropping tokens (swag task is ok). " "If you are training ARC and RACE and you are poping question + options," "you need to try to use a bigger max seq length!" ) for key in inputs: choices_inputs[key].append(inputs[key]) choices_inputs['label'] = int(example['label']) return choices_inputs ``` 2. apply this directly (instance-wise) to dataset, convert dataset to torch tensors. Dataset is then ready to be passed to `Trainer` instance. ``` dataset['train'] = dataset['train'].map(lambda x: convert_examples_to_features(x, tokenizer, max_length), batched=False) columns = ['input_ids', 'token_type_ids', 'attention_mask', 'label'] dataset['train'].set_format(type='torch', columns=columns) ```
https://github.com/huggingface/datasets/issues/188
When will the remaining math_dataset modules be added as dataset objects
Hi @tylerroost, we don't have a timeline for this at the moment. If you want to give it a look we would be happy to review a PR on it. Also, the library is one week old so everything is quite barebones, in particular the doc. You should expect some bumps on the road. To get you started, you can check the datasets scripts in the `./datasets` folder on the repo and find the one on math_datasets that will need to be modified. Then you should check the original repository on the math_dataset to see where the other files to download are located and what is the expected format for the various parts of the dataset. To get a general overview on how datasets scripts are written and used, you can read the nice tutorial on how to add a new dataset for TensorFlow Dataset [here](https://www.tensorflow.org/datasets/add_dataset), our API is not exactly identical but it can give you a high-level overview.
Currently only the algebra_linear_1d is supported. Is there a timeline for making the other modules supported. If no timeline is established, how can I help?
160
When will the remaining math_dataset modules be added as dataset objects Currently only the algebra_linear_1d is supported. Is there a timeline for making the other modules supported. If no timeline is established, how can I help? Hi @tylerroost, we don't have a timeline for this at the moment. If you want to give it a look we would be happy to review a PR on it. Also, the library is one week old so everything is quite barebones, in particular the doc. You should expect some bumps on the road. To get you started, you can check the datasets scripts in the `./datasets` folder on the repo and find the one on math_datasets that will need to be modified. Then you should check the original repository on the math_dataset to see where the other files to download are located and what is the expected format for the various parts of the dataset. To get a general overview on how datasets scripts are written and used, you can read the nice tutorial on how to add a new dataset for TensorFlow Dataset [here](https://www.tensorflow.org/datasets/add_dataset), our API is not exactly identical but it can give you a high-level overview.
https://github.com/huggingface/datasets/issues/187
[Question] How to load wikipedia ? Beam runner ?
I have seen that somebody is hard working on easierly loadable wikipedia. #129 Maybe I should wait a few days for that version ?
When `nlp.load_dataset('wikipedia')`, I got * `WARNING:nlp.builder:Trying to generate a dataset using Apache Beam, yet no Beam Runner or PipelineOptions() has been provided. Please pass a nlp.DownloadConfig(beam_runner=...) object to the builder.download_and_prepare(download_config=...) method. Default values will be used.` * `AttributeError: 'NoneType' object has no attribute 'size'` Could somebody tell me what should I do ? # Env On Colab, ``` git clone https://github.com/huggingface/nlp cd nlp pip install -q . ``` ``` %pip install -q apache_beam mwparserfromhell -> ERROR: pydrive 1.3.1 has requirement oauth2client>=4.0.0, but you'll have oauth2client 3.0.0 which is incompatible. ERROR: google-api-python-client 1.7.12 has requirement httplib2<1dev,>=0.17.0, but you'll have httplib2 0.12.0 which is incompatible. ERROR: chainer 6.5.0 has requirement typing-extensions<=3.6.6, but you'll have typing-extensions 3.7.4.2 which is incompatible. ``` ``` pip install -q apache-beam[interactive] ERROR: google-colab 1.0.0 has requirement ipython~=5.5.0, but you'll have ipython 5.10.0 which is incompatible. ``` # The whole message ``` WARNING:nlp.builder:Trying to generate a dataset using Apache Beam, yet no Beam Runner or PipelineOptions() has been provided. Please pass a nlp.DownloadConfig(beam_runner=...) object to the builder.download_and_prepare(download_config=...) method. Default values will be used. Downloading and preparing dataset wikipedia/20200501.aa (download: Unknown size, generated: Unknown size, total: Unknown size) to /root/.cache/huggingface/datasets/wikipedia/20200501.aa/1.0.0... --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /usr/local/lib/python3.6/dist-packages/apache_beam/runners/common.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.common.DoFnRunner.process() 44 frames /usr/local/lib/python3.6/dist-packages/apache_beam/runners/common.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.common.PerWindowInvoker.invoke_process() /usr/local/lib/python3.6/dist-packages/apache_beam/runners/common.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.common.PerWindowInvoker._invoke_process_per_window() /usr/local/lib/python3.6/dist-packages/apache_beam/io/iobase.py in process(self, element, init_result) 1081 writer.write(e) -> 1082 return [window.TimestampedValue(writer.close(), timestamp.MAX_TIMESTAMP)] 1083 /usr/local/lib/python3.6/dist-packages/apache_beam/io/filebasedsink.py in close(self) 422 def close(self): --> 423 self.sink.close(self.temp_handle) 424 return self.temp_shard_path /usr/local/lib/python3.6/dist-packages/apache_beam/io/parquetio.py in close(self, writer) 537 if len(self._buffer[0]) > 0: --> 538 self._flush_buffer() 539 if self._record_batches_byte_size > 0: /usr/local/lib/python3.6/dist-packages/apache_beam/io/parquetio.py in _flush_buffer(self) 569 for b in x.buffers(): --> 570 size = size + b.size 571 self._record_batches_byte_size = self._record_batches_byte_size + size AttributeError: 'NoneType' object has no attribute 'size' During handling of the above exception, another exception occurred: AttributeError Traceback (most recent call last) <ipython-input-9-340aabccefff> in <module>() ----> 1 dset = nlp.load_dataset('wikipedia') /usr/local/lib/python3.6/dist-packages/nlp/load.py in load_dataset(path, name, version, data_dir, data_files, split, cache_dir, download_config, download_mode, ignore_verifications, save_infos, **config_kwargs) 518 download_mode=download_mode, 519 ignore_verifications=ignore_verifications, --> 520 save_infos=save_infos, 521 ) 522 /usr/local/lib/python3.6/dist-packages/nlp/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, save_infos, dl_manager, **download_and_prepare_kwargs) 370 verify_infos = not save_infos and not ignore_verifications 371 self._download_and_prepare( --> 372 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 373 ) 374 # Sync info /usr/local/lib/python3.6/dist-packages/nlp/builder.py in _download_and_prepare(self, dl_manager, verify_infos) 770 with beam.Pipeline(runner=beam_runner, options=beam_options,) as pipeline: 771 super(BeamBasedBuilder, self)._download_and_prepare( --> 772 dl_manager, pipeline=pipeline, verify_infos=False 773 ) # TODO{beam} verify infos 774 /usr/local/lib/python3.6/dist-packages/apache_beam/pipeline.py in __exit__(self, exc_type, exc_val, exc_tb) 501 def __exit__(self, exc_type, exc_val, exc_tb): 502 if not exc_type: --> 503 self.run().wait_until_finish() 504 505 def visit(self, visitor): /usr/local/lib/python3.6/dist-packages/apache_beam/pipeline.py in run(self, test_runner_api) 481 return Pipeline.from_runner_api( 482 self.to_runner_api(use_fake_coders=True), self.runner, --> 483 self._options).run(False) 484 485 if self._options.view_as(TypeOptions).runtime_type_check: /usr/local/lib/python3.6/dist-packages/apache_beam/pipeline.py in run(self, test_runner_api) 494 finally: 495 shutil.rmtree(tmpdir) --> 496 return self.runner.run_pipeline(self, self._options) 497 498 def __enter__(self): /usr/local/lib/python3.6/dist-packages/apache_beam/runners/direct/direct_runner.py in run_pipeline(self, pipeline, options) 128 runner = BundleBasedDirectRunner() 129 --> 130 return runner.run_pipeline(pipeline, options) 131 132 /usr/local/lib/python3.6/dist-packages/apache_beam/runners/portability/fn_api_runner.py in run_pipeline(self, pipeline, options) 553 554 self._latest_run_result = self.run_via_runner_api( --> 555 pipeline.to_runner_api(default_environment=self._default_environment)) 556 return self._latest_run_result 557 /usr/local/lib/python3.6/dist-packages/apache_beam/runners/portability/fn_api_runner.py in run_via_runner_api(self, pipeline_proto) 563 # TODO(pabloem, BEAM-7514): Create a watermark manager (that has access to 564 # the teststream (if any), and all the stages). --> 565 return self.run_stages(stage_context, stages) 566 567 @contextlib.contextmanager /usr/local/lib/python3.6/dist-packages/apache_beam/runners/portability/fn_api_runner.py in run_stages(self, stage_context, stages) 704 stage, 705 pcoll_buffers, --> 706 stage_context.safe_coders) 707 metrics_by_stage[stage.name] = stage_results.process_bundle.metrics 708 monitoring_infos_by_stage[stage.name] = ( /usr/local/lib/python3.6/dist-packages/apache_beam/runners/portability/fn_api_runner.py in _run_stage(self, worker_handler_factory, pipeline_components, stage, pcoll_buffers, safe_coders) 1071 cache_token_generator=cache_token_generator) 1072 -> 1073 result, splits = bundle_manager.process_bundle(data_input, data_output) 1074 1075 def input_for(transform_id, input_id): /usr/local/lib/python3.6/dist-packages/apache_beam/runners/portability/fn_api_runner.py in process_bundle(self, inputs, expected_outputs) 2332 2333 with UnboundedThreadPoolExecutor() as executor: -> 2334 for result, split_result in executor.map(execute, part_inputs): 2335 2336 split_result_list += split_result /usr/lib/python3.6/concurrent/futures/_base.py in result_iterator() 584 # Careful not to keep a reference to the popped future 585 if timeout is None: --> 586 yield fs.pop().result() 587 else: 588 yield fs.pop().result(end_time - time.monotonic()) /usr/lib/python3.6/concurrent/futures/_base.py in result(self, timeout) 430 raise CancelledError() 431 elif self._state == FINISHED: --> 432 return self.__get_result() 433 else: 434 raise TimeoutError() /usr/lib/python3.6/concurrent/futures/_base.py in __get_result(self) 382 def __get_result(self): 383 if self._exception: --> 384 raise self._exception 385 else: 386 return self._result /usr/local/lib/python3.6/dist-packages/apache_beam/utils/thread_pool_executor.py in run(self) 42 # If the future wasn't cancelled, then attempt to execute it. 43 try: ---> 44 self._future.set_result(self._fn(*self._fn_args, **self._fn_kwargs)) 45 except BaseException as exc: 46 # Even though Python 2 futures library has #set_exection(), /usr/local/lib/python3.6/dist-packages/apache_beam/runners/portability/fn_api_runner.py in execute(part_map) 2329 self._registered, 2330 cache_token_generator=self._cache_token_generator) -> 2331 return bundle_manager.process_bundle(part_map, expected_outputs) 2332 2333 with UnboundedThreadPoolExecutor() as executor: /usr/local/lib/python3.6/dist-packages/apache_beam/runners/portability/fn_api_runner.py in process_bundle(self, inputs, expected_outputs) 2243 process_bundle_descriptor_id=self._bundle_descriptor.id, 2244 cache_tokens=[next(self._cache_token_generator)])) -> 2245 result_future = self._worker_handler.control_conn.push(process_bundle_req) 2246 2247 split_results = [] # type: List[beam_fn_api_pb2.ProcessBundleSplitResponse] /usr/local/lib/python3.6/dist-packages/apache_beam/runners/portability/fn_api_runner.py in push(self, request) 1557 self._uid_counter += 1 1558 request.instruction_id = 'control_%s' % self._uid_counter -> 1559 response = self.worker.do_instruction(request) 1560 return ControlFuture(request.instruction_id, response) 1561 /usr/local/lib/python3.6/dist-packages/apache_beam/runners/worker/sdk_worker.py in do_instruction(self, request) 413 # E.g. if register is set, this will call self.register(request.register)) 414 return getattr(self, request_type)( --> 415 getattr(request, request_type), request.instruction_id) 416 else: 417 raise NotImplementedError /usr/local/lib/python3.6/dist-packages/apache_beam/runners/worker/sdk_worker.py in process_bundle(self, request, instruction_id) 448 with self.maybe_profile(instruction_id): 449 delayed_applications, requests_finalization = ( --> 450 bundle_processor.process_bundle(instruction_id)) 451 monitoring_infos = bundle_processor.monitoring_infos() 452 monitoring_infos.extend(self.state_cache_metrics_fn()) /usr/local/lib/python3.6/dist-packages/apache_beam/runners/worker/bundle_processor.py in process_bundle(self, instruction_id) 837 for data in data_channel.input_elements(instruction_id, 838 expected_transforms): --> 839 input_op_by_transform_id[data.transform_id].process_encoded(data.data) 840 841 # Finish all operations. /usr/local/lib/python3.6/dist-packages/apache_beam/runners/worker/bundle_processor.py in process_encoded(self, encoded_windowed_values) 214 decoded_value = self.windowed_coder_impl.decode_from_stream( 215 input_stream, True) --> 216 self.output(decoded_value) 217 218 def try_split(self, fraction_of_remainder, total_buffer_size): /usr/local/lib/python3.6/dist-packages/apache_beam/runners/worker/operations.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.worker.operations.Operation.output() /usr/local/lib/python3.6/dist-packages/apache_beam/runners/worker/operations.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.worker.operations.Operation.output() /usr/local/lib/python3.6/dist-packages/apache_beam/runners/worker/operations.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.worker.operations.SingletonConsumerSet.receive() /usr/local/lib/python3.6/dist-packages/apache_beam/runners/worker/operations.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.worker.operations.DoOperation.process() /usr/local/lib/python3.6/dist-packages/apache_beam/runners/worker/operations.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.worker.operations.DoOperation.process() /usr/local/lib/python3.6/dist-packages/apache_beam/runners/common.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.common.DoFnRunner.process() /usr/local/lib/python3.6/dist-packages/apache_beam/runners/common.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.common.DoFnRunner._reraise_augmented() /usr/local/lib/python3.6/dist-packages/future/utils/__init__.py in raise_with_traceback(exc, traceback) 417 if traceback == Ellipsis: 418 _, _, traceback = sys.exc_info() --> 419 raise exc.with_traceback(traceback) 420 421 else: /usr/local/lib/python3.6/dist-packages/apache_beam/runners/common.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.common.DoFnRunner.process() /usr/local/lib/python3.6/dist-packages/apache_beam/runners/common.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.common.PerWindowInvoker.invoke_process() /usr/local/lib/python3.6/dist-packages/apache_beam/runners/common.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.common.PerWindowInvoker._invoke_process_per_window() /usr/local/lib/python3.6/dist-packages/apache_beam/io/iobase.py in process(self, element, init_result) 1080 for e in bundle[1]: # values 1081 writer.write(e) -> 1082 return [window.TimestampedValue(writer.close(), timestamp.MAX_TIMESTAMP)] 1083 1084 /usr/local/lib/python3.6/dist-packages/apache_beam/io/filebasedsink.py in close(self) 421 422 def close(self): --> 423 self.sink.close(self.temp_handle) 424 return self.temp_shard_path /usr/local/lib/python3.6/dist-packages/apache_beam/io/parquetio.py in close(self, writer) 536 def close(self, writer): 537 if len(self._buffer[0]) > 0: --> 538 self._flush_buffer() 539 if self._record_batches_byte_size > 0: 540 self._write_batches(writer) /usr/local/lib/python3.6/dist-packages/apache_beam/io/parquetio.py in _flush_buffer(self) 568 for x in arrays: 569 for b in x.buffers(): --> 570 size = size + b.size 571 self._record_batches_byte_size = self._record_batches_byte_size + size AttributeError: 'NoneType' object has no attribute 'size' [while running 'train/Save to parquet/Write/WriteImpl/WriteBundles'] ```
24
[Question] How to load wikipedia ? Beam runner ? When `nlp.load_dataset('wikipedia')`, I got * `WARNING:nlp.builder:Trying to generate a dataset using Apache Beam, yet no Beam Runner or PipelineOptions() has been provided. Please pass a nlp.DownloadConfig(beam_runner=...) object to the builder.download_and_prepare(download_config=...) method. Default values will be used.` * `AttributeError: 'NoneType' object has no attribute 'size'` Could somebody tell me what should I do ? # Env On Colab, ``` git clone https://github.com/huggingface/nlp cd nlp pip install -q . ``` ``` %pip install -q apache_beam mwparserfromhell -> ERROR: pydrive 1.3.1 has requirement oauth2client>=4.0.0, but you'll have oauth2client 3.0.0 which is incompatible. ERROR: google-api-python-client 1.7.12 has requirement httplib2<1dev,>=0.17.0, but you'll have httplib2 0.12.0 which is incompatible. ERROR: chainer 6.5.0 has requirement typing-extensions<=3.6.6, but you'll have typing-extensions 3.7.4.2 which is incompatible. ``` ``` pip install -q apache-beam[interactive] ERROR: google-colab 1.0.0 has requirement ipython~=5.5.0, but you'll have ipython 5.10.0 which is incompatible. ``` # The whole message ``` WARNING:nlp.builder:Trying to generate a dataset using Apache Beam, yet no Beam Runner or PipelineOptions() has been provided. Please pass a nlp.DownloadConfig(beam_runner=...) object to the builder.download_and_prepare(download_config=...) method. Default values will be used. Downloading and preparing dataset wikipedia/20200501.aa (download: Unknown size, generated: Unknown size, total: Unknown size) to /root/.cache/huggingface/datasets/wikipedia/20200501.aa/1.0.0... --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /usr/local/lib/python3.6/dist-packages/apache_beam/runners/common.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.common.DoFnRunner.process() 44 frames /usr/local/lib/python3.6/dist-packages/apache_beam/runners/common.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.common.PerWindowInvoker.invoke_process() /usr/local/lib/python3.6/dist-packages/apache_beam/runners/common.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.common.PerWindowInvoker._invoke_process_per_window() /usr/local/lib/python3.6/dist-packages/apache_beam/io/iobase.py in process(self, element, init_result) 1081 writer.write(e) -> 1082 return [window.TimestampedValue(writer.close(), timestamp.MAX_TIMESTAMP)] 1083 /usr/local/lib/python3.6/dist-packages/apache_beam/io/filebasedsink.py in close(self) 422 def close(self): --> 423 self.sink.close(self.temp_handle) 424 return self.temp_shard_path /usr/local/lib/python3.6/dist-packages/apache_beam/io/parquetio.py in close(self, writer) 537 if len(self._buffer[0]) > 0: --> 538 self._flush_buffer() 539 if self._record_batches_byte_size > 0: /usr/local/lib/python3.6/dist-packages/apache_beam/io/parquetio.py in _flush_buffer(self) 569 for b in x.buffers(): --> 570 size = size + b.size 571 self._record_batches_byte_size = self._record_batches_byte_size + size AttributeError: 'NoneType' object has no attribute 'size' During handling of the above exception, another exception occurred: AttributeError Traceback (most recent call last) <ipython-input-9-340aabccefff> in <module>() ----> 1 dset = nlp.load_dataset('wikipedia') /usr/local/lib/python3.6/dist-packages/nlp/load.py in load_dataset(path, name, version, data_dir, data_files, split, cache_dir, download_config, download_mode, ignore_verifications, save_infos, **config_kwargs) 518 download_mode=download_mode, 519 ignore_verifications=ignore_verifications, --> 520 save_infos=save_infos, 521 ) 522 /usr/local/lib/python3.6/dist-packages/nlp/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, save_infos, dl_manager, **download_and_prepare_kwargs) 370 verify_infos = not save_infos and not ignore_verifications 371 self._download_and_prepare( --> 372 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 373 ) 374 # Sync info /usr/local/lib/python3.6/dist-packages/nlp/builder.py in _download_and_prepare(self, dl_manager, verify_infos) 770 with beam.Pipeline(runner=beam_runner, options=beam_options,) as pipeline: 771 super(BeamBasedBuilder, self)._download_and_prepare( --> 772 dl_manager, pipeline=pipeline, verify_infos=False 773 ) # TODO{beam} verify infos 774 /usr/local/lib/python3.6/dist-packages/apache_beam/pipeline.py in __exit__(self, exc_type, exc_val, exc_tb) 501 def __exit__(self, exc_type, exc_val, exc_tb): 502 if not exc_type: --> 503 self.run().wait_until_finish() 504 505 def visit(self, visitor): /usr/local/lib/python3.6/dist-packages/apache_beam/pipeline.py in run(self, test_runner_api) 481 return Pipeline.from_runner_api( 482 self.to_runner_api(use_fake_coders=True), self.runner, --> 483 self._options).run(False) 484 485 if self._options.view_as(TypeOptions).runtime_type_check: /usr/local/lib/python3.6/dist-packages/apache_beam/pipeline.py in run(self, test_runner_api) 494 finally: 495 shutil.rmtree(tmpdir) --> 496 return self.runner.run_pipeline(self, self._options) 497 498 def __enter__(self): /usr/local/lib/python3.6/dist-packages/apache_beam/runners/direct/direct_runner.py in run_pipeline(self, pipeline, options) 128 runner = BundleBasedDirectRunner() 129 --> 130 return runner.run_pipeline(pipeline, options) 131 132 /usr/local/lib/python3.6/dist-packages/apache_beam/runners/portability/fn_api_runner.py in run_pipeline(self, pipeline, options) 553 554 self._latest_run_result = self.run_via_runner_api( --> 555 pipeline.to_runner_api(default_environment=self._default_environment)) 556 return self._latest_run_result 557 /usr/local/lib/python3.6/dist-packages/apache_beam/runners/portability/fn_api_runner.py in run_via_runner_api(self, pipeline_proto) 563 # TODO(pabloem, BEAM-7514): Create a watermark manager (that has access to 564 # the teststream (if any), and all the stages). --> 565 return self.run_stages(stage_context, stages) 566 567 @contextlib.contextmanager /usr/local/lib/python3.6/dist-packages/apache_beam/runners/portability/fn_api_runner.py in run_stages(self, stage_context, stages) 704 stage, 705 pcoll_buffers, --> 706 stage_context.safe_coders) 707 metrics_by_stage[stage.name] = stage_results.process_bundle.metrics 708 monitoring_infos_by_stage[stage.name] = ( /usr/local/lib/python3.6/dist-packages/apache_beam/runners/portability/fn_api_runner.py in _run_stage(self, worker_handler_factory, pipeline_components, stage, pcoll_buffers, safe_coders) 1071 cache_token_generator=cache_token_generator) 1072 -> 1073 result, splits = bundle_manager.process_bundle(data_input, data_output) 1074 1075 def input_for(transform_id, input_id): /usr/local/lib/python3.6/dist-packages/apache_beam/runners/portability/fn_api_runner.py in process_bundle(self, inputs, expected_outputs) 2332 2333 with UnboundedThreadPoolExecutor() as executor: -> 2334 for result, split_result in executor.map(execute, part_inputs): 2335 2336 split_result_list += split_result /usr/lib/python3.6/concurrent/futures/_base.py in result_iterator() 584 # Careful not to keep a reference to the popped future 585 if timeout is None: --> 586 yield fs.pop().result() 587 else: 588 yield fs.pop().result(end_time - time.monotonic()) /usr/lib/python3.6/concurrent/futures/_base.py in result(self, timeout) 430 raise CancelledError() 431 elif self._state == FINISHED: --> 432 return self.__get_result() 433 else: 434 raise TimeoutError() /usr/lib/python3.6/concurrent/futures/_base.py in __get_result(self) 382 def __get_result(self): 383 if self._exception: --> 384 raise self._exception 385 else: 386 return self._result /usr/local/lib/python3.6/dist-packages/apache_beam/utils/thread_pool_executor.py in run(self) 42 # If the future wasn't cancelled, then attempt to execute it. 43 try: ---> 44 self._future.set_result(self._fn(*self._fn_args, **self._fn_kwargs)) 45 except BaseException as exc: 46 # Even though Python 2 futures library has #set_exection(), /usr/local/lib/python3.6/dist-packages/apache_beam/runners/portability/fn_api_runner.py in execute(part_map) 2329 self._registered, 2330 cache_token_generator=self._cache_token_generator) -> 2331 return bundle_manager.process_bundle(part_map, expected_outputs) 2332 2333 with UnboundedThreadPoolExecutor() as executor: /usr/local/lib/python3.6/dist-packages/apache_beam/runners/portability/fn_api_runner.py in process_bundle(self, inputs, expected_outputs) 2243 process_bundle_descriptor_id=self._bundle_descriptor.id, 2244 cache_tokens=[next(self._cache_token_generator)])) -> 2245 result_future = self._worker_handler.control_conn.push(process_bundle_req) 2246 2247 split_results = [] # type: List[beam_fn_api_pb2.ProcessBundleSplitResponse] /usr/local/lib/python3.6/dist-packages/apache_beam/runners/portability/fn_api_runner.py in push(self, request) 1557 self._uid_counter += 1 1558 request.instruction_id = 'control_%s' % self._uid_counter -> 1559 response = self.worker.do_instruction(request) 1560 return ControlFuture(request.instruction_id, response) 1561 /usr/local/lib/python3.6/dist-packages/apache_beam/runners/worker/sdk_worker.py in do_instruction(self, request) 413 # E.g. if register is set, this will call self.register(request.register)) 414 return getattr(self, request_type)( --> 415 getattr(request, request_type), request.instruction_id) 416 else: 417 raise NotImplementedError /usr/local/lib/python3.6/dist-packages/apache_beam/runners/worker/sdk_worker.py in process_bundle(self, request, instruction_id) 448 with self.maybe_profile(instruction_id): 449 delayed_applications, requests_finalization = ( --> 450 bundle_processor.process_bundle(instruction_id)) 451 monitoring_infos = bundle_processor.monitoring_infos() 452 monitoring_infos.extend(self.state_cache_metrics_fn()) /usr/local/lib/python3.6/dist-packages/apache_beam/runners/worker/bundle_processor.py in process_bundle(self, instruction_id) 837 for data in data_channel.input_elements(instruction_id, 838 expected_transforms): --> 839 input_op_by_transform_id[data.transform_id].process_encoded(data.data) 840 841 # Finish all operations. /usr/local/lib/python3.6/dist-packages/apache_beam/runners/worker/bundle_processor.py in process_encoded(self, encoded_windowed_values) 214 decoded_value = self.windowed_coder_impl.decode_from_stream( 215 input_stream, True) --> 216 self.output(decoded_value) 217 218 def try_split(self, fraction_of_remainder, total_buffer_size): /usr/local/lib/python3.6/dist-packages/apache_beam/runners/worker/operations.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.worker.operations.Operation.output() /usr/local/lib/python3.6/dist-packages/apache_beam/runners/worker/operations.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.worker.operations.Operation.output() /usr/local/lib/python3.6/dist-packages/apache_beam/runners/worker/operations.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.worker.operations.SingletonConsumerSet.receive() /usr/local/lib/python3.6/dist-packages/apache_beam/runners/worker/operations.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.worker.operations.DoOperation.process() /usr/local/lib/python3.6/dist-packages/apache_beam/runners/worker/operations.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.worker.operations.DoOperation.process() /usr/local/lib/python3.6/dist-packages/apache_beam/runners/common.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.common.DoFnRunner.process() /usr/local/lib/python3.6/dist-packages/apache_beam/runners/common.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.common.DoFnRunner._reraise_augmented() /usr/local/lib/python3.6/dist-packages/future/utils/__init__.py in raise_with_traceback(exc, traceback) 417 if traceback == Ellipsis: 418 _, _, traceback = sys.exc_info() --> 419 raise exc.with_traceback(traceback) 420 421 else: /usr/local/lib/python3.6/dist-packages/apache_beam/runners/common.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.common.DoFnRunner.process() /usr/local/lib/python3.6/dist-packages/apache_beam/runners/common.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.common.PerWindowInvoker.invoke_process() /usr/local/lib/python3.6/dist-packages/apache_beam/runners/common.cpython-36m-x86_64-linux-gnu.so in apache_beam.runners.common.PerWindowInvoker._invoke_process_per_window() /usr/local/lib/python3.6/dist-packages/apache_beam/io/iobase.py in process(self, element, init_result) 1080 for e in bundle[1]: # values 1081 writer.write(e) -> 1082 return [window.TimestampedValue(writer.close(), timestamp.MAX_TIMESTAMP)] 1083 1084 /usr/local/lib/python3.6/dist-packages/apache_beam/io/filebasedsink.py in close(self) 421 422 def close(self): --> 423 self.sink.close(self.temp_handle) 424 return self.temp_shard_path /usr/local/lib/python3.6/dist-packages/apache_beam/io/parquetio.py in close(self, writer) 536 def close(self, writer): 537 if len(self._buffer[0]) > 0: --> 538 self._flush_buffer() 539 if self._record_batches_byte_size > 0: 540 self._write_batches(writer) /usr/local/lib/python3.6/dist-packages/apache_beam/io/parquetio.py in _flush_buffer(self) 568 for x in arrays: 569 for b in x.buffers(): --> 570 size = size + b.size 571 self._record_batches_byte_size = self._record_batches_byte_size + size AttributeError: 'NoneType' object has no attribute 'size' [while running 'train/Save to parquet/Write/WriteImpl/WriteBundles'] ``` I have seen that somebody is hard working on easierly loadable wikipedia. #129 Maybe I should wait a few days for that version ?
https://github.com/huggingface/datasets/issues/186
Weird-ish: Not creating unique caches for different phases
Looks like a duplicate of #120. This is already fixed on master. We'll do a new release on pypi soon
Sample code: ```python import nlp dataset = nlp.load_dataset('boolq') def func1(x): return x def func2(x): return None train_output = dataset["train"].map(func1) valid_output = dataset["validation"].map(func1) print() print(len(train_output), len(valid_output)) # Output: 9427 9427 ``` The map method in both cases seem to be pointing to the same cache, so the latter call based on the validation data will return the processed train data cache. What's weird is that the following doesn't seem to be an issue: ```python train_output = dataset["train"].map(func2) valid_output = dataset["validation"].map(func2) print() print(len(train_output), len(valid_output)) # 9427 3270 ```
20
Weird-ish: Not creating unique caches for different phases Sample code: ```python import nlp dataset = nlp.load_dataset('boolq') def func1(x): return x def func2(x): return None train_output = dataset["train"].map(func1) valid_output = dataset["validation"].map(func1) print() print(len(train_output), len(valid_output)) # Output: 9427 9427 ``` The map method in both cases seem to be pointing to the same cache, so the latter call based on the validation data will return the processed train data cache. What's weird is that the following doesn't seem to be an issue: ```python train_output = dataset["train"].map(func2) valid_output = dataset["validation"].map(func2) print() print(len(train_output), len(valid_output)) # 9427 3270 ``` Looks like a duplicate of #120. This is already fixed on master. We'll do a new release on pypi soon
https://github.com/huggingface/datasets/issues/183
[Bug] labels of glue/ax are all -1
This is the test set given by the Glue benchmark. The labels are not provided, and therefore set to -1.
``` ax = nlp.load_dataset('glue', 'ax') for i in range(30): print(ax['test'][i]['label'], end=', ') ``` ``` -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ```
20
[Bug] labels of glue/ax are all -1 ``` ax = nlp.load_dataset('glue', 'ax') for i in range(30): print(ax['test'][i]['label'], end=', ') ``` ``` -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ``` This is the test set given by the Glue benchmark. The labels are not provided, and therefore set to -1.
https://github.com/huggingface/datasets/issues/181
Cannot upload my own dataset
It's my misunderstanding. I cannot just upload a csv. I need to write a dataset loading script too.
I look into `nlp-cli` and `user.py` to learn how to upload my own data. It is supposed to work like this - Register to get username, password at huggingface.co - `nlp-cli login` and type username, passworld - I have a single file to upload at `./ttc/ttc_freq_extra.csv` - `nlp-cli upload ttc/ttc_freq_extra.csv` But I got this error. ``` 2020-05-21 16:33:52.722464: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1 About to upload file /content/ttc/ttc_freq_extra.csv to S3 under filename ttc/ttc_freq_extra.csv and namespace korakot Proceed? [Y/n] y Uploading... This might take a while if files are large Traceback (most recent call last): File "/usr/local/bin/nlp-cli", line 33, in <module> service.run() File "/usr/local/lib/python3.6/dist-packages/nlp/commands/user.py", line 234, in run token=token, filename=filename, filepath=filepath, organization=self.args.organization File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 141, in presign_and_upload urls = self.presign(token, filename=filename, organization=organization) File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 132, in presign return PresignedUrl(**d) TypeError: __init__() got an unexpected keyword argument 'cdn' ```
18
Cannot upload my own dataset I look into `nlp-cli` and `user.py` to learn how to upload my own data. It is supposed to work like this - Register to get username, password at huggingface.co - `nlp-cli login` and type username, passworld - I have a single file to upload at `./ttc/ttc_freq_extra.csv` - `nlp-cli upload ttc/ttc_freq_extra.csv` But I got this error. ``` 2020-05-21 16:33:52.722464: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1 About to upload file /content/ttc/ttc_freq_extra.csv to S3 under filename ttc/ttc_freq_extra.csv and namespace korakot Proceed? [Y/n] y Uploading... This might take a while if files are large Traceback (most recent call last): File "/usr/local/bin/nlp-cli", line 33, in <module> service.run() File "/usr/local/lib/python3.6/dist-packages/nlp/commands/user.py", line 234, in run token=token, filename=filename, filepath=filepath, organization=self.args.organization File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 141, in presign_and_upload urls = self.presign(token, filename=filename, organization=organization) File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 132, in presign return PresignedUrl(**d) TypeError: __init__() got an unexpected keyword argument 'cdn' ``` It's my misunderstanding. I cannot just upload a csv. I need to write a dataset loading script too.
https://github.com/huggingface/datasets/issues/181
Cannot upload my own dataset
I now try with the sample `datasets/csv` folder. nlp-cli upload csv The error is still the same ``` 2020-05-21 17:20:56.394659: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1 About to upload file /content/csv/csv.py to S3 under filename csv/csv.py and namespace korakot About to upload file /content/csv/dummy/0.0.0/dummy_data.zip to S3 under filename csv/dummy/0.0.0/dummy_data.zip and namespace korakot Proceed? [Y/n] y Uploading... This might take a while if files are large Traceback (most recent call last): File "/usr/local/bin/nlp-cli", line 33, in <module> service.run() File "/usr/local/lib/python3.6/dist-packages/nlp/commands/user.py", line 234, in run token=token, filename=filename, filepath=filepath, organization=self.args.organization File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 141, in presign_and_upload urls = self.presign(token, filename=filename, organization=organization) File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 132, in presign return PresignedUrl(**d) TypeError: __init__() got an unexpected keyword argument 'cdn' ```
I look into `nlp-cli` and `user.py` to learn how to upload my own data. It is supposed to work like this - Register to get username, password at huggingface.co - `nlp-cli login` and type username, passworld - I have a single file to upload at `./ttc/ttc_freq_extra.csv` - `nlp-cli upload ttc/ttc_freq_extra.csv` But I got this error. ``` 2020-05-21 16:33:52.722464: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1 About to upload file /content/ttc/ttc_freq_extra.csv to S3 under filename ttc/ttc_freq_extra.csv and namespace korakot Proceed? [Y/n] y Uploading... This might take a while if files are large Traceback (most recent call last): File "/usr/local/bin/nlp-cli", line 33, in <module> service.run() File "/usr/local/lib/python3.6/dist-packages/nlp/commands/user.py", line 234, in run token=token, filename=filename, filepath=filepath, organization=self.args.organization File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 141, in presign_and_upload urls = self.presign(token, filename=filename, organization=organization) File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 132, in presign return PresignedUrl(**d) TypeError: __init__() got an unexpected keyword argument 'cdn' ```
116
Cannot upload my own dataset I look into `nlp-cli` and `user.py` to learn how to upload my own data. It is supposed to work like this - Register to get username, password at huggingface.co - `nlp-cli login` and type username, passworld - I have a single file to upload at `./ttc/ttc_freq_extra.csv` - `nlp-cli upload ttc/ttc_freq_extra.csv` But I got this error. ``` 2020-05-21 16:33:52.722464: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1 About to upload file /content/ttc/ttc_freq_extra.csv to S3 under filename ttc/ttc_freq_extra.csv and namespace korakot Proceed? [Y/n] y Uploading... This might take a while if files are large Traceback (most recent call last): File "/usr/local/bin/nlp-cli", line 33, in <module> service.run() File "/usr/local/lib/python3.6/dist-packages/nlp/commands/user.py", line 234, in run token=token, filename=filename, filepath=filepath, organization=self.args.organization File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 141, in presign_and_upload urls = self.presign(token, filename=filename, organization=organization) File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 132, in presign return PresignedUrl(**d) TypeError: __init__() got an unexpected keyword argument 'cdn' ``` I now try with the sample `datasets/csv` folder. nlp-cli upload csv The error is still the same ``` 2020-05-21 17:20:56.394659: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1 About to upload file /content/csv/csv.py to S3 under filename csv/csv.py and namespace korakot About to upload file /content/csv/dummy/0.0.0/dummy_data.zip to S3 under filename csv/dummy/0.0.0/dummy_data.zip and namespace korakot Proceed? [Y/n] y Uploading... This might take a while if files are large Traceback (most recent call last): File "/usr/local/bin/nlp-cli", line 33, in <module> service.run() File "/usr/local/lib/python3.6/dist-packages/nlp/commands/user.py", line 234, in run token=token, filename=filename, filepath=filepath, organization=self.args.organization File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 141, in presign_and_upload urls = self.presign(token, filename=filename, organization=organization) File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 132, in presign return PresignedUrl(**d) TypeError: __init__() got an unexpected keyword argument 'cdn' ```
https://github.com/huggingface/datasets/issues/181
Cannot upload my own dataset
We haven't tested the dataset upload feature yet cc @julien-c This is on our short/mid-term roadmap though
I look into `nlp-cli` and `user.py` to learn how to upload my own data. It is supposed to work like this - Register to get username, password at huggingface.co - `nlp-cli login` and type username, passworld - I have a single file to upload at `./ttc/ttc_freq_extra.csv` - `nlp-cli upload ttc/ttc_freq_extra.csv` But I got this error. ``` 2020-05-21 16:33:52.722464: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1 About to upload file /content/ttc/ttc_freq_extra.csv to S3 under filename ttc/ttc_freq_extra.csv and namespace korakot Proceed? [Y/n] y Uploading... This might take a while if files are large Traceback (most recent call last): File "/usr/local/bin/nlp-cli", line 33, in <module> service.run() File "/usr/local/lib/python3.6/dist-packages/nlp/commands/user.py", line 234, in run token=token, filename=filename, filepath=filepath, organization=self.args.organization File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 141, in presign_and_upload urls = self.presign(token, filename=filename, organization=organization) File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 132, in presign return PresignedUrl(**d) TypeError: __init__() got an unexpected keyword argument 'cdn' ```
17
Cannot upload my own dataset I look into `nlp-cli` and `user.py` to learn how to upload my own data. It is supposed to work like this - Register to get username, password at huggingface.co - `nlp-cli login` and type username, passworld - I have a single file to upload at `./ttc/ttc_freq_extra.csv` - `nlp-cli upload ttc/ttc_freq_extra.csv` But I got this error. ``` 2020-05-21 16:33:52.722464: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1 About to upload file /content/ttc/ttc_freq_extra.csv to S3 under filename ttc/ttc_freq_extra.csv and namespace korakot Proceed? [Y/n] y Uploading... This might take a while if files are large Traceback (most recent call last): File "/usr/local/bin/nlp-cli", line 33, in <module> service.run() File "/usr/local/lib/python3.6/dist-packages/nlp/commands/user.py", line 234, in run token=token, filename=filename, filepath=filepath, organization=self.args.organization File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 141, in presign_and_upload urls = self.presign(token, filename=filename, organization=organization) File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 132, in presign return PresignedUrl(**d) TypeError: __init__() got an unexpected keyword argument 'cdn' ``` We haven't tested the dataset upload feature yet cc @julien-c This is on our short/mid-term roadmap though
https://github.com/huggingface/datasets/issues/181
Cannot upload my own dataset
Even if I fix the `TypeError: __init__() got an unexpected keyword argument 'cdn'` error, it looks like it still uploads to `https://s3.amazonaws.com/models.huggingface.co/bert/<namespace>/<dataset_name>` instead of `https://s3.amazonaws.com/datasets.huggingface.co/nlp/<namespace>/<dataset_name>`
I look into `nlp-cli` and `user.py` to learn how to upload my own data. It is supposed to work like this - Register to get username, password at huggingface.co - `nlp-cli login` and type username, passworld - I have a single file to upload at `./ttc/ttc_freq_extra.csv` - `nlp-cli upload ttc/ttc_freq_extra.csv` But I got this error. ``` 2020-05-21 16:33:52.722464: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1 About to upload file /content/ttc/ttc_freq_extra.csv to S3 under filename ttc/ttc_freq_extra.csv and namespace korakot Proceed? [Y/n] y Uploading... This might take a while if files are large Traceback (most recent call last): File "/usr/local/bin/nlp-cli", line 33, in <module> service.run() File "/usr/local/lib/python3.6/dist-packages/nlp/commands/user.py", line 234, in run token=token, filename=filename, filepath=filepath, organization=self.args.organization File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 141, in presign_and_upload urls = self.presign(token, filename=filename, organization=organization) File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 132, in presign return PresignedUrl(**d) TypeError: __init__() got an unexpected keyword argument 'cdn' ```
25
Cannot upload my own dataset I look into `nlp-cli` and `user.py` to learn how to upload my own data. It is supposed to work like this - Register to get username, password at huggingface.co - `nlp-cli login` and type username, passworld - I have a single file to upload at `./ttc/ttc_freq_extra.csv` - `nlp-cli upload ttc/ttc_freq_extra.csv` But I got this error. ``` 2020-05-21 16:33:52.722464: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1 About to upload file /content/ttc/ttc_freq_extra.csv to S3 under filename ttc/ttc_freq_extra.csv and namespace korakot Proceed? [Y/n] y Uploading... This might take a while if files are large Traceback (most recent call last): File "/usr/local/bin/nlp-cli", line 33, in <module> service.run() File "/usr/local/lib/python3.6/dist-packages/nlp/commands/user.py", line 234, in run token=token, filename=filename, filepath=filepath, organization=self.args.organization File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 141, in presign_and_upload urls = self.presign(token, filename=filename, organization=organization) File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 132, in presign return PresignedUrl(**d) TypeError: __init__() got an unexpected keyword argument 'cdn' ``` Even if I fix the `TypeError: __init__() got an unexpected keyword argument 'cdn'` error, it looks like it still uploads to `https://s3.amazonaws.com/models.huggingface.co/bert/<namespace>/<dataset_name>` instead of `https://s3.amazonaws.com/datasets.huggingface.co/nlp/<namespace>/<dataset_name>`
https://github.com/huggingface/datasets/issues/181
Cannot upload my own dataset
@lhoestq The endpoints in https://github.com/huggingface/nlp/blob/master/src/nlp/hf_api.py should be (depending on the type of file): ``` POST /api/datasets/presign GET /api/datasets/listObjs DELETE /api/datasets/deleteObj POST /api/metrics/presign GET /api/metrics/listObjs DELETE /api/metrics/deleteObj ``` In addition to this, @thomwolf cleaned up the objects with dataclasses but you should revert this and re-align to the hf_api that's in this branch of transformers: https://github.com/huggingface/transformers/pull/4632 (so that potential new JSON attributes in the API output don't break existing versions of any library)
I look into `nlp-cli` and `user.py` to learn how to upload my own data. It is supposed to work like this - Register to get username, password at huggingface.co - `nlp-cli login` and type username, passworld - I have a single file to upload at `./ttc/ttc_freq_extra.csv` - `nlp-cli upload ttc/ttc_freq_extra.csv` But I got this error. ``` 2020-05-21 16:33:52.722464: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1 About to upload file /content/ttc/ttc_freq_extra.csv to S3 under filename ttc/ttc_freq_extra.csv and namespace korakot Proceed? [Y/n] y Uploading... This might take a while if files are large Traceback (most recent call last): File "/usr/local/bin/nlp-cli", line 33, in <module> service.run() File "/usr/local/lib/python3.6/dist-packages/nlp/commands/user.py", line 234, in run token=token, filename=filename, filepath=filepath, organization=self.args.organization File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 141, in presign_and_upload urls = self.presign(token, filename=filename, organization=organization) File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 132, in presign return PresignedUrl(**d) TypeError: __init__() got an unexpected keyword argument 'cdn' ```
72
Cannot upload my own dataset I look into `nlp-cli` and `user.py` to learn how to upload my own data. It is supposed to work like this - Register to get username, password at huggingface.co - `nlp-cli login` and type username, passworld - I have a single file to upload at `./ttc/ttc_freq_extra.csv` - `nlp-cli upload ttc/ttc_freq_extra.csv` But I got this error. ``` 2020-05-21 16:33:52.722464: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1 About to upload file /content/ttc/ttc_freq_extra.csv to S3 under filename ttc/ttc_freq_extra.csv and namespace korakot Proceed? [Y/n] y Uploading... This might take a while if files are large Traceback (most recent call last): File "/usr/local/bin/nlp-cli", line 33, in <module> service.run() File "/usr/local/lib/python3.6/dist-packages/nlp/commands/user.py", line 234, in run token=token, filename=filename, filepath=filepath, organization=self.args.organization File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 141, in presign_and_upload urls = self.presign(token, filename=filename, organization=organization) File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 132, in presign return PresignedUrl(**d) TypeError: __init__() got an unexpected keyword argument 'cdn' ``` @lhoestq The endpoints in https://github.com/huggingface/nlp/blob/master/src/nlp/hf_api.py should be (depending on the type of file): ``` POST /api/datasets/presign GET /api/datasets/listObjs DELETE /api/datasets/deleteObj POST /api/metrics/presign GET /api/metrics/listObjs DELETE /api/metrics/deleteObj ``` In addition to this, @thomwolf cleaned up the objects with dataclasses but you should revert this and re-align to the hf_api that's in this branch of transformers: https://github.com/huggingface/transformers/pull/4632 (so that potential new JSON attributes in the API output don't break existing versions of any library)
https://github.com/huggingface/datasets/issues/181
Cannot upload my own dataset
New commands are ``` nlp-cli upload_dataset <path/to/dataset> nlp-cli upload_metric <path/to/metric> nlp-cli s3_datasets {rm, ls} nlp-cli s3_metrics {rm, ls} ``` Closing this issue.
I look into `nlp-cli` and `user.py` to learn how to upload my own data. It is supposed to work like this - Register to get username, password at huggingface.co - `nlp-cli login` and type username, passworld - I have a single file to upload at `./ttc/ttc_freq_extra.csv` - `nlp-cli upload ttc/ttc_freq_extra.csv` But I got this error. ``` 2020-05-21 16:33:52.722464: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1 About to upload file /content/ttc/ttc_freq_extra.csv to S3 under filename ttc/ttc_freq_extra.csv and namespace korakot Proceed? [Y/n] y Uploading... This might take a while if files are large Traceback (most recent call last): File "/usr/local/bin/nlp-cli", line 33, in <module> service.run() File "/usr/local/lib/python3.6/dist-packages/nlp/commands/user.py", line 234, in run token=token, filename=filename, filepath=filepath, organization=self.args.organization File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 141, in presign_and_upload urls = self.presign(token, filename=filename, organization=organization) File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 132, in presign return PresignedUrl(**d) TypeError: __init__() got an unexpected keyword argument 'cdn' ```
22
Cannot upload my own dataset I look into `nlp-cli` and `user.py` to learn how to upload my own data. It is supposed to work like this - Register to get username, password at huggingface.co - `nlp-cli login` and type username, passworld - I have a single file to upload at `./ttc/ttc_freq_extra.csv` - `nlp-cli upload ttc/ttc_freq_extra.csv` But I got this error. ``` 2020-05-21 16:33:52.722464: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1 About to upload file /content/ttc/ttc_freq_extra.csv to S3 under filename ttc/ttc_freq_extra.csv and namespace korakot Proceed? [Y/n] y Uploading... This might take a while if files are large Traceback (most recent call last): File "/usr/local/bin/nlp-cli", line 33, in <module> service.run() File "/usr/local/lib/python3.6/dist-packages/nlp/commands/user.py", line 234, in run token=token, filename=filename, filepath=filepath, organization=self.args.organization File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 141, in presign_and_upload urls = self.presign(token, filename=filename, organization=organization) File "/usr/local/lib/python3.6/dist-packages/nlp/hf_api.py", line 132, in presign return PresignedUrl(**d) TypeError: __init__() got an unexpected keyword argument 'cdn' ``` New commands are ``` nlp-cli upload_dataset <path/to/dataset> nlp-cli upload_metric <path/to/metric> nlp-cli s3_datasets {rm, ls} nlp-cli s3_metrics {rm, ls} ``` Closing this issue.
https://github.com/huggingface/datasets/issues/179
[Feature request] separate split name and split instructions
If your dataset is a collection of sub-datasets, you should probably consider having one config per sub-dataset. For example for Glue, we have sst2, mnli etc. If you want to have multiple train sets (for example one per stage). The easiest solution would be to name them `nlp.Split("train_stage1")`, `nlp.Split("train_stage2")`, etc. or something like that.
Currently, the name of an nlp.NamedSplit is parsed in arrow_reader.py and used as the instruction. This makes it impossible to have several training sets, which can occur when: - A dataset corresponds to a collection of sub-datasets - A dataset was built in stages, adding new examples at each stage Would it be possible to have two separate fields in the Split class, a name /instruction and a unique ID that is used as the key in the builder's split_dict ?
54
[Feature request] separate split name and split instructions Currently, the name of an nlp.NamedSplit is parsed in arrow_reader.py and used as the instruction. This makes it impossible to have several training sets, which can occur when: - A dataset corresponds to a collection of sub-datasets - A dataset was built in stages, adding new examples at each stage Would it be possible to have two separate fields in the Split class, a name /instruction and a unique ID that is used as the key in the builder's split_dict ? If your dataset is a collection of sub-datasets, you should probably consider having one config per sub-dataset. For example for Glue, we have sst2, mnli etc. If you want to have multiple train sets (for example one per stage). The easiest solution would be to name them `nlp.Split("train_stage1")`, `nlp.Split("train_stage2")`, etc. or something like that.
https://github.com/huggingface/datasets/issues/179
[Feature request] separate split name and split instructions
Thanks for the tip! I ended up setting up three different versions of the dataset with their own configs. for the named splits, I was trying with `nlp.Split("train-stage1")`, which fails. Changing to `nlp.Split("train_stage1")` works :) I looked for examples of what works in the code comments, it may be worth adding some examples of valid/invalid names in there?
Currently, the name of an nlp.NamedSplit is parsed in arrow_reader.py and used as the instruction. This makes it impossible to have several training sets, which can occur when: - A dataset corresponds to a collection of sub-datasets - A dataset was built in stages, adding new examples at each stage Would it be possible to have two separate fields in the Split class, a name /instruction and a unique ID that is used as the key in the builder's split_dict ?
58
[Feature request] separate split name and split instructions Currently, the name of an nlp.NamedSplit is parsed in arrow_reader.py and used as the instruction. This makes it impossible to have several training sets, which can occur when: - A dataset corresponds to a collection of sub-datasets - A dataset was built in stages, adding new examples at each stage Would it be possible to have two separate fields in the Split class, a name /instruction and a unique ID that is used as the key in the builder's split_dict ? Thanks for the tip! I ended up setting up three different versions of the dataset with their own configs. for the named splits, I was trying with `nlp.Split("train-stage1")`, which fails. Changing to `nlp.Split("train_stage1")` works :) I looked for examples of what works in the code comments, it may be worth adding some examples of valid/invalid names in there?
https://github.com/huggingface/datasets/issues/168
Loading 'wikitext' dataset fails
Hi, make sure you have a recent version of pyarrow. Are you using it in Google Colab? In this case, this error is probably the same as #128
Loading the 'wikitext' dataset fails with Attribute error: Code to reproduce (From example notebook): import nlp wikitext_dataset = nlp.load_dataset('wikitext') Error: --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-17-d5d9df94b13c> in <module>() 11 12 # Load a dataset and print the first examples in the training set ---> 13 wikitext_dataset = nlp.load_dataset('wikitext') 14 print(wikitext_dataset['train'][0]) 6 frames /usr/local/lib/python3.6/dist-packages/nlp/load.py in load_dataset(path, name, version, data_dir, data_files, split, cache_dir, download_config, download_mode, ignore_verifications, save_infos, **config_kwargs) 518 download_mode=download_mode, 519 ignore_verifications=ignore_verifications, --> 520 save_infos=save_infos, 521 ) 522 /usr/local/lib/python3.6/dist-packages/nlp/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, save_infos, dl_manager, **download_and_prepare_kwargs) 363 verify_infos = not save_infos and not ignore_verifications 364 self._download_and_prepare( --> 365 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 366 ) 367 # Sync info /usr/local/lib/python3.6/dist-packages/nlp/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 416 try: 417 # Prepare split will record examples associated to the split --> 418 self._prepare_split(split_generator, **prepare_split_kwargs) 419 except OSError: 420 raise OSError("Cannot find data file. " + (self.MANUAL_DOWNLOAD_INSTRUCTIONS or "")) /usr/local/lib/python3.6/dist-packages/nlp/builder.py in _prepare_split(self, split_generator) 594 example = self.info.features.encode_example(record) 595 writer.write(example) --> 596 num_examples, num_bytes = writer.finalize() 597 598 assert num_examples == num_examples, f"Expected to write {split_info.num_examples} but wrote {num_examples}" /usr/local/lib/python3.6/dist-packages/nlp/arrow_writer.py in finalize(self, close_stream) 173 def finalize(self, close_stream=True): 174 if self.pa_writer is not None: --> 175 self.write_on_file() 176 self.pa_writer.close() 177 if close_stream: /usr/local/lib/python3.6/dist-packages/nlp/arrow_writer.py in write_on_file(self) 124 else: 125 # All good --> 126 self._write_array_on_file(pa_array) 127 self.current_rows = [] 128 /usr/local/lib/python3.6/dist-packages/nlp/arrow_writer.py in _write_array_on_file(self, pa_array) 93 def _write_array_on_file(self, pa_array): 94 """Write a PyArrow Array""" ---> 95 pa_batch = pa.RecordBatch.from_struct_array(pa_array) 96 self._num_bytes += pa_array.nbytes 97 self.pa_writer.write_batch(pa_batch) AttributeError: type object 'pyarrow.lib.RecordBatch' has no attribute 'from_struct_array'
28
Loading 'wikitext' dataset fails Loading the 'wikitext' dataset fails with Attribute error: Code to reproduce (From example notebook): import nlp wikitext_dataset = nlp.load_dataset('wikitext') Error: --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-17-d5d9df94b13c> in <module>() 11 12 # Load a dataset and print the first examples in the training set ---> 13 wikitext_dataset = nlp.load_dataset('wikitext') 14 print(wikitext_dataset['train'][0]) 6 frames /usr/local/lib/python3.6/dist-packages/nlp/load.py in load_dataset(path, name, version, data_dir, data_files, split, cache_dir, download_config, download_mode, ignore_verifications, save_infos, **config_kwargs) 518 download_mode=download_mode, 519 ignore_verifications=ignore_verifications, --> 520 save_infos=save_infos, 521 ) 522 /usr/local/lib/python3.6/dist-packages/nlp/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, save_infos, dl_manager, **download_and_prepare_kwargs) 363 verify_infos = not save_infos and not ignore_verifications 364 self._download_and_prepare( --> 365 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 366 ) 367 # Sync info /usr/local/lib/python3.6/dist-packages/nlp/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 416 try: 417 # Prepare split will record examples associated to the split --> 418 self._prepare_split(split_generator, **prepare_split_kwargs) 419 except OSError: 420 raise OSError("Cannot find data file. " + (self.MANUAL_DOWNLOAD_INSTRUCTIONS or "")) /usr/local/lib/python3.6/dist-packages/nlp/builder.py in _prepare_split(self, split_generator) 594 example = self.info.features.encode_example(record) 595 writer.write(example) --> 596 num_examples, num_bytes = writer.finalize() 597 598 assert num_examples == num_examples, f"Expected to write {split_info.num_examples} but wrote {num_examples}" /usr/local/lib/python3.6/dist-packages/nlp/arrow_writer.py in finalize(self, close_stream) 173 def finalize(self, close_stream=True): 174 if self.pa_writer is not None: --> 175 self.write_on_file() 176 self.pa_writer.close() 177 if close_stream: /usr/local/lib/python3.6/dist-packages/nlp/arrow_writer.py in write_on_file(self) 124 else: 125 # All good --> 126 self._write_array_on_file(pa_array) 127 self.current_rows = [] 128 /usr/local/lib/python3.6/dist-packages/nlp/arrow_writer.py in _write_array_on_file(self, pa_array) 93 def _write_array_on_file(self, pa_array): 94 """Write a PyArrow Array""" ---> 95 pa_batch = pa.RecordBatch.from_struct_array(pa_array) 96 self._num_bytes += pa_array.nbytes 97 self.pa_writer.write_batch(pa_batch) AttributeError: type object 'pyarrow.lib.RecordBatch' has no attribute 'from_struct_array' Hi, make sure you have a recent version of pyarrow. Are you using it in Google Colab? In this case, this error is probably the same as #128
https://github.com/huggingface/datasets/issues/168
Loading 'wikitext' dataset fails
Hi, The squad bug seems to be fixed, but the loading of the 'wikitext' still suffers from this problem (on Colab with pyarrow=0.17.1).
Loading the 'wikitext' dataset fails with Attribute error: Code to reproduce (From example notebook): import nlp wikitext_dataset = nlp.load_dataset('wikitext') Error: --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-17-d5d9df94b13c> in <module>() 11 12 # Load a dataset and print the first examples in the training set ---> 13 wikitext_dataset = nlp.load_dataset('wikitext') 14 print(wikitext_dataset['train'][0]) 6 frames /usr/local/lib/python3.6/dist-packages/nlp/load.py in load_dataset(path, name, version, data_dir, data_files, split, cache_dir, download_config, download_mode, ignore_verifications, save_infos, **config_kwargs) 518 download_mode=download_mode, 519 ignore_verifications=ignore_verifications, --> 520 save_infos=save_infos, 521 ) 522 /usr/local/lib/python3.6/dist-packages/nlp/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, save_infos, dl_manager, **download_and_prepare_kwargs) 363 verify_infos = not save_infos and not ignore_verifications 364 self._download_and_prepare( --> 365 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 366 ) 367 # Sync info /usr/local/lib/python3.6/dist-packages/nlp/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 416 try: 417 # Prepare split will record examples associated to the split --> 418 self._prepare_split(split_generator, **prepare_split_kwargs) 419 except OSError: 420 raise OSError("Cannot find data file. " + (self.MANUAL_DOWNLOAD_INSTRUCTIONS or "")) /usr/local/lib/python3.6/dist-packages/nlp/builder.py in _prepare_split(self, split_generator) 594 example = self.info.features.encode_example(record) 595 writer.write(example) --> 596 num_examples, num_bytes = writer.finalize() 597 598 assert num_examples == num_examples, f"Expected to write {split_info.num_examples} but wrote {num_examples}" /usr/local/lib/python3.6/dist-packages/nlp/arrow_writer.py in finalize(self, close_stream) 173 def finalize(self, close_stream=True): 174 if self.pa_writer is not None: --> 175 self.write_on_file() 176 self.pa_writer.close() 177 if close_stream: /usr/local/lib/python3.6/dist-packages/nlp/arrow_writer.py in write_on_file(self) 124 else: 125 # All good --> 126 self._write_array_on_file(pa_array) 127 self.current_rows = [] 128 /usr/local/lib/python3.6/dist-packages/nlp/arrow_writer.py in _write_array_on_file(self, pa_array) 93 def _write_array_on_file(self, pa_array): 94 """Write a PyArrow Array""" ---> 95 pa_batch = pa.RecordBatch.from_struct_array(pa_array) 96 self._num_bytes += pa_array.nbytes 97 self.pa_writer.write_batch(pa_batch) AttributeError: type object 'pyarrow.lib.RecordBatch' has no attribute 'from_struct_array'
23
Loading 'wikitext' dataset fails Loading the 'wikitext' dataset fails with Attribute error: Code to reproduce (From example notebook): import nlp wikitext_dataset = nlp.load_dataset('wikitext') Error: --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-17-d5d9df94b13c> in <module>() 11 12 # Load a dataset and print the first examples in the training set ---> 13 wikitext_dataset = nlp.load_dataset('wikitext') 14 print(wikitext_dataset['train'][0]) 6 frames /usr/local/lib/python3.6/dist-packages/nlp/load.py in load_dataset(path, name, version, data_dir, data_files, split, cache_dir, download_config, download_mode, ignore_verifications, save_infos, **config_kwargs) 518 download_mode=download_mode, 519 ignore_verifications=ignore_verifications, --> 520 save_infos=save_infos, 521 ) 522 /usr/local/lib/python3.6/dist-packages/nlp/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, save_infos, dl_manager, **download_and_prepare_kwargs) 363 verify_infos = not save_infos and not ignore_verifications 364 self._download_and_prepare( --> 365 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 366 ) 367 # Sync info /usr/local/lib/python3.6/dist-packages/nlp/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 416 try: 417 # Prepare split will record examples associated to the split --> 418 self._prepare_split(split_generator, **prepare_split_kwargs) 419 except OSError: 420 raise OSError("Cannot find data file. " + (self.MANUAL_DOWNLOAD_INSTRUCTIONS or "")) /usr/local/lib/python3.6/dist-packages/nlp/builder.py in _prepare_split(self, split_generator) 594 example = self.info.features.encode_example(record) 595 writer.write(example) --> 596 num_examples, num_bytes = writer.finalize() 597 598 assert num_examples == num_examples, f"Expected to write {split_info.num_examples} but wrote {num_examples}" /usr/local/lib/python3.6/dist-packages/nlp/arrow_writer.py in finalize(self, close_stream) 173 def finalize(self, close_stream=True): 174 if self.pa_writer is not None: --> 175 self.write_on_file() 176 self.pa_writer.close() 177 if close_stream: /usr/local/lib/python3.6/dist-packages/nlp/arrow_writer.py in write_on_file(self) 124 else: 125 # All good --> 126 self._write_array_on_file(pa_array) 127 self.current_rows = [] 128 /usr/local/lib/python3.6/dist-packages/nlp/arrow_writer.py in _write_array_on_file(self, pa_array) 93 def _write_array_on_file(self, pa_array): 94 """Write a PyArrow Array""" ---> 95 pa_batch = pa.RecordBatch.from_struct_array(pa_array) 96 self._num_bytes += pa_array.nbytes 97 self.pa_writer.write_batch(pa_batch) AttributeError: type object 'pyarrow.lib.RecordBatch' has no attribute 'from_struct_array' Hi, The squad bug seems to be fixed, but the loading of the 'wikitext' still suffers from this problem (on Colab with pyarrow=0.17.1).
https://github.com/huggingface/datasets/issues/168
Loading 'wikitext' dataset fails
When you install `nlp` for the first time on a Colab runtime, it updates the `pyarrow` library that was already on colab. This update shows this message on colab: ``` WARNING: The following packages were previously imported in this runtime: [pyarrow] You must restart the runtime in order to use newly installed versions. ``` You just have to restart the runtime and it should be fine.
Loading the 'wikitext' dataset fails with Attribute error: Code to reproduce (From example notebook): import nlp wikitext_dataset = nlp.load_dataset('wikitext') Error: --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-17-d5d9df94b13c> in <module>() 11 12 # Load a dataset and print the first examples in the training set ---> 13 wikitext_dataset = nlp.load_dataset('wikitext') 14 print(wikitext_dataset['train'][0]) 6 frames /usr/local/lib/python3.6/dist-packages/nlp/load.py in load_dataset(path, name, version, data_dir, data_files, split, cache_dir, download_config, download_mode, ignore_verifications, save_infos, **config_kwargs) 518 download_mode=download_mode, 519 ignore_verifications=ignore_verifications, --> 520 save_infos=save_infos, 521 ) 522 /usr/local/lib/python3.6/dist-packages/nlp/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, save_infos, dl_manager, **download_and_prepare_kwargs) 363 verify_infos = not save_infos and not ignore_verifications 364 self._download_and_prepare( --> 365 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 366 ) 367 # Sync info /usr/local/lib/python3.6/dist-packages/nlp/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 416 try: 417 # Prepare split will record examples associated to the split --> 418 self._prepare_split(split_generator, **prepare_split_kwargs) 419 except OSError: 420 raise OSError("Cannot find data file. " + (self.MANUAL_DOWNLOAD_INSTRUCTIONS or "")) /usr/local/lib/python3.6/dist-packages/nlp/builder.py in _prepare_split(self, split_generator) 594 example = self.info.features.encode_example(record) 595 writer.write(example) --> 596 num_examples, num_bytes = writer.finalize() 597 598 assert num_examples == num_examples, f"Expected to write {split_info.num_examples} but wrote {num_examples}" /usr/local/lib/python3.6/dist-packages/nlp/arrow_writer.py in finalize(self, close_stream) 173 def finalize(self, close_stream=True): 174 if self.pa_writer is not None: --> 175 self.write_on_file() 176 self.pa_writer.close() 177 if close_stream: /usr/local/lib/python3.6/dist-packages/nlp/arrow_writer.py in write_on_file(self) 124 else: 125 # All good --> 126 self._write_array_on_file(pa_array) 127 self.current_rows = [] 128 /usr/local/lib/python3.6/dist-packages/nlp/arrow_writer.py in _write_array_on_file(self, pa_array) 93 def _write_array_on_file(self, pa_array): 94 """Write a PyArrow Array""" ---> 95 pa_batch = pa.RecordBatch.from_struct_array(pa_array) 96 self._num_bytes += pa_array.nbytes 97 self.pa_writer.write_batch(pa_batch) AttributeError: type object 'pyarrow.lib.RecordBatch' has no attribute 'from_struct_array'
66
Loading 'wikitext' dataset fails Loading the 'wikitext' dataset fails with Attribute error: Code to reproduce (From example notebook): import nlp wikitext_dataset = nlp.load_dataset('wikitext') Error: --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-17-d5d9df94b13c> in <module>() 11 12 # Load a dataset and print the first examples in the training set ---> 13 wikitext_dataset = nlp.load_dataset('wikitext') 14 print(wikitext_dataset['train'][0]) 6 frames /usr/local/lib/python3.6/dist-packages/nlp/load.py in load_dataset(path, name, version, data_dir, data_files, split, cache_dir, download_config, download_mode, ignore_verifications, save_infos, **config_kwargs) 518 download_mode=download_mode, 519 ignore_verifications=ignore_verifications, --> 520 save_infos=save_infos, 521 ) 522 /usr/local/lib/python3.6/dist-packages/nlp/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, save_infos, dl_manager, **download_and_prepare_kwargs) 363 verify_infos = not save_infos and not ignore_verifications 364 self._download_and_prepare( --> 365 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 366 ) 367 # Sync info /usr/local/lib/python3.6/dist-packages/nlp/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 416 try: 417 # Prepare split will record examples associated to the split --> 418 self._prepare_split(split_generator, **prepare_split_kwargs) 419 except OSError: 420 raise OSError("Cannot find data file. " + (self.MANUAL_DOWNLOAD_INSTRUCTIONS or "")) /usr/local/lib/python3.6/dist-packages/nlp/builder.py in _prepare_split(self, split_generator) 594 example = self.info.features.encode_example(record) 595 writer.write(example) --> 596 num_examples, num_bytes = writer.finalize() 597 598 assert num_examples == num_examples, f"Expected to write {split_info.num_examples} but wrote {num_examples}" /usr/local/lib/python3.6/dist-packages/nlp/arrow_writer.py in finalize(self, close_stream) 173 def finalize(self, close_stream=True): 174 if self.pa_writer is not None: --> 175 self.write_on_file() 176 self.pa_writer.close() 177 if close_stream: /usr/local/lib/python3.6/dist-packages/nlp/arrow_writer.py in write_on_file(self) 124 else: 125 # All good --> 126 self._write_array_on_file(pa_array) 127 self.current_rows = [] 128 /usr/local/lib/python3.6/dist-packages/nlp/arrow_writer.py in _write_array_on_file(self, pa_array) 93 def _write_array_on_file(self, pa_array): 94 """Write a PyArrow Array""" ---> 95 pa_batch = pa.RecordBatch.from_struct_array(pa_array) 96 self._num_bytes += pa_array.nbytes 97 self.pa_writer.write_batch(pa_batch) AttributeError: type object 'pyarrow.lib.RecordBatch' has no attribute 'from_struct_array' When you install `nlp` for the first time on a Colab runtime, it updates the `pyarrow` library that was already on colab. This update shows this message on colab: ``` WARNING: The following packages were previously imported in this runtime: [pyarrow] You must restart the runtime in order to use newly installed versions. ``` You just have to restart the runtime and it should be fine.
https://github.com/huggingface/datasets/issues/166
Add a method to shuffle a dataset
+1 for the naming convention About the `shuffle` method, from my understanding it should be done in `Dataloader` (better separation between dataset processing - usage)
Could maybe be a `dataset.shuffle(generator=None, seed=None)` signature method. Also, we could maybe have a clear indication of which method modify in-place and which methods return/cache a modified dataset. I kinda like torch conversion of having an underscore suffix for all the methods which modify a dataset in-place. What do you think?
25
Add a method to shuffle a dataset Could maybe be a `dataset.shuffle(generator=None, seed=None)` signature method. Also, we could maybe have a clear indication of which method modify in-place and which methods return/cache a modified dataset. I kinda like torch conversion of having an underscore suffix for all the methods which modify a dataset in-place. What do you think? +1 for the naming convention About the `shuffle` method, from my understanding it should be done in `Dataloader` (better separation between dataset processing - usage)
https://github.com/huggingface/datasets/issues/166
Add a method to shuffle a dataset
+1 for shuffle in `Dataloader`. Some `Dataloader` just store idxs of dataset and just shuffle those idxs, which might(?) be faster than do shuffle in dataset, especially when doing shuffle every epoch. Also +1 for the naming convention.
Could maybe be a `dataset.shuffle(generator=None, seed=None)` signature method. Also, we could maybe have a clear indication of which method modify in-place and which methods return/cache a modified dataset. I kinda like torch conversion of having an underscore suffix for all the methods which modify a dataset in-place. What do you think?
38
Add a method to shuffle a dataset Could maybe be a `dataset.shuffle(generator=None, seed=None)` signature method. Also, we could maybe have a clear indication of which method modify in-place and which methods return/cache a modified dataset. I kinda like torch conversion of having an underscore suffix for all the methods which modify a dataset in-place. What do you think? +1 for shuffle in `Dataloader`. Some `Dataloader` just store idxs of dataset and just shuffle those idxs, which might(?) be faster than do shuffle in dataset, especially when doing shuffle every epoch. Also +1 for the naming convention.
https://github.com/huggingface/datasets/issues/166
Add a method to shuffle a dataset
As you might already know the issue of dataset shuffling came up in the nlp code [walkthrough](https://youtu.be/G3pOvrKkFuk?t=3204) by Yannic Kilcher
Could maybe be a `dataset.shuffle(generator=None, seed=None)` signature method. Also, we could maybe have a clear indication of which method modify in-place and which methods return/cache a modified dataset. I kinda like torch conversion of having an underscore suffix for all the methods which modify a dataset in-place. What do you think?
20
Add a method to shuffle a dataset Could maybe be a `dataset.shuffle(generator=None, seed=None)` signature method. Also, we could maybe have a clear indication of which method modify in-place and which methods return/cache a modified dataset. I kinda like torch conversion of having an underscore suffix for all the methods which modify a dataset in-place. What do you think? As you might already know the issue of dataset shuffling came up in the nlp code [walkthrough](https://youtu.be/G3pOvrKkFuk?t=3204) by Yannic Kilcher
https://github.com/huggingface/datasets/issues/163
[Feature request] Add cos-e v1.0
Sounds good, @mariamabarham do you want to give a look? I think we should have two configurations so we can allow either version of the dataset to be loaded with the `1.0` version being the default maybe. Cc some authors of the great cos-e: @nazneenrajani @bmccann
I noticed the second release of cos-e (v1.11) is included in this repo. I wanted to request inclusion of v1.0, since this is the version on which results are reported on in [the paper](https://www.aclweb.org/anthology/P19-1487/), and v1.11 has noted [annotation](https://github.com/salesforce/cos-e/issues/2) [issues](https://arxiv.org/pdf/2004.14546.pdf).
46
[Feature request] Add cos-e v1.0 I noticed the second release of cos-e (v1.11) is included in this repo. I wanted to request inclusion of v1.0, since this is the version on which results are reported on in [the paper](https://www.aclweb.org/anthology/P19-1487/), and v1.11 has noted [annotation](https://github.com/salesforce/cos-e/issues/2) [issues](https://arxiv.org/pdf/2004.14546.pdf). Sounds good, @mariamabarham do you want to give a look? I think we should have two configurations so we can allow either version of the dataset to be loaded with the `1.0` version being the default maybe. Cc some authors of the great cos-e: @nazneenrajani @bmccann
https://github.com/huggingface/datasets/issues/163
[Feature request] Add cos-e v1.0
cos_e v1.0 is related to CQA v1.0 but only CQA v1.11 dataset is available on their website. Indeed their is lots of ids in cos_e v1, which are not in CQA v1.11 or the other way around. @sarahwie, @thomwolf, @nazneenrajani, @bmccann do you know where I can find CQA v1.0
I noticed the second release of cos-e (v1.11) is included in this repo. I wanted to request inclusion of v1.0, since this is the version on which results are reported on in [the paper](https://www.aclweb.org/anthology/P19-1487/), and v1.11 has noted [annotation](https://github.com/salesforce/cos-e/issues/2) [issues](https://arxiv.org/pdf/2004.14546.pdf).
50
[Feature request] Add cos-e v1.0 I noticed the second release of cos-e (v1.11) is included in this repo. I wanted to request inclusion of v1.0, since this is the version on which results are reported on in [the paper](https://www.aclweb.org/anthology/P19-1487/), and v1.11 has noted [annotation](https://github.com/salesforce/cos-e/issues/2) [issues](https://arxiv.org/pdf/2004.14546.pdf). cos_e v1.0 is related to CQA v1.0 but only CQA v1.11 dataset is available on their website. Indeed their is lots of ids in cos_e v1, which are not in CQA v1.11 or the other way around. @sarahwie, @thomwolf, @nazneenrajani, @bmccann do you know where I can find CQA v1.0
https://github.com/huggingface/datasets/issues/163
[Feature request] Add cos-e v1.0
@mariamabarham I'm also not sure where to find CQA 1.0. Perhaps it's not possible to include this version of the dataset. I'll close the issue if that's the case.
I noticed the second release of cos-e (v1.11) is included in this repo. I wanted to request inclusion of v1.0, since this is the version on which results are reported on in [the paper](https://www.aclweb.org/anthology/P19-1487/), and v1.11 has noted [annotation](https://github.com/salesforce/cos-e/issues/2) [issues](https://arxiv.org/pdf/2004.14546.pdf).
29
[Feature request] Add cos-e v1.0 I noticed the second release of cos-e (v1.11) is included in this repo. I wanted to request inclusion of v1.0, since this is the version on which results are reported on in [the paper](https://www.aclweb.org/anthology/P19-1487/), and v1.11 has noted [annotation](https://github.com/salesforce/cos-e/issues/2) [issues](https://arxiv.org/pdf/2004.14546.pdf). @mariamabarham I'm also not sure where to find CQA 1.0. Perhaps it's not possible to include this version of the dataset. I'll close the issue if that's the case.
https://github.com/huggingface/datasets/issues/163
[Feature request] Add cos-e v1.0
You can now do ```python from nlp import load_dataset cos_e = load_dataset("cos_e", "v1.0") ``` Thanks @mariamabarham !
I noticed the second release of cos-e (v1.11) is included in this repo. I wanted to request inclusion of v1.0, since this is the version on which results are reported on in [the paper](https://www.aclweb.org/anthology/P19-1487/), and v1.11 has noted [annotation](https://github.com/salesforce/cos-e/issues/2) [issues](https://arxiv.org/pdf/2004.14546.pdf).
17
[Feature request] Add cos-e v1.0 I noticed the second release of cos-e (v1.11) is included in this repo. I wanted to request inclusion of v1.0, since this is the version on which results are reported on in [the paper](https://www.aclweb.org/anthology/P19-1487/), and v1.11 has noted [annotation](https://github.com/salesforce/cos-e/issues/2) [issues](https://arxiv.org/pdf/2004.14546.pdf). You can now do ```python from nlp import load_dataset cos_e = load_dataset("cos_e", "v1.0") ``` Thanks @mariamabarham !
https://github.com/huggingface/datasets/issues/163
[Feature request] Add cos-e v1.0
@mariamabarham Just wanted to note that default behavior `cos_e = load_dataset("cos_e")` now loads `v1.0`. Not sure if this is intentional (but the flag specification does work as intended).
I noticed the second release of cos-e (v1.11) is included in this repo. I wanted to request inclusion of v1.0, since this is the version on which results are reported on in [the paper](https://www.aclweb.org/anthology/P19-1487/), and v1.11 has noted [annotation](https://github.com/salesforce/cos-e/issues/2) [issues](https://arxiv.org/pdf/2004.14546.pdf).
28
[Feature request] Add cos-e v1.0 I noticed the second release of cos-e (v1.11) is included in this repo. I wanted to request inclusion of v1.0, since this is the version on which results are reported on in [the paper](https://www.aclweb.org/anthology/P19-1487/), and v1.11 has noted [annotation](https://github.com/salesforce/cos-e/issues/2) [issues](https://arxiv.org/pdf/2004.14546.pdf). @mariamabarham Just wanted to note that default behavior `cos_e = load_dataset("cos_e")` now loads `v1.0`. Not sure if this is intentional (but the flag specification does work as intended).
https://github.com/huggingface/datasets/issues/163
[Feature request] Add cos-e v1.0
> @mariamabarham Just wanted to note that default behavior `cos_e = load_dataset("cos_e")` now loads `v1.0`. Not sure if this is intentional (but the flag specification does work as intended). In the new version of `nlp`, if you try `cos_e = load_dataset("cos_e")` it throws this error: ``` ValueError: Config name is missing. Please pick one among the available configs: ['v1.0', 'v1.11'] Example of usage: `load_dataset('cos_e', 'v1.0')` ``` For datasets with at least two configurations, we now force the user to pick one (no default)
I noticed the second release of cos-e (v1.11) is included in this repo. I wanted to request inclusion of v1.0, since this is the version on which results are reported on in [the paper](https://www.aclweb.org/anthology/P19-1487/), and v1.11 has noted [annotation](https://github.com/salesforce/cos-e/issues/2) [issues](https://arxiv.org/pdf/2004.14546.pdf).
83
[Feature request] Add cos-e v1.0 I noticed the second release of cos-e (v1.11) is included in this repo. I wanted to request inclusion of v1.0, since this is the version on which results are reported on in [the paper](https://www.aclweb.org/anthology/P19-1487/), and v1.11 has noted [annotation](https://github.com/salesforce/cos-e/issues/2) [issues](https://arxiv.org/pdf/2004.14546.pdf). > @mariamabarham Just wanted to note that default behavior `cos_e = load_dataset("cos_e")` now loads `v1.0`. Not sure if this is intentional (but the flag specification does work as intended). In the new version of `nlp`, if you try `cos_e = load_dataset("cos_e")` it throws this error: ``` ValueError: Config name is missing. Please pick one among the available configs: ['v1.0', 'v1.11'] Example of usage: `load_dataset('cos_e', 'v1.0')` ``` For datasets with at least two configurations, we now force the user to pick one (no default)
https://github.com/huggingface/datasets/issues/161
Discussion on version identifier & MockDataLoaderManager for test data
usually you can replace `download` in your dataset script with `download_and_prepare()` - could you share the code for your dataset here? :-)
Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done.
22
Discussion on version identifier & MockDataLoaderManager for test data Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done. usually you can replace `download` in your dataset script with `download_and_prepare()` - could you share the code for your dataset here? :-)
https://github.com/huggingface/datasets/issues/161
Discussion on version identifier & MockDataLoaderManager for test data
I have an initial version here: https://github.com/EntilZha/nlp/tree/master/datasets/qanta Thats pretty close to what I'll do as a PR, but still want to do some more sanity checks/tests (just got tests passing). I figured out how to get all tests passing by adding a download command and some finagling with the data zip https://github.com/EntilZha/nlp/blob/master/tests/utils.py#L127
Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done.
52
Discussion on version identifier & MockDataLoaderManager for test data Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done. I have an initial version here: https://github.com/EntilZha/nlp/tree/master/datasets/qanta Thats pretty close to what I'll do as a PR, but still want to do some more sanity checks/tests (just got tests passing). I figured out how to get all tests passing by adding a download command and some finagling with the data zip https://github.com/EntilZha/nlp/blob/master/tests/utils.py#L127
https://github.com/huggingface/datasets/issues/161
Discussion on version identifier & MockDataLoaderManager for test data
I'm quite positive that you can just replace the `dl_manager.download()` statements here: https://github.com/EntilZha/nlp/blob/4d46443b65f1f756921db8275594e6af008a1de7/datasets/qanta/qanta.py#L194 with `dl_manager.download_and_extract()` even though you don't extract anything. I would prefer to avoid adding more functions to the MockDataLoadManager and keep it as simple as possible (It's already to complex now IMO). Could you check if you can replace the `download()` function?
Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done.
55
Discussion on version identifier & MockDataLoaderManager for test data Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done. I'm quite positive that you can just replace the `dl_manager.download()` statements here: https://github.com/EntilZha/nlp/blob/4d46443b65f1f756921db8275594e6af008a1de7/datasets/qanta/qanta.py#L194 with `dl_manager.download_and_extract()` even though you don't extract anything. I would prefer to avoid adding more functions to the MockDataLoadManager and keep it as simple as possible (It's already to complex now IMO). Could you check if you can replace the `download()` function?
https://github.com/huggingface/datasets/issues/161
Discussion on version identifier & MockDataLoaderManager for test data
I might be doing something wrong, but swapping those two gives this error: ``` > with open(path) as f: E IsADirectoryError: [Errno 21] Is a directory: 'datasets/qanta/dummy/mode=first,char_skip=25/2018.4.18/dummy_data-zip-extracted/dummy_data' src/nlp/datasets/qanta/3d965403133687b819905ead4b69af7bcee365865279b2f797c79f809b4490c3/qanta.py:280: IsADirectoryError During handling of the above exception, another exception occurred: ``` So it seems like the directory name is getting passed. Is this not functioning as expected, or is there some caching happening maybe? I deleted the dummy files and re-ran the import script with no changes. I'm digging a bit in with a debugger, but no clear reason yet
Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done.
88
Discussion on version identifier & MockDataLoaderManager for test data Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done. I might be doing something wrong, but swapping those two gives this error: ``` > with open(path) as f: E IsADirectoryError: [Errno 21] Is a directory: 'datasets/qanta/dummy/mode=first,char_skip=25/2018.4.18/dummy_data-zip-extracted/dummy_data' src/nlp/datasets/qanta/3d965403133687b819905ead4b69af7bcee365865279b2f797c79f809b4490c3/qanta.py:280: IsADirectoryError During handling of the above exception, another exception occurred: ``` So it seems like the directory name is getting passed. Is this not functioning as expected, or is there some caching happening maybe? I deleted the dummy files and re-ran the import script with no changes. I'm digging a bit in with a debugger, but no clear reason yet
https://github.com/huggingface/datasets/issues/161
Discussion on version identifier & MockDataLoaderManager for test data
From what I can tell here: https://github.com/huggingface/nlp/blob/master/tests/utils.py#L115 1. `data_url` is the correct http link 2. `path_to_dummy_data` is a directory, which is causing the issue That path comes from `download_dummy_data`, which I think assumes that the data comes from the zip file, but isn't aware of individual files. So it seems like it data manager needs to be aware if the url its getting is for a file or a zip/directory, and pass this information along. This might happen in `download_dummy_data`, but probably better to happen in `download_and_extract`? Maybe a simple check to see if `os.path.basename` returns the dummy data zip filename, if not then join paths with the basename of the url?
Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done.
112
Discussion on version identifier & MockDataLoaderManager for test data Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done. From what I can tell here: https://github.com/huggingface/nlp/blob/master/tests/utils.py#L115 1. `data_url` is the correct http link 2. `path_to_dummy_data` is a directory, which is causing the issue That path comes from `download_dummy_data`, which I think assumes that the data comes from the zip file, but isn't aware of individual files. So it seems like it data manager needs to be aware if the url its getting is for a file or a zip/directory, and pass this information along. This might happen in `download_dummy_data`, but probably better to happen in `download_and_extract`? Maybe a simple check to see if `os.path.basename` returns the dummy data zip filename, if not then join paths with the basename of the url?
https://github.com/huggingface/datasets/issues/161
Discussion on version identifier & MockDataLoaderManager for test data
I think the dataset script works correctly. Just the dummy data structure seems to be wrong. I will soon add more commands that should make the create of the dummy data easier. I'd recommend that you won't concentrate too much on the dummy data. If you manage to load the dataset correctly via: ```python # use local path to qanta nlp.load_dataset("./datasets/qanta") ``` then feel free to open a PR and we will look into the dummy data problem together :-) Also please make sure that the Version is in the format 1.0.0 (three numbers separated by two points) - not a date.
Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done.
102
Discussion on version identifier & MockDataLoaderManager for test data Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done. I think the dataset script works correctly. Just the dummy data structure seems to be wrong. I will soon add more commands that should make the create of the dummy data easier. I'd recommend that you won't concentrate too much on the dummy data. If you manage to load the dataset correctly via: ```python # use local path to qanta nlp.load_dataset("./datasets/qanta") ``` then feel free to open a PR and we will look into the dummy data problem together :-) Also please make sure that the Version is in the format 1.0.0 (three numbers separated by two points) - not a date.
https://github.com/huggingface/datasets/issues/161
Discussion on version identifier & MockDataLoaderManager for test data
The script loading seems to work fine so I'll work on getting a PR open after a few sanity checks on the data. On version, we currently have it versioned with YYYY.MM.DD scheme so it would be nice to not change that, but will it cause issues?
Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done.
47
Discussion on version identifier & MockDataLoaderManager for test data Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done. The script loading seems to work fine so I'll work on getting a PR open after a few sanity checks on the data. On version, we currently have it versioned with YYYY.MM.DD scheme so it would be nice to not change that, but will it cause issues?
https://github.com/huggingface/datasets/issues/161
Discussion on version identifier & MockDataLoaderManager for test data
> The script loading seems to work fine so I'll work on getting a PR open after a few sanity checks on the data. > > On version, we currently have it versioned with YYYY.MM.DD scheme so it would be nice to not change that, but will it cause issues? It would cause issues for sure for the tests....not sure if it would also cause issues otherwise. I would prefer to keep the same version style as we have for other models. You could for example simply add version 1.0.0 and add a comment with the date you currently use for the versioning. What is your opinion regarding the version here @lhoestq @mariamabarham @thomwolf ?
Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done.
115
Discussion on version identifier & MockDataLoaderManager for test data Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done. > The script loading seems to work fine so I'll work on getting a PR open after a few sanity checks on the data. > > On version, we currently have it versioned with YYYY.MM.DD scheme so it would be nice to not change that, but will it cause issues? It would cause issues for sure for the tests....not sure if it would also cause issues otherwise. I would prefer to keep the same version style as we have for other models. You could for example simply add version 1.0.0 and add a comment with the date you currently use for the versioning. What is your opinion regarding the version here @lhoestq @mariamabarham @thomwolf ?
https://github.com/huggingface/datasets/issues/161
Discussion on version identifier & MockDataLoaderManager for test data
Maybe use the YYYY.MM.DD as the config name ? That's what we are doing for wikipedia
Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done.
16
Discussion on version identifier & MockDataLoaderManager for test data Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done. Maybe use the YYYY.MM.DD as the config name ? That's what we are doing for wikipedia
https://github.com/huggingface/datasets/issues/161
Discussion on version identifier & MockDataLoaderManager for test data
> Maybe use the YYYY.MM.DD as the config name ? That's what we are doing for wikipedia I'm not sure if this will work because the name should be unique and it seems that he has multiple config name in his data with the same version. As @patrickvonplaten suggested, I think you can add a comment about the version in the data description.
Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done.
63
Discussion on version identifier & MockDataLoaderManager for test data Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done. > Maybe use the YYYY.MM.DD as the config name ? That's what we are doing for wikipedia I'm not sure if this will work because the name should be unique and it seems that he has multiple config name in his data with the same version. As @patrickvonplaten suggested, I think you can add a comment about the version in the data description.
https://github.com/huggingface/datasets/issues/161
Discussion on version identifier & MockDataLoaderManager for test data
Actually maybe our versioning format (inherited from tfds) is too strong for what we use it for? We could allow any string maybe? I see it more and more like an identifier for the user that we will back with a serious hashing/versioning system.- so we could let the user quite free on it.
Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done.
54
Discussion on version identifier & MockDataLoaderManager for test data Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done. Actually maybe our versioning format (inherited from tfds) is too strong for what we use it for? We could allow any string maybe? I see it more and more like an identifier for the user that we will back with a serious hashing/versioning system.- so we could let the user quite free on it.
https://github.com/huggingface/datasets/issues/161
Discussion on version identifier & MockDataLoaderManager for test data
I'm good with either putting it in description, adding it to the config, or loosening version formatting. I mostly don't have a full conceptual grasp of what each identifier ends up meaning in the datasets code so hard to evaluate the best approach. For background, the multiple formats is a consequence of: 1. Each example is one multi-sentence trivia question 2. For training, its better to treat each sentence as an example 3. For evaluation, should test on: (1) first sentence, (2) full question, and (3) partial questions (does the model get the question right having seen the first half) We use the date format for version since: (1) we expect some degree of updates since new questions come in every year and (2) the timestamp itself matches the Wikipedia dump that it is dependent on (so similar to the Wikipedia dataset). perhaps this is better discussed in https://github.com/huggingface/nlp/pull/169 or update title?
Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done.
152
Discussion on version identifier & MockDataLoaderManager for test data Hi, I'm working on adding a dataset and ran into an error due to `download` not being defined on `MockDataLoaderManager`, but being defined in `nlp/utils/download_manager.py`. The readme step running this: `RUN_SLOW=1 pytest tests/test_dataset_common.py::DatasetTest::test_load_real_dataset_localmydatasetname` triggers the error. If I can get something to work, I can include it in my data PR once I'm done. I'm good with either putting it in description, adding it to the config, or loosening version formatting. I mostly don't have a full conceptual grasp of what each identifier ends up meaning in the datasets code so hard to evaluate the best approach. For background, the multiple formats is a consequence of: 1. Each example is one multi-sentence trivia question 2. For training, its better to treat each sentence as an example 3. For evaluation, should test on: (1) first sentence, (2) full question, and (3) partial questions (does the model get the question right having seen the first half) We use the date format for version since: (1) we expect some degree of updates since new questions come in every year and (2) the timestamp itself matches the Wikipedia dump that it is dependent on (so similar to the Wikipedia dataset). perhaps this is better discussed in https://github.com/huggingface/nlp/pull/169 or update title?
https://github.com/huggingface/datasets/issues/160
caching in map causes same result to be returned for train, validation and test
Hi @dpressel, thanks for posting your issue! Can you maybe add a complete code snippet that we can copy paste to reproduce the error? For example, I'm not sure where the variable `train_set` comes from in your code and it seems like you are loading multiple datasets at once?
hello, I am working on a program that uses the `nlp` library with the `SST2` dataset. The rough outline of the program is: ``` import nlp as nlp_datasets ... parser.add_argument('--dataset', help='HuggingFace Datasets id', default=['glue', 'sst2'], nargs='+') ... dataset = nlp_datasets.load_dataset(*args.dataset) ... # Create feature vocabs vocabs = create_vocabs(dataset.values(), vectorizers) ... # Create a function to vectorize based on vectorizers and vocabs: print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) # factory method to create a `convert_to_features` function based on vocabs convert_to_features = create_featurizer(vectorizers, vocabs) train_set = train_set.map(convert_to_features, batched=True) train_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) train_loader = torch.utils.data.DataLoader(train_set, batch_size=args.batchsz) valid_set = valid_set.map(convert_to_features, batched=True) valid_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) valid_loader = torch.utils.data.DataLoader(valid_set, batch_size=args.batchsz) test_set = test_set.map(convert_to_features, batched=True) test_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) test_loader = torch.utils.data.DataLoader(test_set, batch_size=args.batchsz) print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) ``` Im not sure if Im using it incorrectly, but the results are not what I expect. Namely, the `.map()` seems to grab the datset from the cache and then loses track of what the specific dataset is, instead using my training data for all datasets: ``` TS 67349 VS 872 ES 1821 TS 67349 VS 67349 ES 67349 ``` The behavior changes if I turn off the caching but then the results fail: ``` train_set = train_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... valid_set = valid_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... test_set = test_set.map(convert_to_features, batched=True, load_from_cache_file=False) ``` Now I get the right set of features back... ``` TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 68/68 [00:00<00:00, 92.78it/s] 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:00<00:00, 75.47it/s] 0%| | 0/2 [00:00<?, ?it/s]TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 2/2 [00:00<00:00, 77.19it/s] ``` but I think its losing track of the original training set: ``` Traceback (most recent call last): File "/home/dpressel/dev/work/baseline/api-examples/layers-classify-hf-datasets.py", line 148, in <module> for x in train_loader: File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 345, in __next__ data = self._next_data() File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 385, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 338, in __getitem__ output_all_columns=self._output_all_columns, File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 294, in _getitem outputs = self._unnest(self._data.slice(key, 1).to_pydict()) File "pyarrow/table.pxi", line 1211, in pyarrow.lib.Table.slice File "pyarrow/public-api.pxi", line 390, in pyarrow.lib.pyarrow_wrap_table File "pyarrow/error.pxi", line 85, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: Column 3: In chunk 0: Invalid: Length spanned by list offsets (15859698) larger than values array (length 100000) Process finished with exit code 1 ``` The full-example program (minus the print stmts) is here: https://github.com/dpressel/mead-baseline/pull/620/files
49
caching in map causes same result to be returned for train, validation and test hello, I am working on a program that uses the `nlp` library with the `SST2` dataset. The rough outline of the program is: ``` import nlp as nlp_datasets ... parser.add_argument('--dataset', help='HuggingFace Datasets id', default=['glue', 'sst2'], nargs='+') ... dataset = nlp_datasets.load_dataset(*args.dataset) ... # Create feature vocabs vocabs = create_vocabs(dataset.values(), vectorizers) ... # Create a function to vectorize based on vectorizers and vocabs: print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) # factory method to create a `convert_to_features` function based on vocabs convert_to_features = create_featurizer(vectorizers, vocabs) train_set = train_set.map(convert_to_features, batched=True) train_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) train_loader = torch.utils.data.DataLoader(train_set, batch_size=args.batchsz) valid_set = valid_set.map(convert_to_features, batched=True) valid_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) valid_loader = torch.utils.data.DataLoader(valid_set, batch_size=args.batchsz) test_set = test_set.map(convert_to_features, batched=True) test_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) test_loader = torch.utils.data.DataLoader(test_set, batch_size=args.batchsz) print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) ``` Im not sure if Im using it incorrectly, but the results are not what I expect. Namely, the `.map()` seems to grab the datset from the cache and then loses track of what the specific dataset is, instead using my training data for all datasets: ``` TS 67349 VS 872 ES 1821 TS 67349 VS 67349 ES 67349 ``` The behavior changes if I turn off the caching but then the results fail: ``` train_set = train_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... valid_set = valid_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... test_set = test_set.map(convert_to_features, batched=True, load_from_cache_file=False) ``` Now I get the right set of features back... ``` TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 68/68 [00:00<00:00, 92.78it/s] 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:00<00:00, 75.47it/s] 0%| | 0/2 [00:00<?, ?it/s]TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 2/2 [00:00<00:00, 77.19it/s] ``` but I think its losing track of the original training set: ``` Traceback (most recent call last): File "/home/dpressel/dev/work/baseline/api-examples/layers-classify-hf-datasets.py", line 148, in <module> for x in train_loader: File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 345, in __next__ data = self._next_data() File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 385, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 338, in __getitem__ output_all_columns=self._output_all_columns, File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 294, in _getitem outputs = self._unnest(self._data.slice(key, 1).to_pydict()) File "pyarrow/table.pxi", line 1211, in pyarrow.lib.Table.slice File "pyarrow/public-api.pxi", line 390, in pyarrow.lib.pyarrow_wrap_table File "pyarrow/error.pxi", line 85, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: Column 3: In chunk 0: Invalid: Length spanned by list offsets (15859698) larger than values array (length 100000) Process finished with exit code 1 ``` The full-example program (minus the print stmts) is here: https://github.com/dpressel/mead-baseline/pull/620/files Hi @dpressel, thanks for posting your issue! Can you maybe add a complete code snippet that we can copy paste to reproduce the error? For example, I'm not sure where the variable `train_set` comes from in your code and it seems like you are loading multiple datasets at once?
https://github.com/huggingface/datasets/issues/160
caching in map causes same result to be returned for train, validation and test
Hi, the full example was listed in the PR above, but here is the exact link: https://github.com/dpressel/mead-baseline/blob/3c1aa3ca062cb23f303ca98ac40b6652b37ee971/api-examples/layers-classify-hf-datasets.py The problem is coming from ``` if cache_file_name is None: # we create a unique hash from the function, current dataset file and the mapping args cache_kwargs = { "with_indices": with_indices, "batched": batched, "batch_size": batch_size, "remove_columns": remove_columns, "keep_in_memory": keep_in_memory, "load_from_cache_file": load_from_cache_file, "cache_file_name": cache_file_name, "writer_batch_size": writer_batch_size, "arrow_schema": arrow_schema, "disable_nullable": disable_nullable, } cache_file_name = self._get_cache_file_path(function, cache_kwargs) ``` The cached value is always the same, but I was able to change that by just renaming the function each time which seems to fix the issue.
hello, I am working on a program that uses the `nlp` library with the `SST2` dataset. The rough outline of the program is: ``` import nlp as nlp_datasets ... parser.add_argument('--dataset', help='HuggingFace Datasets id', default=['glue', 'sst2'], nargs='+') ... dataset = nlp_datasets.load_dataset(*args.dataset) ... # Create feature vocabs vocabs = create_vocabs(dataset.values(), vectorizers) ... # Create a function to vectorize based on vectorizers and vocabs: print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) # factory method to create a `convert_to_features` function based on vocabs convert_to_features = create_featurizer(vectorizers, vocabs) train_set = train_set.map(convert_to_features, batched=True) train_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) train_loader = torch.utils.data.DataLoader(train_set, batch_size=args.batchsz) valid_set = valid_set.map(convert_to_features, batched=True) valid_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) valid_loader = torch.utils.data.DataLoader(valid_set, batch_size=args.batchsz) test_set = test_set.map(convert_to_features, batched=True) test_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) test_loader = torch.utils.data.DataLoader(test_set, batch_size=args.batchsz) print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) ``` Im not sure if Im using it incorrectly, but the results are not what I expect. Namely, the `.map()` seems to grab the datset from the cache and then loses track of what the specific dataset is, instead using my training data for all datasets: ``` TS 67349 VS 872 ES 1821 TS 67349 VS 67349 ES 67349 ``` The behavior changes if I turn off the caching but then the results fail: ``` train_set = train_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... valid_set = valid_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... test_set = test_set.map(convert_to_features, batched=True, load_from_cache_file=False) ``` Now I get the right set of features back... ``` TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 68/68 [00:00<00:00, 92.78it/s] 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:00<00:00, 75.47it/s] 0%| | 0/2 [00:00<?, ?it/s]TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 2/2 [00:00<00:00, 77.19it/s] ``` but I think its losing track of the original training set: ``` Traceback (most recent call last): File "/home/dpressel/dev/work/baseline/api-examples/layers-classify-hf-datasets.py", line 148, in <module> for x in train_loader: File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 345, in __next__ data = self._next_data() File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 385, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 338, in __getitem__ output_all_columns=self._output_all_columns, File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 294, in _getitem outputs = self._unnest(self._data.slice(key, 1).to_pydict()) File "pyarrow/table.pxi", line 1211, in pyarrow.lib.Table.slice File "pyarrow/public-api.pxi", line 390, in pyarrow.lib.pyarrow_wrap_table File "pyarrow/error.pxi", line 85, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: Column 3: In chunk 0: Invalid: Length spanned by list offsets (15859698) larger than values array (length 100000) Process finished with exit code 1 ``` The full-example program (minus the print stmts) is here: https://github.com/dpressel/mead-baseline/pull/620/files
99
caching in map causes same result to be returned for train, validation and test hello, I am working on a program that uses the `nlp` library with the `SST2` dataset. The rough outline of the program is: ``` import nlp as nlp_datasets ... parser.add_argument('--dataset', help='HuggingFace Datasets id', default=['glue', 'sst2'], nargs='+') ... dataset = nlp_datasets.load_dataset(*args.dataset) ... # Create feature vocabs vocabs = create_vocabs(dataset.values(), vectorizers) ... # Create a function to vectorize based on vectorizers and vocabs: print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) # factory method to create a `convert_to_features` function based on vocabs convert_to_features = create_featurizer(vectorizers, vocabs) train_set = train_set.map(convert_to_features, batched=True) train_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) train_loader = torch.utils.data.DataLoader(train_set, batch_size=args.batchsz) valid_set = valid_set.map(convert_to_features, batched=True) valid_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) valid_loader = torch.utils.data.DataLoader(valid_set, batch_size=args.batchsz) test_set = test_set.map(convert_to_features, batched=True) test_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) test_loader = torch.utils.data.DataLoader(test_set, batch_size=args.batchsz) print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) ``` Im not sure if Im using it incorrectly, but the results are not what I expect. Namely, the `.map()` seems to grab the datset from the cache and then loses track of what the specific dataset is, instead using my training data for all datasets: ``` TS 67349 VS 872 ES 1821 TS 67349 VS 67349 ES 67349 ``` The behavior changes if I turn off the caching but then the results fail: ``` train_set = train_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... valid_set = valid_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... test_set = test_set.map(convert_to_features, batched=True, load_from_cache_file=False) ``` Now I get the right set of features back... ``` TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 68/68 [00:00<00:00, 92.78it/s] 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:00<00:00, 75.47it/s] 0%| | 0/2 [00:00<?, ?it/s]TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 2/2 [00:00<00:00, 77.19it/s] ``` but I think its losing track of the original training set: ``` Traceback (most recent call last): File "/home/dpressel/dev/work/baseline/api-examples/layers-classify-hf-datasets.py", line 148, in <module> for x in train_loader: File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 345, in __next__ data = self._next_data() File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 385, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 338, in __getitem__ output_all_columns=self._output_all_columns, File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 294, in _getitem outputs = self._unnest(self._data.slice(key, 1).to_pydict()) File "pyarrow/table.pxi", line 1211, in pyarrow.lib.Table.slice File "pyarrow/public-api.pxi", line 390, in pyarrow.lib.pyarrow_wrap_table File "pyarrow/error.pxi", line 85, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: Column 3: In chunk 0: Invalid: Length spanned by list offsets (15859698) larger than values array (length 100000) Process finished with exit code 1 ``` The full-example program (minus the print stmts) is here: https://github.com/dpressel/mead-baseline/pull/620/files Hi, the full example was listed in the PR above, but here is the exact link: https://github.com/dpressel/mead-baseline/blob/3c1aa3ca062cb23f303ca98ac40b6652b37ee971/api-examples/layers-classify-hf-datasets.py The problem is coming from ``` if cache_file_name is None: # we create a unique hash from the function, current dataset file and the mapping args cache_kwargs = { "with_indices": with_indices, "batched": batched, "batch_size": batch_size, "remove_columns": remove_columns, "keep_in_memory": keep_in_memory, "load_from_cache_file": load_from_cache_file, "cache_file_name": cache_file_name, "writer_batch_size": writer_batch_size, "arrow_schema": arrow_schema, "disable_nullable": disable_nullable, } cache_file_name = self._get_cache_file_path(function, cache_kwargs) ``` The cached value is always the same, but I was able to change that by just renaming the function each time which seems to fix the issue.
https://github.com/huggingface/datasets/issues/160
caching in map causes same result to be returned for train, validation and test
Ok, I think @lhoestq has already found a solution :-) Maybe you can chime in @lhoestq
hello, I am working on a program that uses the `nlp` library with the `SST2` dataset. The rough outline of the program is: ``` import nlp as nlp_datasets ... parser.add_argument('--dataset', help='HuggingFace Datasets id', default=['glue', 'sst2'], nargs='+') ... dataset = nlp_datasets.load_dataset(*args.dataset) ... # Create feature vocabs vocabs = create_vocabs(dataset.values(), vectorizers) ... # Create a function to vectorize based on vectorizers and vocabs: print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) # factory method to create a `convert_to_features` function based on vocabs convert_to_features = create_featurizer(vectorizers, vocabs) train_set = train_set.map(convert_to_features, batched=True) train_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) train_loader = torch.utils.data.DataLoader(train_set, batch_size=args.batchsz) valid_set = valid_set.map(convert_to_features, batched=True) valid_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) valid_loader = torch.utils.data.DataLoader(valid_set, batch_size=args.batchsz) test_set = test_set.map(convert_to_features, batched=True) test_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) test_loader = torch.utils.data.DataLoader(test_set, batch_size=args.batchsz) print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) ``` Im not sure if Im using it incorrectly, but the results are not what I expect. Namely, the `.map()` seems to grab the datset from the cache and then loses track of what the specific dataset is, instead using my training data for all datasets: ``` TS 67349 VS 872 ES 1821 TS 67349 VS 67349 ES 67349 ``` The behavior changes if I turn off the caching but then the results fail: ``` train_set = train_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... valid_set = valid_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... test_set = test_set.map(convert_to_features, batched=True, load_from_cache_file=False) ``` Now I get the right set of features back... ``` TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 68/68 [00:00<00:00, 92.78it/s] 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:00<00:00, 75.47it/s] 0%| | 0/2 [00:00<?, ?it/s]TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 2/2 [00:00<00:00, 77.19it/s] ``` but I think its losing track of the original training set: ``` Traceback (most recent call last): File "/home/dpressel/dev/work/baseline/api-examples/layers-classify-hf-datasets.py", line 148, in <module> for x in train_loader: File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 345, in __next__ data = self._next_data() File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 385, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 338, in __getitem__ output_all_columns=self._output_all_columns, File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 294, in _getitem outputs = self._unnest(self._data.slice(key, 1).to_pydict()) File "pyarrow/table.pxi", line 1211, in pyarrow.lib.Table.slice File "pyarrow/public-api.pxi", line 390, in pyarrow.lib.pyarrow_wrap_table File "pyarrow/error.pxi", line 85, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: Column 3: In chunk 0: Invalid: Length spanned by list offsets (15859698) larger than values array (length 100000) Process finished with exit code 1 ``` The full-example program (minus the print stmts) is here: https://github.com/dpressel/mead-baseline/pull/620/files
16
caching in map causes same result to be returned for train, validation and test hello, I am working on a program that uses the `nlp` library with the `SST2` dataset. The rough outline of the program is: ``` import nlp as nlp_datasets ... parser.add_argument('--dataset', help='HuggingFace Datasets id', default=['glue', 'sst2'], nargs='+') ... dataset = nlp_datasets.load_dataset(*args.dataset) ... # Create feature vocabs vocabs = create_vocabs(dataset.values(), vectorizers) ... # Create a function to vectorize based on vectorizers and vocabs: print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) # factory method to create a `convert_to_features` function based on vocabs convert_to_features = create_featurizer(vectorizers, vocabs) train_set = train_set.map(convert_to_features, batched=True) train_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) train_loader = torch.utils.data.DataLoader(train_set, batch_size=args.batchsz) valid_set = valid_set.map(convert_to_features, batched=True) valid_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) valid_loader = torch.utils.data.DataLoader(valid_set, batch_size=args.batchsz) test_set = test_set.map(convert_to_features, batched=True) test_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) test_loader = torch.utils.data.DataLoader(test_set, batch_size=args.batchsz) print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) ``` Im not sure if Im using it incorrectly, but the results are not what I expect. Namely, the `.map()` seems to grab the datset from the cache and then loses track of what the specific dataset is, instead using my training data for all datasets: ``` TS 67349 VS 872 ES 1821 TS 67349 VS 67349 ES 67349 ``` The behavior changes if I turn off the caching but then the results fail: ``` train_set = train_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... valid_set = valid_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... test_set = test_set.map(convert_to_features, batched=True, load_from_cache_file=False) ``` Now I get the right set of features back... ``` TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 68/68 [00:00<00:00, 92.78it/s] 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:00<00:00, 75.47it/s] 0%| | 0/2 [00:00<?, ?it/s]TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 2/2 [00:00<00:00, 77.19it/s] ``` but I think its losing track of the original training set: ``` Traceback (most recent call last): File "/home/dpressel/dev/work/baseline/api-examples/layers-classify-hf-datasets.py", line 148, in <module> for x in train_loader: File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 345, in __next__ data = self._next_data() File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 385, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 338, in __getitem__ output_all_columns=self._output_all_columns, File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 294, in _getitem outputs = self._unnest(self._data.slice(key, 1).to_pydict()) File "pyarrow/table.pxi", line 1211, in pyarrow.lib.Table.slice File "pyarrow/public-api.pxi", line 390, in pyarrow.lib.pyarrow_wrap_table File "pyarrow/error.pxi", line 85, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: Column 3: In chunk 0: Invalid: Length spanned by list offsets (15859698) larger than values array (length 100000) Process finished with exit code 1 ``` The full-example program (minus the print stmts) is here: https://github.com/dpressel/mead-baseline/pull/620/files Ok, I think @lhoestq has already found a solution :-) Maybe you can chime in @lhoestq
https://github.com/huggingface/datasets/issues/160
caching in map causes same result to be returned for train, validation and test
> Ok, I think @lhoestq has already found a solution :-) Maybe you can chime in @lhoestq Oh, awesome! I see the PR, Ill check it out
hello, I am working on a program that uses the `nlp` library with the `SST2` dataset. The rough outline of the program is: ``` import nlp as nlp_datasets ... parser.add_argument('--dataset', help='HuggingFace Datasets id', default=['glue', 'sst2'], nargs='+') ... dataset = nlp_datasets.load_dataset(*args.dataset) ... # Create feature vocabs vocabs = create_vocabs(dataset.values(), vectorizers) ... # Create a function to vectorize based on vectorizers and vocabs: print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) # factory method to create a `convert_to_features` function based on vocabs convert_to_features = create_featurizer(vectorizers, vocabs) train_set = train_set.map(convert_to_features, batched=True) train_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) train_loader = torch.utils.data.DataLoader(train_set, batch_size=args.batchsz) valid_set = valid_set.map(convert_to_features, batched=True) valid_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) valid_loader = torch.utils.data.DataLoader(valid_set, batch_size=args.batchsz) test_set = test_set.map(convert_to_features, batched=True) test_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) test_loader = torch.utils.data.DataLoader(test_set, batch_size=args.batchsz) print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) ``` Im not sure if Im using it incorrectly, but the results are not what I expect. Namely, the `.map()` seems to grab the datset from the cache and then loses track of what the specific dataset is, instead using my training data for all datasets: ``` TS 67349 VS 872 ES 1821 TS 67349 VS 67349 ES 67349 ``` The behavior changes if I turn off the caching but then the results fail: ``` train_set = train_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... valid_set = valid_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... test_set = test_set.map(convert_to_features, batched=True, load_from_cache_file=False) ``` Now I get the right set of features back... ``` TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 68/68 [00:00<00:00, 92.78it/s] 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:00<00:00, 75.47it/s] 0%| | 0/2 [00:00<?, ?it/s]TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 2/2 [00:00<00:00, 77.19it/s] ``` but I think its losing track of the original training set: ``` Traceback (most recent call last): File "/home/dpressel/dev/work/baseline/api-examples/layers-classify-hf-datasets.py", line 148, in <module> for x in train_loader: File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 345, in __next__ data = self._next_data() File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 385, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 338, in __getitem__ output_all_columns=self._output_all_columns, File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 294, in _getitem outputs = self._unnest(self._data.slice(key, 1).to_pydict()) File "pyarrow/table.pxi", line 1211, in pyarrow.lib.Table.slice File "pyarrow/public-api.pxi", line 390, in pyarrow.lib.pyarrow_wrap_table File "pyarrow/error.pxi", line 85, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: Column 3: In chunk 0: Invalid: Length spanned by list offsets (15859698) larger than values array (length 100000) Process finished with exit code 1 ``` The full-example program (minus the print stmts) is here: https://github.com/dpressel/mead-baseline/pull/620/files
27
caching in map causes same result to be returned for train, validation and test hello, I am working on a program that uses the `nlp` library with the `SST2` dataset. The rough outline of the program is: ``` import nlp as nlp_datasets ... parser.add_argument('--dataset', help='HuggingFace Datasets id', default=['glue', 'sst2'], nargs='+') ... dataset = nlp_datasets.load_dataset(*args.dataset) ... # Create feature vocabs vocabs = create_vocabs(dataset.values(), vectorizers) ... # Create a function to vectorize based on vectorizers and vocabs: print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) # factory method to create a `convert_to_features` function based on vocabs convert_to_features = create_featurizer(vectorizers, vocabs) train_set = train_set.map(convert_to_features, batched=True) train_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) train_loader = torch.utils.data.DataLoader(train_set, batch_size=args.batchsz) valid_set = valid_set.map(convert_to_features, batched=True) valid_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) valid_loader = torch.utils.data.DataLoader(valid_set, batch_size=args.batchsz) test_set = test_set.map(convert_to_features, batched=True) test_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) test_loader = torch.utils.data.DataLoader(test_set, batch_size=args.batchsz) print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) ``` Im not sure if Im using it incorrectly, but the results are not what I expect. Namely, the `.map()` seems to grab the datset from the cache and then loses track of what the specific dataset is, instead using my training data for all datasets: ``` TS 67349 VS 872 ES 1821 TS 67349 VS 67349 ES 67349 ``` The behavior changes if I turn off the caching but then the results fail: ``` train_set = train_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... valid_set = valid_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... test_set = test_set.map(convert_to_features, batched=True, load_from_cache_file=False) ``` Now I get the right set of features back... ``` TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 68/68 [00:00<00:00, 92.78it/s] 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:00<00:00, 75.47it/s] 0%| | 0/2 [00:00<?, ?it/s]TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 2/2 [00:00<00:00, 77.19it/s] ``` but I think its losing track of the original training set: ``` Traceback (most recent call last): File "/home/dpressel/dev/work/baseline/api-examples/layers-classify-hf-datasets.py", line 148, in <module> for x in train_loader: File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 345, in __next__ data = self._next_data() File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 385, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 338, in __getitem__ output_all_columns=self._output_all_columns, File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 294, in _getitem outputs = self._unnest(self._data.slice(key, 1).to_pydict()) File "pyarrow/table.pxi", line 1211, in pyarrow.lib.Table.slice File "pyarrow/public-api.pxi", line 390, in pyarrow.lib.pyarrow_wrap_table File "pyarrow/error.pxi", line 85, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: Column 3: In chunk 0: Invalid: Length spanned by list offsets (15859698) larger than values array (length 100000) Process finished with exit code 1 ``` The full-example program (minus the print stmts) is here: https://github.com/dpressel/mead-baseline/pull/620/files > Ok, I think @lhoestq has already found a solution :-) Maybe you can chime in @lhoestq Oh, awesome! I see the PR, Ill check it out
https://github.com/huggingface/datasets/issues/160
caching in map causes same result to be returned for train, validation and test
The PR should prevent the cache from losing track of the of the dataset type (based on the location of its data). Not sure about your second problem though (cache off).
hello, I am working on a program that uses the `nlp` library with the `SST2` dataset. The rough outline of the program is: ``` import nlp as nlp_datasets ... parser.add_argument('--dataset', help='HuggingFace Datasets id', default=['glue', 'sst2'], nargs='+') ... dataset = nlp_datasets.load_dataset(*args.dataset) ... # Create feature vocabs vocabs = create_vocabs(dataset.values(), vectorizers) ... # Create a function to vectorize based on vectorizers and vocabs: print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) # factory method to create a `convert_to_features` function based on vocabs convert_to_features = create_featurizer(vectorizers, vocabs) train_set = train_set.map(convert_to_features, batched=True) train_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) train_loader = torch.utils.data.DataLoader(train_set, batch_size=args.batchsz) valid_set = valid_set.map(convert_to_features, batched=True) valid_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) valid_loader = torch.utils.data.DataLoader(valid_set, batch_size=args.batchsz) test_set = test_set.map(convert_to_features, batched=True) test_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) test_loader = torch.utils.data.DataLoader(test_set, batch_size=args.batchsz) print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) ``` Im not sure if Im using it incorrectly, but the results are not what I expect. Namely, the `.map()` seems to grab the datset from the cache and then loses track of what the specific dataset is, instead using my training data for all datasets: ``` TS 67349 VS 872 ES 1821 TS 67349 VS 67349 ES 67349 ``` The behavior changes if I turn off the caching but then the results fail: ``` train_set = train_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... valid_set = valid_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... test_set = test_set.map(convert_to_features, batched=True, load_from_cache_file=False) ``` Now I get the right set of features back... ``` TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 68/68 [00:00<00:00, 92.78it/s] 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:00<00:00, 75.47it/s] 0%| | 0/2 [00:00<?, ?it/s]TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 2/2 [00:00<00:00, 77.19it/s] ``` but I think its losing track of the original training set: ``` Traceback (most recent call last): File "/home/dpressel/dev/work/baseline/api-examples/layers-classify-hf-datasets.py", line 148, in <module> for x in train_loader: File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 345, in __next__ data = self._next_data() File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 385, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 338, in __getitem__ output_all_columns=self._output_all_columns, File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 294, in _getitem outputs = self._unnest(self._data.slice(key, 1).to_pydict()) File "pyarrow/table.pxi", line 1211, in pyarrow.lib.Table.slice File "pyarrow/public-api.pxi", line 390, in pyarrow.lib.pyarrow_wrap_table File "pyarrow/error.pxi", line 85, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: Column 3: In chunk 0: Invalid: Length spanned by list offsets (15859698) larger than values array (length 100000) Process finished with exit code 1 ``` The full-example program (minus the print stmts) is here: https://github.com/dpressel/mead-baseline/pull/620/files
31
caching in map causes same result to be returned for train, validation and test hello, I am working on a program that uses the `nlp` library with the `SST2` dataset. The rough outline of the program is: ``` import nlp as nlp_datasets ... parser.add_argument('--dataset', help='HuggingFace Datasets id', default=['glue', 'sst2'], nargs='+') ... dataset = nlp_datasets.load_dataset(*args.dataset) ... # Create feature vocabs vocabs = create_vocabs(dataset.values(), vectorizers) ... # Create a function to vectorize based on vectorizers and vocabs: print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) # factory method to create a `convert_to_features` function based on vocabs convert_to_features = create_featurizer(vectorizers, vocabs) train_set = train_set.map(convert_to_features, batched=True) train_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) train_loader = torch.utils.data.DataLoader(train_set, batch_size=args.batchsz) valid_set = valid_set.map(convert_to_features, batched=True) valid_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) valid_loader = torch.utils.data.DataLoader(valid_set, batch_size=args.batchsz) test_set = test_set.map(convert_to_features, batched=True) test_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) test_loader = torch.utils.data.DataLoader(test_set, batch_size=args.batchsz) print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) ``` Im not sure if Im using it incorrectly, but the results are not what I expect. Namely, the `.map()` seems to grab the datset from the cache and then loses track of what the specific dataset is, instead using my training data for all datasets: ``` TS 67349 VS 872 ES 1821 TS 67349 VS 67349 ES 67349 ``` The behavior changes if I turn off the caching but then the results fail: ``` train_set = train_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... valid_set = valid_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... test_set = test_set.map(convert_to_features, batched=True, load_from_cache_file=False) ``` Now I get the right set of features back... ``` TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 68/68 [00:00<00:00, 92.78it/s] 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:00<00:00, 75.47it/s] 0%| | 0/2 [00:00<?, ?it/s]TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 2/2 [00:00<00:00, 77.19it/s] ``` but I think its losing track of the original training set: ``` Traceback (most recent call last): File "/home/dpressel/dev/work/baseline/api-examples/layers-classify-hf-datasets.py", line 148, in <module> for x in train_loader: File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 345, in __next__ data = self._next_data() File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 385, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 338, in __getitem__ output_all_columns=self._output_all_columns, File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 294, in _getitem outputs = self._unnest(self._data.slice(key, 1).to_pydict()) File "pyarrow/table.pxi", line 1211, in pyarrow.lib.Table.slice File "pyarrow/public-api.pxi", line 390, in pyarrow.lib.pyarrow_wrap_table File "pyarrow/error.pxi", line 85, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: Column 3: In chunk 0: Invalid: Length spanned by list offsets (15859698) larger than values array (length 100000) Process finished with exit code 1 ``` The full-example program (minus the print stmts) is here: https://github.com/dpressel/mead-baseline/pull/620/files The PR should prevent the cache from losing track of the of the dataset type (based on the location of its data). Not sure about your second problem though (cache off).
https://github.com/huggingface/datasets/issues/160
caching in map causes same result to be returned for train, validation and test
Yes, with caching on, it seems to work without the function renaming hack, I mentioned this also in the PR. Thanks!
hello, I am working on a program that uses the `nlp` library with the `SST2` dataset. The rough outline of the program is: ``` import nlp as nlp_datasets ... parser.add_argument('--dataset', help='HuggingFace Datasets id', default=['glue', 'sst2'], nargs='+') ... dataset = nlp_datasets.load_dataset(*args.dataset) ... # Create feature vocabs vocabs = create_vocabs(dataset.values(), vectorizers) ... # Create a function to vectorize based on vectorizers and vocabs: print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) # factory method to create a `convert_to_features` function based on vocabs convert_to_features = create_featurizer(vectorizers, vocabs) train_set = train_set.map(convert_to_features, batched=True) train_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) train_loader = torch.utils.data.DataLoader(train_set, batch_size=args.batchsz) valid_set = valid_set.map(convert_to_features, batched=True) valid_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) valid_loader = torch.utils.data.DataLoader(valid_set, batch_size=args.batchsz) test_set = test_set.map(convert_to_features, batched=True) test_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) test_loader = torch.utils.data.DataLoader(test_set, batch_size=args.batchsz) print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) ``` Im not sure if Im using it incorrectly, but the results are not what I expect. Namely, the `.map()` seems to grab the datset from the cache and then loses track of what the specific dataset is, instead using my training data for all datasets: ``` TS 67349 VS 872 ES 1821 TS 67349 VS 67349 ES 67349 ``` The behavior changes if I turn off the caching but then the results fail: ``` train_set = train_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... valid_set = valid_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... test_set = test_set.map(convert_to_features, batched=True, load_from_cache_file=False) ``` Now I get the right set of features back... ``` TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 68/68 [00:00<00:00, 92.78it/s] 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:00<00:00, 75.47it/s] 0%| | 0/2 [00:00<?, ?it/s]TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 2/2 [00:00<00:00, 77.19it/s] ``` but I think its losing track of the original training set: ``` Traceback (most recent call last): File "/home/dpressel/dev/work/baseline/api-examples/layers-classify-hf-datasets.py", line 148, in <module> for x in train_loader: File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 345, in __next__ data = self._next_data() File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 385, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 338, in __getitem__ output_all_columns=self._output_all_columns, File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 294, in _getitem outputs = self._unnest(self._data.slice(key, 1).to_pydict()) File "pyarrow/table.pxi", line 1211, in pyarrow.lib.Table.slice File "pyarrow/public-api.pxi", line 390, in pyarrow.lib.pyarrow_wrap_table File "pyarrow/error.pxi", line 85, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: Column 3: In chunk 0: Invalid: Length spanned by list offsets (15859698) larger than values array (length 100000) Process finished with exit code 1 ``` The full-example program (minus the print stmts) is here: https://github.com/dpressel/mead-baseline/pull/620/files
21
caching in map causes same result to be returned for train, validation and test hello, I am working on a program that uses the `nlp` library with the `SST2` dataset. The rough outline of the program is: ``` import nlp as nlp_datasets ... parser.add_argument('--dataset', help='HuggingFace Datasets id', default=['glue', 'sst2'], nargs='+') ... dataset = nlp_datasets.load_dataset(*args.dataset) ... # Create feature vocabs vocabs = create_vocabs(dataset.values(), vectorizers) ... # Create a function to vectorize based on vectorizers and vocabs: print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) # factory method to create a `convert_to_features` function based on vocabs convert_to_features = create_featurizer(vectorizers, vocabs) train_set = train_set.map(convert_to_features, batched=True) train_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) train_loader = torch.utils.data.DataLoader(train_set, batch_size=args.batchsz) valid_set = valid_set.map(convert_to_features, batched=True) valid_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) valid_loader = torch.utils.data.DataLoader(valid_set, batch_size=args.batchsz) test_set = test_set.map(convert_to_features, batched=True) test_set.set_format(type='torch', columns=list(vectorizers.keys()) + ['y', 'lengths']) test_loader = torch.utils.data.DataLoader(test_set, batch_size=args.batchsz) print('TS', train_set.num_rows) print('VS', valid_set.num_rows) print('ES', test_set.num_rows) ``` Im not sure if Im using it incorrectly, but the results are not what I expect. Namely, the `.map()` seems to grab the datset from the cache and then loses track of what the specific dataset is, instead using my training data for all datasets: ``` TS 67349 VS 872 ES 1821 TS 67349 VS 67349 ES 67349 ``` The behavior changes if I turn off the caching but then the results fail: ``` train_set = train_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... valid_set = valid_set.map(convert_to_features, batched=True, load_from_cache_file=False) ... test_set = test_set.map(convert_to_features, batched=True, load_from_cache_file=False) ``` Now I get the right set of features back... ``` TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 68/68 [00:00<00:00, 92.78it/s] 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:00<00:00, 75.47it/s] 0%| | 0/2 [00:00<?, ?it/s]TS 67349 VS 872 ES 1821 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 2/2 [00:00<00:00, 77.19it/s] ``` but I think its losing track of the original training set: ``` Traceback (most recent call last): File "/home/dpressel/dev/work/baseline/api-examples/layers-classify-hf-datasets.py", line 148, in <module> for x in train_loader: File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 345, in __next__ data = self._next_data() File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 385, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 338, in __getitem__ output_all_columns=self._output_all_columns, File "/home/dpressel/anaconda3/lib/python3.7/site-packages/nlp/arrow_dataset.py", line 294, in _getitem outputs = self._unnest(self._data.slice(key, 1).to_pydict()) File "pyarrow/table.pxi", line 1211, in pyarrow.lib.Table.slice File "pyarrow/public-api.pxi", line 390, in pyarrow.lib.pyarrow_wrap_table File "pyarrow/error.pxi", line 85, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: Column 3: In chunk 0: Invalid: Length spanned by list offsets (15859698) larger than values array (length 100000) Process finished with exit code 1 ``` The full-example program (minus the print stmts) is here: https://github.com/dpressel/mead-baseline/pull/620/files Yes, with caching on, it seems to work without the function renaming hack, I mentioned this also in the PR. Thanks!
https://github.com/huggingface/datasets/issues/157
nlp.load_dataset() gives "TypeError: list_() takes exactly one argument (2 given)"
You can just run: `val = nlp.load_dataset('squad')` if you want to have just the validation script you can also do: `val = nlp.load_dataset('squad', split="validation")`
I'm trying to load datasets from nlp but there seems to have error saying "TypeError: list_() takes exactly one argument (2 given)" gist can be found here https://gist.github.com/saahiluppal/c4b878f330b10b9ab9762bc0776c0a6a
24
nlp.load_dataset() gives "TypeError: list_() takes exactly one argument (2 given)" I'm trying to load datasets from nlp but there seems to have error saying "TypeError: list_() takes exactly one argument (2 given)" gist can be found here https://gist.github.com/saahiluppal/c4b878f330b10b9ab9762bc0776c0a6a You can just run: `val = nlp.load_dataset('squad')` if you want to have just the validation script you can also do: `val = nlp.load_dataset('squad', split="validation")`
https://github.com/huggingface/datasets/issues/157
nlp.load_dataset() gives "TypeError: list_() takes exactly one argument (2 given)"
If you want to load a local dataset, make sure you include a `./` before the folder name.
I'm trying to load datasets from nlp but there seems to have error saying "TypeError: list_() takes exactly one argument (2 given)" gist can be found here https://gist.github.com/saahiluppal/c4b878f330b10b9ab9762bc0776c0a6a
18
nlp.load_dataset() gives "TypeError: list_() takes exactly one argument (2 given)" I'm trying to load datasets from nlp but there seems to have error saying "TypeError: list_() takes exactly one argument (2 given)" gist can be found here https://gist.github.com/saahiluppal/c4b878f330b10b9ab9762bc0776c0a6a If you want to load a local dataset, make sure you include a `./` before the folder name.
https://github.com/huggingface/datasets/issues/157
nlp.load_dataset() gives "TypeError: list_() takes exactly one argument (2 given)"
This happens by just doing run all cells on colab ... I assumed the colab example is broken.
I'm trying to load datasets from nlp but there seems to have error saying "TypeError: list_() takes exactly one argument (2 given)" gist can be found here https://gist.github.com/saahiluppal/c4b878f330b10b9ab9762bc0776c0a6a
18
nlp.load_dataset() gives "TypeError: list_() takes exactly one argument (2 given)" I'm trying to load datasets from nlp but there seems to have error saying "TypeError: list_() takes exactly one argument (2 given)" gist can be found here https://gist.github.com/saahiluppal/c4b878f330b10b9ab9762bc0776c0a6a This happens by just doing run all cells on colab ... I assumed the colab example is broken.
https://github.com/huggingface/datasets/issues/157
nlp.load_dataset() gives "TypeError: list_() takes exactly one argument (2 given)"
Oh I see you might have a wrong version of pyarrow install on the colab -> could you try the following. Add these lines to the beginning of your notebook, restart the runtime and run it again: ``` !pip uninstall -y -qq pyarrow !pip uninstall -y -qq nlp !pip install -qq git+https://github.com/huggingface/nlp.git ```
I'm trying to load datasets from nlp but there seems to have error saying "TypeError: list_() takes exactly one argument (2 given)" gist can be found here https://gist.github.com/saahiluppal/c4b878f330b10b9ab9762bc0776c0a6a
53
nlp.load_dataset() gives "TypeError: list_() takes exactly one argument (2 given)" I'm trying to load datasets from nlp but there seems to have error saying "TypeError: list_() takes exactly one argument (2 given)" gist can be found here https://gist.github.com/saahiluppal/c4b878f330b10b9ab9762bc0776c0a6a Oh I see you might have a wrong version of pyarrow install on the colab -> could you try the following. Add these lines to the beginning of your notebook, restart the runtime and run it again: ``` !pip uninstall -y -qq pyarrow !pip uninstall -y -qq nlp !pip install -qq git+https://github.com/huggingface/nlp.git ```
https://github.com/huggingface/datasets/issues/157
nlp.load_dataset() gives "TypeError: list_() takes exactly one argument (2 given)"
> Oh I see you might have a wrong version of pyarrow install on the colab -> could you try the following. Add these lines to the beginning of your notebook, restart the runtime and run it again: > > ``` > !pip uninstall -y -qq pyarrow > !pip uninstall -y -qq nlp > !pip install -qq git+https://github.com/huggingface/nlp.git > ``` Tried, having the same error.
I'm trying to load datasets from nlp but there seems to have error saying "TypeError: list_() takes exactly one argument (2 given)" gist can be found here https://gist.github.com/saahiluppal/c4b878f330b10b9ab9762bc0776c0a6a
65
nlp.load_dataset() gives "TypeError: list_() takes exactly one argument (2 given)" I'm trying to load datasets from nlp but there seems to have error saying "TypeError: list_() takes exactly one argument (2 given)" gist can be found here https://gist.github.com/saahiluppal/c4b878f330b10b9ab9762bc0776c0a6a > Oh I see you might have a wrong version of pyarrow install on the colab -> could you try the following. Add these lines to the beginning of your notebook, restart the runtime and run it again: > > ``` > !pip uninstall -y -qq pyarrow > !pip uninstall -y -qq nlp > !pip install -qq git+https://github.com/huggingface/nlp.git > ``` Tried, having the same error.
https://github.com/huggingface/datasets/issues/157
nlp.load_dataset() gives "TypeError: list_() takes exactly one argument (2 given)"
Can you post a link here of your colab? I'll make a copy of it and see what's wrong
I'm trying to load datasets from nlp but there seems to have error saying "TypeError: list_() takes exactly one argument (2 given)" gist can be found here https://gist.github.com/saahiluppal/c4b878f330b10b9ab9762bc0776c0a6a
19
nlp.load_dataset() gives "TypeError: list_() takes exactly one argument (2 given)" I'm trying to load datasets from nlp but there seems to have error saying "TypeError: list_() takes exactly one argument (2 given)" gist can be found here https://gist.github.com/saahiluppal/c4b878f330b10b9ab9762bc0776c0a6a Can you post a link here of your colab? I'll make a copy of it and see what's wrong