Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore machine and inference on GPU #1146

Open
Moelf opened this issue Nov 23, 2024 · 4 comments
Open

Restore machine and inference on GPU #1146

Moelf opened this issue Nov 23, 2024 · 4 comments
Labels

Comments

@Moelf
Copy link

Moelf commented Nov 23, 2024

After saving and loading a machine, it runs inference on GPU (specifically, for XGBoost), is there an interface to move the model back to GPU?

@OkonSamuel
Copy link
Member

I'm not sure I understood your question. Could you provide example code.

@Moelf
Copy link
Author

Moelf commented Dec 7, 2024

if you train a machine, and then:

mach = restore!(serializable(mach_bdt))

any subsequent call to predict(mach, X) would run on CPU not GPU. In this particular case the wrapper for XGBoost.jl is lacking this capability, but in general, does MLJ even have an interface for "moving model onto GPU"?

@OkonSamuel
Copy link
Member

OkonSamuel commented Dec 7, 2024

Oh okay, I see what you mean now. At the moment we don't have support for gpu training with XGboost model. But I believe that since XGBoost.jl supports this, it should be possible to add support for this through MLJ.
One way would be to add a method to the interface that gets overloaded by the different models. At the moment for MLJFlux models this is done in a locally but it may be more beneficial to generalize this.

@OkonSamuel OkonSamuel added the api label Dec 7, 2024
@Moelf
Copy link
Author

Moelf commented Dec 7, 2024

GPU training for XGBoost model is okay: JuliaAI/MLJXGBoostInterface.jl#54

I think the problem is more that there's no way to move inference back to GPU -- I think in thsi case XGBoost.jl may need the DMatrix to live on GPU or something for this to work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants