|
31 | 31 | "\n", |
32 | 32 | "cifar10_dataset_folder_path = 'cifar-10-batches-py'\n", |
33 | 33 | "\n", |
| 34 | + "# Use Floyd's cifar-10 dataset if present\n", |
| 35 | + "floyd_cifar10_location = '/input/cifar-10/python.tar.gz'\n", |
| 36 | + "if isfile(floyd_cifar10_location):\n", |
| 37 | + " tar_gz_path = floyd_cifar10_location\n", |
| 38 | + "else:\n", |
| 39 | + " tar_gz_path = 'cifar-10-python.tar.gz'\n", |
| 40 | + "\n", |
34 | 41 | "class DLProgress(tqdm):\n", |
35 | 42 | " last_block = 0\n", |
36 | 43 | "\n", |
|
39 | 46 | " self.update((block_num - self.last_block) * block_size)\n", |
40 | 47 | " self.last_block = block_num\n", |
41 | 48 | "\n", |
42 | | - "if not isfile('cifar-10-python.tar.gz'):\n", |
| 49 | + "if not isfile(tar_gz_path):\n", |
43 | 50 | " with DLProgress(unit='B', unit_scale=True, miniters=1, desc='CIFAR-10 Dataset') as pbar:\n", |
44 | 51 | " urlretrieve(\n", |
45 | 52 | " 'https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz',\n", |
46 | | - " 'cifar-10-python.tar.gz',\n", |
| 53 | + " tar_gz_path,\n", |
47 | 54 | " pbar.hook)\n", |
48 | 55 | "\n", |
49 | 56 | "if not isdir(cifar10_dataset_folder_path):\n", |
50 | | - " with tarfile.open('cifar-10-python.tar.gz') as tar:\n", |
| 57 | + " with tarfile.open(tar_gz_path) as tar:\n", |
51 | 58 | " tar.extractall()\n", |
52 | 59 | " tar.close()\n", |
53 | 60 | "\n", |
|
0 commit comments