Cannot Transfer Batch Data to Device
🐛 Bug
After upgrading from 0.8.1 to 0.8.2, error occurs during training when the data is being transferred to the device. There is no problem with 0.8.1 but only with 0.8.2.
To Reproduce
It might be a little difficult to share the code here, but I suspect that might due to a mistake of defining "dtype" variable somewhere in the latest version. You may check the error message:
Validation sanity check: 0it [00:00, ?it/s]
Traceback (most recent call last):
  File "train.py", line 95, in <module>
    main()
  File "train.py", line 90, in main
    trainer.fit(model)
  File "/home/username/.local/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 928, in fit
    self.single_gpu_train(model)
  File "/home/username/.local/lib/python3.7/site-packages/pytorch_lightning/trainer/distrib_parts.py", line 183, in single_gpu_train
    self.run_pretrain_routine(model)
  File "/home/username/.local/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 1086, in run_pretrain_routine
    False)
  File "/home/username/.local/lib/python3.7/site-packages/pytorch_lightning/trainer/evaluation_loop.py", line 291, in _evaluate
    output = self.evaluation_forward(model, batch, batch_idx, dataloader_idx, test_mode)
  File "/home/username/.local/lib/python3.7/site-packages/pytorch_lightning/trainer/evaluation_loop.py", line 450, in evaluation_forward
    batch = self.transfer_batch_to_gpu(batch, root_gpu)
  File "/home/username/.local/lib/python3.7/site-packages/pytorch_lightning/trainer/distrib_parts.py", line 156, in transfer_batch_to_gpu
    return self.__transfer_batch_to_device(batch, device)
  File "/home/username/.local/lib/python3.7/site-packages/pytorch_lightning/trainer/distrib_parts.py", line 161, in __transfer_batch_to_device
    return model.transfer_batch_to_device(batch, device)
  File "/home/username/.local/lib/python3.7/site-packages/pytorch_lightning/core/hooks.py", line 243, in transfer_batch_to_device
    return move_data_to_device(batch, device)
  File "/home/username/.local/lib/python3.7/site-packages/pytorch_lightning/utilities/apply_func.py", line 109, in move_data_to_device
    return apply_to_collection(batch, dtype=(TransferableDataType, Batch), function=batch_to)
  File "/home/username/.local/lib/python3.7/site-packages/pytorch_lightning/utilities/apply_func.py", line 34, in apply_to_collection
    if isinstance(data, dtype):
TypeError: isinstance() arg 2 must be a type or tuple of types

Code sample
trainer.fit(model)

Environment
pytorch-lightning==0.8.2