def download_inaturalist(self):
        """Download and extract inaturalist data

        :param extra: download also additional INATURALIST data not strictly
            required by the data loader.
        """

        data2download = train_data if self.trainval else test_data

        for name in data2download:
            self.log.info("Downloading " + name[1] + "...")
            save_name = os.path.join(self.data_folder, name[0])
            if not os.path.exists(save_name):
                with TqdmUpTo(
                    unit="B",
                    unit_scale=True,
                    unit_divisor=1024,
                    miniters=1,
                    desc=name[0],
                ) as t:
                    urlretrieve(name[1], save_name, reporthook=t.update_to)
            else:
                self.log.info("Skipping download, exists: ", save_name)

            if name[0].endswith("tar.gz"):
                untar_save_name = os.path.join(
                    self.data_folder, ".".join(name[0].split(".")[:-2])
                )
                if not os.path.exists(untar_save_name):
                    with tarfile.open(
                        os.path.join(self.data_folder, name[0]), "r:gz"
                    ) as tar:
                        self.log.info("Extracting INATURALIST images...")
                        tar.extractall(self.data_folder)
                        self.log.info("Done!")
                else:
                    self.log.info("Skipping untarring, exists: ", save_name)
        self.log.info("Download complete.")
Download and extract inaturalist data

        :param extra: download also additional INATURALIST data not strictly
            required by the data loader.
        
avalanche/benchmarks/datasets/inaturalist/inaturalist_data.py