Make datasets<=2.2.2 for a quick fix for test failures
Author: ydshieh
Pull request: yes

# What does this PR do?

Currently, we have a lot of test failures (scheduled CI) with

```
FileNotFoundError: Unable to find '/transformers/tests/extended/../fixtures/tests_samples/wmt_en_ro/train.json' at /transformers
```
which is caused by the release of `datasets 2.3.x`.

This PR changes to "datasets<=2.2.2" temporarily to avoid the test failures.

Comments:
A full error message is

```
2022-06-15T03:19:39.4149310Z =================================== FAILURES ===================================
2022-06-15T03:19:39.4149596Z _______________________ TestTrainerExt.test_run_seq2seq ________________________
2022-06-15T03:19:39.4149773Z 
2022-06-15T03:19:39.4150008Z self = <test_trainer_ext.TestTrainerExt testMethod=test_run_seq2seq>
2022-06-15T03:19:39.4150218Z 
2022-06-15T03:19:39.4150293Z     @slow
2022-06-15T03:19:39.4150745Z     def test_run_seq2seq(self):
2022-06-15T03:19:39.4151132Z >       output_dir = self.run_trainer(
2022-06-15T03:19:39.4151468Z             eval_steps=2,
2022-06-15T03:19:39.4151820Z             max_len=128,
2022-06-15T03:19:39.4152199Z             model_name=MARIAN_MODEL,
2022-06-15T03:19:39.4153137Z             learning_rate=3e-4,
2022-06-15T03:19:39.4153380Z             num_train_epochs=10,
2022-06-15T03:19:39.4154587Z             distributed=False,
2022-06-15T03:19:39.4155199Z         )
2022-06-15T03:19:39.4155329Z 
2022-06-15T03:19:39.4155456Z tests/extended/test_trainer_ext.py:180: 
2022-06-15T03:19:39.4155723Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2022-06-15T03:19:39.4156015Z tests/extended/test_trainer_ext.py:375: in run_trainer
2022-06-15T03:19:39.4156267Z     main()
2022-06-15T03:19:39.4156535Z examples/pytorch/translation/run_translation.py:346: in main
2022-06-15T03:19:39.4156923Z     raw_datasets = load_dataset(
2022-06-15T03:19:39.4157383Z /usr/local/lib/python3.8/dist-packages/datasets/load.py:1656: in load_dataset
2022-06-15T03:19:39.4157724Z     builder_instance = load_dataset_builder(
2022-06-15T03:19:39.4158171Z /usr/local/lib/python3.8/dist-packages/datasets/load.py:1439: in load_dataset_builder
2022-06-15T03:19:39.4158514Z     dataset_module = dataset_module_factory(
2022-06-15T03:19:39.4159311Z /usr/local/lib/python3.8/dist-packages/datasets/load.py:1097: in dataset_module_factory
2022-06-15T03:19:39.4159770Z     return PackagedDatasetModuleFactory(
2022-06-15T03:19:39.4160536Z /usr/local/lib/python3.8/dist-packages/datasets/load.py:743: in get_module
2022-06-15T03:19:39.4161066Z     data_files = DataFilesDict.from_local_or_remote(
2022-06-15T03:19:39.4161777Z /usr/local/lib/python3.8/dist-packages/datasets/data_files.py:588: in from_local_or_remote
2022-06-15T03:19:39.4162298Z     DataFilesList.from_local_or_remote(
2022-06-15T03:19:39.4163081Z /usr/local/lib/python3.8/dist-packages/datasets/data_files.py:556: in from_local_or_remote
2022-06-15T03:19:39.4163523Z     data_files = resolve_patterns_locally_or_by_urls(base_path, patterns, allowed_extensions)
2022-06-15T03:19:39.4164078Z /usr/local/lib/python3.8/dist-packages/datasets/data_files.py:194: in resolve_patterns_locally_or_by_urls
2022-06-15T03:19:39.4164508Z     for path in _resolve_single_pattern_locally(base_path, pattern, allowed_extensions):
2022-06-15T03:19:39.4164839Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2022-06-15T03:19:39.4164997Z 
2022-06-15T03:19:39.4165147Z base_path = '/transformers'
2022-06-15T03:19:39.4165579Z pattern = '/transformers/tests/extended/../fixtures/tests_samples/wmt_en_ro/train.json'
2022-06-15T03:19:39.4165899Z allowed_extensions = None
2022-06-15T03:19:39.4166043Z 
2022-06-15T03:19:39.4166160Z     def _resolve_single_pattern_locally(
2022-06-15T03:19:39.4166478Z         base_path: str, pattern: str, allowed_extensions: Optional[List[str]] = None
2022-06-15T03:19:39.4166811Z     ) -> List[Path]:
2022-06-15T03:19:39.4167017Z         """
2022-06-15T03:19:39.4167301Z         Return the absolute paths to all the files that match the given patterns.
2022-06-15T03:19:39.4167622Z         It also supports absolute paths in patterns.
2022-06-15T03:19:39.4167923Z         If an URL is passed, it is returned as is.
2022-06-15T03:19:39.4168165Z         """
2022-06-15T03:19:39.4168412Z         pattern = os.path.join(base_path, pattern)
2022-06-15T03:19:39.4168678Z         data_files_ignore = FILES_TO_IGNORE
2022-06-15T03:19:39.4168931Z         fs = LocalFileSystem()
2022-06-15T03:19:39.4169275Z         glob_iter = [PurePath(filepath) for filepath in fs.glob(pattern) if fs.isfile(filepath)]
2022-06-15T03:19:39.4169591Z         matched_paths = [
2022-06-15T03:19:39.4169981Z             Path(filepath).resolve()
2022-06-15T03:19:39.4170218Z             for filepath in glob_iter
2022-06-15T03:19:39.4170568Z             if filepath.name not in data_files_ignore and not any(part.startswith((".", "__")) for part in filepath.parts)
2022-06-15T03:19:39.4170869Z         ]
2022-06-15T03:19:39.4171068Z         if allowed_extensions is not None:
2022-06-15T03:19:39.4171286Z             out = [
2022-06-15T03:19:39.4171477Z                 filepath
2022-06-15T03:19:39.4171706Z                 for filepath in matched_paths
2022-06-15T03:19:39.4172173Z                 if any(suffix[1:] in allowed_extensions for suffix in filepath.suffixes)
2022-06-15T03:19:39.4172436Z             ]
2022-06-15T03:19:39.4172649Z             if len(out) < len(matched_paths):
2022-06-15T03:19:39.4173032Z                 invalid_matched_files = list(set(matched_paths) - set(out))
2022-06-15T03:19:39.4173296Z                 logger.info(
2022-06-15T03:19:39.4173809Z                     f"Some files matched the pattern '{pattern}' at {Path(base_path).resolve()} but don't have valid data file extensions: {invalid_matched_files}"
2022-06-15T03:19:39.4174147Z                 )
2022-06-15T03:19:39.4174332Z         else:
2022-06-15T03:19:39.4174527Z             out = matched_paths
2022-06-15T03:19:39.4174772Z         if not out and not contains_wildcards(pattern):
2022-06-15T03:19:39.4175185Z             error_msg = f"Unable to find '{pattern}' at {Path(base_path).resolve()}"
2022-06-15T03:19:39.4175489Z             if allowed_extensions is not None:
2022-06-15T03:19:39.4175807Z                 error_msg += f" with any supported extension {list(allowed_extensions)}"
2022-06-15T03:19:39.4176181Z >           raise FileNotFoundError(error_msg)
2022-06-15T03:19:39.4176703Z E           FileNotFoundError: Unable to find '/transformers/tests/extended/../fixtures/tests_samples/wmt_en_ro/train.json' at /transformers
2022-06-15T03:19:39.4176964Z 
2022-06-15T03:19:39.4177238Z /usr/local/lib/python3.8/dist-packages/datasets/data_files.py:144: FileNotFoundError
```

This shouldn't be merged before the release branch is cut, to avoid the pin being in the release.

@lhoestq 

Are you already aware of this issue (regarding `load_dataset`)? Otherwise I can try to make a simple reproducible example. Thank you :-)

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

Do you think it is worth changing Dockerfile (for testing) to install datasets 2.2.2 for now? And discard this PR maybe ?

superseded by https://github.com/huggingface/transformers/pull/17721

and https://github.com/huggingface/datasets/pull/4505