Calling AccuracyCalculator(device="cpu") instead of AccuracyCalculator(device=torch.device("cpu")) crashes with an unclear exception (AttributeError: 'str' object has no attribute 'type').
It'd be better to check if isinstance(device, str), and then do device=torch.device(device)