cuml icon indicating copy to clipboard operation
cuml copied to clipboard

[QST] Can cuML models be run with sklearn

Open CanOfSocks opened this issue 1 year ago • 2 comments

What is your question? I have a Epsilon-Support Vector Regression (SVR) model that I'm using sklearn to fit. I'm currently deploying this in an environment that is only confirmed compatible with sklearn.

Is it possible to fit a model using cuML, but get predictions by loading it in a sklearn environment. A question was asked #4869, but I'm not sure if the CPU/GPU interoperability features have been implemented.

Thanks

CanOfSocks avatar Oct 02 '24 11:10 CanOfSocks

Thanks for the issue @CanOfSocks! This is very good timing to ask, we are actively working right now (well @viclafargue ) to enable this to be possible for SVMs in the near future: https://github.com/rapidsai/cuml/pull/6089

dantegd avatar Oct 04 '24 01:10 dantegd

Updating this issue, created #6102 to add an explicit and supported API to export (supported) cuML models to Scikit-learn. This issue will be solved when both of these PRs are merged.

dantegd avatar Oct 08 '24 02:10 dantegd

cuml now includes two supported ways of interop with sklearn:

  • Using cuml.accel for zero-code-change. Models fit under cuml.accel can be saved and reloaded in environments without cuml, letting you fit on GPU and deploy on CPU. See https://docs.rapids.ai/api/cuml/stable/zero-code-change/ for more info.
  • Using cuml_estimator.as_sklearn() (as Dante noted above) to convert a cuml estimator to a native sklearn one.

jcrist avatar Jul 01 '25 20:07 jcrist