GitHub issue #5749: AttributeError: 'Version' object has no attribute 'match'
State: closed | Created: 2023-04-14T10:48:06Z

### Describe the bug

When I run 
from datasets import load_dataset
data = load_dataset("visual_genome", 'region_descriptions_v1.2.0')

AttributeError: 'Version' object has no attribute 'match'

### Steps to reproduce the bug

from datasets import load_dataset
data = load_dataset("visual_genome", 'region_descriptions_v1.2.0')

### Expected behavior

This is error trace:
Downloading and preparing dataset visual_genome/region_descriptions_v1.2.0 to C:/Users/Acer/.cache/huggingface/datasets/visual_genome/region_descriptions_v1.2.0/1.2.0/136fe5b83f6691884566c5530313288171e053a3b33bfe3ea2e4c8b39abaf7f3...
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[6], line 1
----> 1 data = load_dataset("visual_genome", 'region_descriptions_v1.2.0')

File ~\.conda\envs\aai\Lib\site-packages\datasets\load.py:1791, in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, verification_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, num_proc, storage_options, **config_kwargs)
   1788 try_from_hf_gcs = path not in _PACKAGED_DATASETS_MODULES
   1790 # Download and prepare data
-> 1791 builder_instance.download_and_prepare(
   1792     download_config=download_config,
   1793     download_mode=download_mode,
   1794     verification_mode=verification_mode,
   1795     try_from_hf_gcs=try_from_hf_gcs,
   1796     num_proc=num_proc,
   1797     storage_options=storage_options,
   1798 )
   1800 # Build dataset for splits
   1801 keep_in_memory = (
   1802     keep_in_memory if keep_in_memory is not None else is_small_dataset(builder_instance.info.dataset_size)
   1803 )

File ~\.conda\envs\aai\Lib\site-packages\datasets\builder.py:891, in DatasetBuilder.download_and_prepare(self, output_dir, download_config, download_mode, verification_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, file_format, max_shard_size, num_proc, storage_options, **download_and_prepare_kwargs)
    889     if num_proc is not None:
    890         prepare_split_kwargs["num_proc"] = num_proc
--> 891     self._download_and_prepare(
    892         dl_manager=dl_manager,
    893         verification_mode=verification_mode,
    894         **prepare_split_kwargs,
    895         **download_and_prepare_kwargs,
    896     )
    897 # Sync info
    898 self.info.dataset_size = sum(split.num_bytes for split in self.info.splits.values())

File ~\.conda\envs\aai\Lib\site-packages\datasets\builder.py:1651, in GeneratorBasedBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_splits_kwargs)
   1650 def _download_and_prepare(self, dl_manager, verification_mode, **prepare_splits_kwargs):
-> 1651     super()._download_and_prepare(
   1652         dl_manager,
   1653         verification_mode,
   1654         check_duplicate_keys=verification_mode == VerificationMode.BASIC_CHECKS
   1655         or verification_mode == VerificationMode.ALL_CHECKS,
   1656         **prepare_splits_kwargs,
   1657     )

File ~\.conda\envs\aai\Lib\site-packages\datasets\builder.py:964, in DatasetBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_split_kwargs)
    962 split_dict = SplitDict(dataset_name=self.name)
    963 split_generators_kwargs = self._make_split_generators_kwargs(prepare_split_kwargs)
--> 964 split_generators = self._split_generators(dl_manager, **split_generators_kwargs)
    966 # Checksums verification
    967 if verification_mode == VerificationMode.ALL_CHECKS and dl_manager.record_checksums:

File ~\.cache\huggingface\modules\datasets_modules\datasets\visual_genome\136fe5b83f6691884566c5530313288171e053a3b33bfe3ea2e4c8b39abaf7f3\visual_genome.py:377, in VisualGenome._split_generators(self, dl_manager)
    375 def _split_generators(self, dl_manager):
    376     # Download image meta datas.
--> 377     image_metadatas_dir = dl_manager.download_and_extract(self.config.image_metadata_url)
    378     image_metadatas_file = os.path.join(
    379         image_metadatas_dir, _get_decompressed_filename_from_url(self.config.image_metadata_url)
    380     )
    382     # Download annotations

File ~\.cache\huggingface\modules\datasets_modules\datasets\visual_genome\136fe5b83f6691884566c5530313288171e053a3b33bfe3ea2e4c8b39abaf7f3\visual_genome.py:328, in VisualGenomeConfig.image_metadata_url(self)
    326 @property
    327 def image_metadata_url(self):
--> 328     if not self.version.match(_LATEST_VERSIONS["image_metadata"]):
    329         logger.warning(
    330             f"Latest image metadata version is {_LATEST_VERSIONS['image_metadata']}. Trying to generate a dataset of version: {self.version}. Please double check that image data are unchanged between the two versions."
    331         )
    332     return f"{_BASE_ANNOTATION_URL}/image_data.json.zip"

### Environment info

datasets                  2.11.0
python                    3.11.3