Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: output with device cpu and dtype Byte doesn't match the desired device cpu and dtype Float #68

Open
aisosalo opened this issue Jun 4, 2020 · 2 comments

Comments

@aisosalo
Copy link
Collaborator

aisosalo commented Jun 4, 2020

RuntimeError: output with device cpu and dtype Byte doesn't match the desired device cpu and dtype Float when running https://github.com/MIPT-Oulu/Collagen/blob/master/examples/cnn_cifar10/train.py

Traceback:

Traceback (most recent call last):
  File "/home/myusername/anaconda3/envs/py36_env/lib/python3.6/site-packages/hydra/main.py", line 24, in decorated_main
    strict=strict,
  File "/home/myusername/anaconda3/envs/py36_env/lib/python3.6/site-packages/hydra/_internal/utils.py", line 174, in run_hydra
    overrides=args.overrides,
  File "/home/myusername/anaconda3/envs/py36_env/lib/python3.6/site-packages/hydra/_internal/hydra.py", line 86, in run
    job_subdir_key=None,
  File "/home/myusername/anaconda3/envs/py36_env/lib/python3.6/site-packages/hydra/plugins/common/utils.py", line 109, in run_job
    ret.return_value = task_function(task_cfg)
  File "/mnt/myusername/PycharmProjectFiles/Collagen/examples/cnn_cifar10/train.py", line 91, in main
    strategy.run()
  File "/mnt/myusername/PycharmProjectFiles/Collagen/collagen/strategies/_strategy.py", line 259, in run
    self.__data_provider.sample(**self.__num_samples_by_stage[stage][model_name])
  File "/mnt/myusername/PycharmProjectFiles/Collagen/collagen/data/_dataprovider.py", line 53, in sample
    list_samples.append(self.__sample(il_name, k))
  File "/mnt/myusername/PycharmProjectFiles/Collagen/collagen/data/_dataprovider.py", line 73, in __sample
    samples = self.__loaders[itemloader_name].sample(k)
  File "/mnt/myusername/PycharmProjectFiles/Collagen/collagen/data/_itemloader.py", line 161, in sample
    batch = next(self.__iter_loader)
  File "/home/myusername/anaconda3/envs/py36_env/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 819, in __next__
    return self._process_data(data)
  File "/home/myusername/anaconda3/envs/py36_env/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 846, in _process_data
    data.reraise()
  File "/home/myusername/anaconda3/envs/py36_env/lib/python3.6/site-packages/torch/_utils.py", line 369, in reraise
    raise self.exc_type(msg)
RuntimeError: Caught RuntimeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/home/myusername/anaconda3/envs/py36_env/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
    data = fetcher.fetch(index)
  File "/home/myusername/anaconda3/envs/py36_env/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/myusername/anaconda3/envs/py36_env/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/mnt/myusername/PycharmProjectFiles/Collagen/collagen/data/_dataset.py", line 67, in __getitem__
    entry = self.parse_item_cb(self.root, entry, self.transform, **self.parser_kwargs)
  File "/mnt/myusername/PycharmProjectFiles/Collagen/examples/cnn_cifar10/utils.py", line 10, in parse_item
    trf_data = trf({'image': img}, normalize=True, **stats)
  File "/home/myusername/anaconda3/envs/py36_env/lib/python3.6/site-packages/solt/core/_core.py", line 152, in __call__
    as_dict=as_dict, scale_keypoints=scale_keypoints, normalize=normalize, mean=mean, std=std,
  File "/home/myusername/anaconda3/envs/py36_env/lib/python3.6/site-packages/solt/core/_data.py", line 273, in to_torch
    img.sub_(mean)
RuntimeError: output with device cpu and dtype Byte doesn't match the desired device cpu and dtype Float

System:

Linux-5.3.0-51-generic-x86_64-with-debian-buster-sid 
Python 3.6.10 |Anaconda, Inc.| (default, Mar 25 2020, 23:51:54) 
[GCC 7.3.0] 
PyTorch 1.2.0
@hoanghng
Copy link
Contributor

hoanghng commented Jun 7, 2020

Based on the logs, it seems to the SOLT lib. I tested the example using SOLT 0.1.9 on GPU.

@aisosalo
Copy link
Collaborator Author

aisosalo commented Jun 9, 2020

Did you get the same error or everything works fine on your setup? I am running SOLT 0.1.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants