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

[Question] Progress during inference #6194

Closed
simpsus opened this issue Nov 14, 2023 · 3 comments
Closed

[Question] Progress during inference #6194

simpsus opened this issue Nov 14, 2023 · 3 comments
Labels

Comments

@simpsus
Copy link

simpsus commented Nov 14, 2023

When predicting with a large booster and a large dataset, the inference can take several hours (at least on my setup). It would be nice if there was the possibility to see a progress.
Ideally I would love to have a tqdm bar of the number of samples.

I am willing to accept some slowdown for the information, but putting my samples in chunks and then calling predict on each chunk wrapped by a tqdm ... I hope that there is some better way.

Thank you!

@jameslamb
Copy link
Collaborator

Thanks for using LightGBM, and taking the time to put up this suggestion.

I personally don't support taking on tqdm as a dependency of this project for this purpose. I understand you might be willing to accept the overhead it introduces in a throughput-sensitive application (large number of samples, batch predictions), but I don't think others who call predict() in latency-sensitive applications (small number if samples, on-demand scoring) would be happy about it.

See #5867 for some related discussion.

Some things you could try to speed up predictions in the situation you've described:

  • pass num_threads > 1 through params in predict(), to take advantage of multithreading
  • use the lightgbm.dask interface to split the work of generating predictions over multiple machines
  • pass pred_early_stop through parameters to stop the prediction process once it seems that adding output from later trees isn't changing the predictions much

Docs on parameters: https://lightgbm.readthedocs.io/en/latest/Parameters.html

Docs on how to use lightgbm.dask: https://lightgbm.readthedocs.io/en/latest/Parameters.html

@simpsus
Copy link
Author

simpsus commented Nov 14, 2023

thank you for the insights, closing this issue

@simpsus simpsus closed this as completed Nov 14, 2023
Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants