Invalid device id error

You can try the suggestion of setting CUDA_VISIBLE_DEVICES as given in this post