From 451a3e738e23652af082bcb5a4d166e02ee6131d Mon Sep 17 00:00:00 2001 From: chjydu Date: Wed, 14 Nov 2018 23:43:18 -0800 Subject: [PATCH] Fix some glitches in extract_features.py 1. Add no_cuda argument 2. Fix the "not all arguments converted during string formatting" error thrown at line 230 --- extract_features.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extract_features.py b/extract_features.py index 6ad3a90e0091..c2d255b1b4a1 100644 --- a/extract_features.py +++ b/extract_features.py @@ -216,6 +216,10 @@ def main(): type=int, default=-1, help = "local_rank for distributed training on gpus") + parser.add_argument("--no_cuda", + default=False, + action='store_true', + help="Whether not to use CUDA when available") args = parser.parse_args() @@ -227,7 +231,7 @@ def main(): n_gpu = 1 # Initializes the distributed backend which will take care of sychronizing nodes/GPUs torch.distributed.init_process_group(backend='nccl') - logger.info("device", device, "n_gpu", n_gpu, "distributed training", bool(args.local_rank != -1)) + logger.info("device %s n_gpu %s distributed training %s" % (device, n_gpu, bool(args.local_rank != -1))) layer_indexes = [int(x) for x in args.layers.split(",")]