parsnip
parsnip copied to clipboard
Set the number of cores/threads to use when predicting
Feature
In situations when you need to scale up prediction with increasing data volume, it would be nice to have the ability to change the number of cores used for prediction. Perhaps something like predict(workflow_obj, new_data, nthreads = 45)
.
Example
We're training a xgboost model with nthread = 25
on a dev machine, but using a 48 core machine in production. It seems to be the nature of XGBoost to use the same number of cores used to train for predicting (we see this behavior). However, we'd like to use the full 48 cores when predicting (smaller machine is used during training).
Workaround attempts
Tried following the advice in https://github.com/dmlc/xgboost/issues/1345#issuecomment-231898237 , but setting the environment variable doesn't seem to have an impact and I get an invalid boost object error when trying to call the xgb.parameters(bst) <-
function on the output of pull_workflow_fit()
.
Thanks much! I'm really enjoying tidymodels.