ray-project / tune-sklearn

A drop-in replacement for Scikit-Learn’s GridSearchCV / RandomizedSearchCV -- but with cutting edge hyperparameter tuning techniques.
https://docs.ray.io/en/master/tune/api_docs/sklearn.html
Apache License 2.0
465 stars 52 forks source link

Fractional values in gpu (resource_per_trial) #143

Closed alokgogate closed 3 years ago

alokgogate commented 3 years ago

Is it possible to give fractional values along with parameter use_gpu while using TuneSearchCV ?

richardliaw commented 3 years ago

Hmm, currently not possible to do so, but let me tag this as a feature request (and it should be easy to implement!)

Yard1 commented 3 years ago

I can work on this.

richardliaw commented 3 years ago

That's awesome - it should be really straightforward (see resources per trial)

Yard1 commented 3 years ago

Just one question - should we add a new parameter for that, or allow users to pass integers to use_gpu, in which case the same logic as for n_jobs will be used (see line 531 in tune_basesearch.py)?

richardliaw commented 3 years ago

Hmm I think you just want to make n_jobs also configure fractional gpu (no new param)

On Sun, Nov 22, 2020 at 11:55 AM Antoni Baum notifications@github.com wrote:

Just one question - should we add a new parameter for that, or allow users to pass integers to use_gpu, in which case the same logic as for n_jobs will be used (see line 531 in tune_basesearch.py)?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ray-project/tune-sklearn/issues/143#issuecomment-731836522, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCRZZLVILNP6CSQRKJFOLDSRFUDFANCNFSM4T6Q6ISA .

richardliaw commented 3 years ago

Hey @alokgogate, @Yard1 just merged this -- could you give it a try?

TuneSearchCV(use_gpu=True, n_jobs=8)

will use 8 jobs with the proper CPU/GPU fractions :)

richardliaw commented 3 years ago

I'll close this for now, but definitely let me know if this works for you (and feel free to reopen/open a new issue!)

alokgogate commented 3 years ago

Hi @richardliaw,

I tried to install it using the master branch the setup.py get's stuck and terminates after some time with the following error :

Couldn't find index page for 'parameterized' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
No local packages or download links found for parameterized
error: Could not find suitable distribution for Requirement.parse('parameterized')

I check for package parameterized and have it already installed

richardliaw commented 3 years ago

Hmm maybe theres a pip outage - can you try commenting it out on setup.py?

On Wed, Nov 25, 2020 at 12:16 AM alokgogate notifications@github.com wrote:

Hi @richardliaw https://github.com/richardliaw,

I tried to install it using the master branch the setup.py get's stuck and terminates after some time with the following error 👎

Couldn't find index page for 'parameterized' (maybe misspelled?)

Scanning index of all packages (this may take a while)

Reading https://pypi.python.org/simple/

No local packages or download links found for parameterized

error: Could not find suitable distribution for Requirement.parse('parameterized')

I check for package parameterized and have it already installed

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/ray-project/tune-sklearn/issues/143#issuecomment-733542870, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCRZZOIFT3UHBNVW2NK4WTSRS4OTANCNFSM4T6Q6ISA .

alokgogate commented 3 years ago

didn't find pip outage or outage in the file

richardliaw commented 3 years ago

sorry, can you just try commenting out "parametrize" in the setup.py?

alokgogate commented 3 years ago

Don't see that one either

richardliaw commented 3 years ago

hmm @alokgogate I just merged a fix, can you try: pip install git+https://github.com/ray-project/tune-sklearn

alokgogate commented 3 years ago

Hi @richardliaw, this worked and was able to install and run a few experiments. I have a few observations though:

When I run with n_jobs=8,use_gpu=True and set verbose=2 I can see that a fraction of GPU is requested (I have 4 GPU cards hence each experiment is requesting 0.5). But i dont see the GPU's being used when look at nvidia-smi Is this expected behaviour? I am using xgboost to test this. Would I have set tree_method="gpu_hist", this parameter become redundant given that use_gpu=True is set?

richardliaw commented 3 years ago

Hmm, you need to set gpu_hist for xgboost.