Sol 1: define your own class for your inputs and inplement the to() function
Sol2:
self.data = {k: v.to(device) for k, v in self.data.items()}

Ref:

  
      
      huggingface.co
  
  
    

transformers.tokenization_utils_base — transformers 3.5.0 documentation 19