Do you have any suggestions for the case when setting CUDA_VISIBLE_DEVICES is not an option?
UPD: This worked in my case trainer.args._n_gpu = 1, but it seems wrong to reassign a property, especially a _-prepended.