qianqianwang68 / caps

MIT License
183 stars 25 forks source link

Visualization.ipynb hangs #1

Closed Dawars closed 4 years ago

Dawars commented 4 years ago

I'm trying to run visualization.ipynb but the second cell doesn't finish.

The dataset is loaded:

total number of image pairs loaded: 216892
Reloading from ../caps-pretrained.pth

After a while I stop the cell and it is still in the random_sample() function:

---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-2-90acaaff1d16> in <module>
      2 with_std = True
      3 with_epipline = True
----> 4 sample.random_sample()
      5 sample.plot_img_pair(with_std=with_std, with_epipline=with_epipline)

~/projects/caps/jupyter/functions.py in random_sample(self)
     19 
     20     def random_sample(self):
---> 21         self.sample = next(self.loader_iter)
     22 
     23     def plot_img_pair(self, with_std=False, with_epipline=False):

~/miniconda3/envs/historic/lib/python3.7/site-packages/torch/utils/data/dataloader.py in __next__(self)
    361 
    362     def __next__(self):
--> 363         data = self._next_data()
    364         self._num_yielded += 1
    365         if self._dataset_kind == _DatasetKind.Iterable and \

~/miniconda3/envs/historic/lib/python3.7/site-packages/torch/utils/data/dataloader.py in _next_data(self)
    972 
    973             assert not self._shutdown and self._tasks_outstanding > 0
--> 974             idx, data = self._get_data()
    975             self._tasks_outstanding -= 1
    976 

~/miniconda3/envs/historic/lib/python3.7/site-packages/torch/utils/data/dataloader.py in _get_data(self)
    939         else:
    940             while True:
--> 941                 success, data = self._try_get_data()
    942                 if success:
    943                     return data

~/miniconda3/envs/historic/lib/python3.7/site-packages/torch/utils/data/dataloader.py in _try_get_data(self, timeout)
    777         #   (bool: whether successfully get data, any: data if successful else None)
    778         try:
--> 779             data = self._data_queue.get(timeout=timeout)
    780             return (True, data)
    781         except Exception as e:

~/miniconda3/envs/historic/lib/python3.7/multiprocessing/queues.py in get(self, block, timeout)
    102                 if block:
    103                     timeout = deadline - time.time()
--> 104                     if not self._poll(timeout):
    105                         raise Empty
    106                 elif not self._poll():

~/miniconda3/envs/historic/lib/python3.7/multiprocessing/connection.py in poll(self, timeout)
    255         self._check_closed()
    256         self._check_readable()
--> 257         return self._poll(timeout)
    258 
    259     def __enter__(self):

~/miniconda3/envs/historic/lib/python3.7/multiprocessing/connection.py in _poll(self, timeout)
    412 
    413     def _poll(self, timeout):
--> 414         r = wait([self], timeout)
    415         return bool(r)
    416 

~/miniconda3/envs/historic/lib/python3.7/multiprocessing/connection.py in wait(object_list, timeout)
    918 
    919             while True:
--> 920                 ready = selector.select(timeout)
    921                 if ready:
    922                     return [key.fileobj for (key, events) in ready]

~/miniconda3/envs/historic/lib/python3.7/selectors.py in select(self, timeout)
    413         ready = []
    414         try:
--> 415             fd_event_list = self._selector.poll(timeout)
    416         except InterruptedError:
    417             return ready

KeyboardInterrupt: 
Dawars commented 4 years ago

Sorry it turned out to be a problem with my environment.

This is a regression in Python 3.7.2 which has been fixed in Python 3.7.5 according to this SO post: https://stackoverflow.com/a/54481373

p.s. and Pytorch 1.6