How to run on CPU?

Hi everyone,

I’m currently trying to modify the token classification script. The machine where I’m running the script has a GPU that is currently fully utilized by another process, so I’d like to run my classification script on the CPU (I’m just editing things, not actually running the training) and only switch to the GPU when I’m done editing. I’ve noticed that other scripts in examples have the --no_cuda parameter, but this one doesn’t. How can I make this script run in my CPU?

Thanks!
Irene

You’ll have to force the accelerator to run on CPU.

accelerator = Accelerator(cpu=True)

should do the trick.

1 Like