# Running Optuna on Two HuggingFace Trainer Tasks

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Frunning-optuna-on-two-huggingface-trainer-tasks%2F24023%3E%5C
**Category:** Intermediate\
**Created:** [October 5, 2022, 1:59pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Frunning-optuna-on-two-huggingface-trainer-tasks%2F24023 "2022-10-05T13:59:39Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![nbroad](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nbroad/32/26465_2.png) [@nbroad](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnbroad)%5C
**Post date:** [October 5, 2022, 5:37pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Frunning-optuna-on-two-huggingface-trainer-tasks%2F24023%2F2 "2022-10-05T17:37:57Z")

</div>

This thread should be useful. [Using hyperparameter-search in Trainer](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fusing-hyperparameter-search-in-trainer%2F785)

I’d break it into two steps. The first would be to train the model on the first dataset (with or without the hp search). The second would be do a hp search using the model from the last one. You can call `.from_pretrained("trained_model_dir")` to use the model trained in the first step.

---

_[View the full topic](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Frunning-optuna-on-two-huggingface-trainer-tasks%2F24023)._
