Change default number of loader workers
This commit is contained in:
parent
818ed6923d
commit
5fd8cbfcda
@ -70,10 +70,10 @@ def add_common_args(parser):
|
|||||||
|
|
||||||
parser.add_argument('--batches', type=int, required=True,
|
parser.add_argument('--batches', type=int, required=True,
|
||||||
help='mini-batch size, per GPU in training or in total in testing')
|
help='mini-batch size, per GPU in training or in total in testing')
|
||||||
parser.add_argument('--loader-workers', type=int,
|
parser.add_argument('--loader-workers', default=-8, type=int,
|
||||||
help='number of data loading workers, per GPU in training or '
|
help='number of subprocesses per data loader. '
|
||||||
'in total in testing. Default is 0 for single batch, '
|
'0 to disable multiprocessing; '
|
||||||
'otherwise same as the batch size')
|
'negative number to multiply by the batch size')
|
||||||
|
|
||||||
parser.add_argument('--callback-at', type=lambda s: os.path.abspath(s),
|
parser.add_argument('--callback-at', type=lambda s: os.path.abspath(s),
|
||||||
help='directory of custorm code defining callbacks for models, '
|
help='directory of custorm code defining callbacks for models, '
|
||||||
@ -177,10 +177,8 @@ def str_list(s):
|
|||||||
|
|
||||||
|
|
||||||
def set_common_args(args):
|
def set_common_args(args):
|
||||||
if args.loader_workers is None:
|
if args.loader_workers < 0:
|
||||||
args.loader_workers = 0
|
args.loader_workers *= - args.batches
|
||||||
if args.batches > 1:
|
|
||||||
args.loader_workers = args.batches
|
|
||||||
|
|
||||||
|
|
||||||
def set_train_args(args):
|
def set_train_args(args):
|
||||||
|
Loading…
Reference in New Issue
Block a user