It seems like the function process_parallelism sets the num_threads argument to NULL if there is a non-NULL input. This causes train_lightgbm to default to all available cores.
process_parallelism <- function(args) {
if (!is.null(args["num_threads"])) {
args$num_threads <- args[names(args) == "num_threads"]
args[names(args) == "num_threads"] <- NULL
}
args
}
test_arg <- list(num_threads = 2)
process_arg <- process_parallelism(test_arg)
process_arg
# named list()
It seems like the function
process_parallelismsets thenum_threadsargument toNULLif there is a non-NULLinput. This causestrain_lightgbmto default to all available cores.