简体   繁体   中英

Running BERT on CPU instead of GPU

I am trying to execute BERT's run_clasifier.py script using terminal as below:

python run_classifier.py --task_name=cola --do_predict=true --data_dir=<data-dir> --vocab_file=$BERT_BASE_DIR/vocab.txt --bert_config_file=$BERT_BASE_DIR/bert_config.json --init_checkpoint=<output_dir>/model.ckpt-1603 --max_seq_length=512 --output_dir=<output_dir>

This by default executes on GPU. Instead, I want to execute it on the CPU. Is there a way to do it for only a single trial of execution than for all the subsequent trials.?

Try use: os.environ['CUDA_VISIBLE_DEVICES'] = '-1'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM