Setting specific device for Trainer

Is there any solution to this?

Still can’t get Trainer to use a particular device in transformers v4.30.2 even after setting environment variable

import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"]= "2"

It still takes GPU device 0

[In]: trainer.args.device
[Out] :device(type='cuda', index=0)