ShusenTang / Dive-into-DL-PyTorch

本项目将《动手学深度学习》(Dive into Deep Learning)原书中的MXNet实现改为PyTorch实现。
http://tangshusen.me/Dive-into-DL-PyTorch
Apache License 2.0
18.42k stars 5.4k forks source link

3.5节fashion-mnist.ipynb下载FashionMNIST数据集报错 #76

Open Shijie97 opened 4 years ago

Shijie97 commented 4 years ago

python 3.6.7 pytorch 1.1 torchvision 0.3

这一行报错 mnist_train = torchvision.datasets.FashionMNIST(root='~/Datasets/FashionMNIST', train=True, download=True, transform=transforms.ToTensor())

0it [00:00, ?it/s] Using downloaded and verified file: /home/zhoushijie/Datasets/FashionMNIST/FashionMNIST/raw/train-images-idx3-ubyte.gz Extracting /home/zhoushijie/Datasets/FashionMNIST/FashionMNIST/raw/train-images-idx3-ubyte.gz Downloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/train-labels-idx1-ubyte.gz to /home/zhoushijie/Datasets/FashionMNIST/FashionMNIST/raw/train-labels-idx1-ubyte.gz

ZeroDivisionError Traceback (most recent call last)

in ----> 1 mnist_train = torchvision.datasets.FashionMNIST(root='~/Datasets/FashionMNIST', train=True, download=True, transform=transforms.ToTensor()) 2 mnist_test = torchvision.datasets.FashionMNIST(root='~/Datasets/FashionMNIST', train=False, download=True, transform=transforms.ToTensor()) ~/anaconda3/envs/pytorch/lib/python3.6/site-packages/torchvision/datasets/mnist.py in __init__(self, root, train, transform, target_transform, download) 66 67 if download: ---> 68 self.download() 69 70 if not self._check_exists(): ~/anaconda3/envs/pytorch/lib/python3.6/site-packages/torchvision/datasets/mnist.py in download(self) 143 filename = url.rpartition('/')[2] 144 file_path = os.path.join(self.raw_folder, filename) --> 145 download_url(url, root=self.raw_folder, filename=filename, md5=None) 146 self.extract_gzip(gzip_path=file_path, remove_finished=True) 147 ~/anaconda3/envs/pytorch/lib/python3.6/site-packages/torchvision/datasets/utils.py in download_url(url, root, filename, md5) 78 urllib.request.urlretrieve( 79 url, fpath, ---> 80 reporthook=gen_bar_updater() 81 ) 82 except OSError: ~/anaconda3/envs/pytorch/lib/python3.6/urllib/request.py in urlretrieve(url, filename, reporthook, data) 272 273 if reporthook: --> 274 reporthook(blocknum, bs, size) 275 276 while True: ~/anaconda3/envs/pytorch/lib/python3.6/site-packages/torchvision/datasets/utils.py in bar_update(count, block_size, total_size) 13 pbar.total = total_size 14 progress_bytes = count * block_size ---> 15 pbar.update(progress_bytes - pbar.n) 16 17 return bar_update ~/anaconda3/envs/pytorch/lib/python3.6/site-packages/tqdm-4.7.2-py3.6.egg/tqdm/_tqdm.py in update(self, n) 687 if self.smoothing and delta_t: 688 self.avg_time = delta_t / delta_it \ --> 689 if self.avg_time is None \ 690 else self.smoothing * delta_t / delta_it + \ 691 (1 - self.smoothing) * self.avg_time ZeroDivisionError: float division by zero
amituofo1996 commented 4 years ago

我也是这个问题