# Trainer.hyperparameter\_search doesn't work for me

**URL:** <https://discuss.huggingface.co/t/trainer-hyperparameter-search-doesnt-work-for-me/2910>\
**Category:** Beginners\
**Created:** [December 21, 2020, 2:50pm UTC](https://discuss.huggingface.co/t/trainer-hyperparameter-search-doesnt-work-for-me/2910 "2020-12-21T14:50:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![oferweintraub](https://avatars.discourse-cdn.com/v4/letter/o/e68b1a/32.png) [@oferweintraub](https://discuss.huggingface.co/u/oferweintraub)\
**Post date:** [December 21, 2020, 2:50pm UTC](https://discuss.huggingface.co/t/trainer-hyperparameter-search-doesnt-work-for-me/2910/1 "2020-12-21T14:50:34Z")

</div>

HI, as a beginner I try to follow few examples. Looking at this repo " Fine-tuning a model on a text classification task " (here - [https://bit.ly/3mEBqTM](https://bit.ly/3mEBqTM)) I tried to implement the trainer.hyperparameter\_search() method with either “optuna” and “ray [tune]” .

!pip install optuna --\> seems to work fine  
When running the example shown I keep getting:

RuntimeError: At least one of optuna or ray should be installed. To install optuna run `pip install optuna`.To install ray run `pip install ray[tune]`.

I tried installing both but none works… any guidance would be highly appreciated…

thanks, -Ofer

---

<div class="post-metadata">

**Author:** ![sgugger](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sgugger/32/2291_2.png) [@sgugger](https://discuss.huggingface.co/u/sgugger)\
**Post date:** [December 21, 2020, 6:05pm UTC](https://discuss.huggingface.co/t/trainer-hyperparameter-search-doesnt-work-for-me/2910/2 "2020-12-21T18:05:54Z")

</div>

There is some environment problem it seems, since `transformers` didn’t detect you have `optuna` installed. I’d try restarting your kernel since you seem to be in a notebook.

---

<div class="post-metadata">

**Author:** ![oferweintraub](https://avatars.discourse-cdn.com/v4/letter/o/e68b1a/32.png) [@oferweintraub](https://discuss.huggingface.co/u/oferweintraub)\
**Post date:** [December 22, 2020, 3:05pm UTC](https://discuss.huggingface.co/t/trainer-hyperparameter-search-doesnt-work-for-me/2910/3 "2020-12-22T15:05:42Z")

</div>

Yap… indeed, simple and worked. Thanks
