Accessing model after training with hyper-parameter search

I’m trying to do a hyper-parameter search using the huggingface Trainer and ray[tune].

I’m more specifically following this example from RAY.

However, when I try to use the trainer (after all of the code from the example is executed) to predict I get the following error:

(Pdb) trainer.predict(train_dataset)
*** AttributeError: 'NoneType' object has no attribute 'forward'

Am I supposed to retrain the trainer after a hyper-parameter search?

Here is the exact steps I took for clarification:

  1. Downloaded example file i.e. pbt_transformers.py
  2. Added a import pdb; pdb.set_trace() on line 147 (after the last call in the function)
  3. Ran this with python pbt_transformers.py --smoke-test
  4. Once the debugger started I entered trainer.predict(train_dataset)

I apologize if the answer is somewhere but I looked at these examples (below) and didn’t see anything that is done after calling trainer.hyperparameter_search:

Currently, you have to retrain your model with the best set of hyperparameters to use it afterwards, unless you can find its checkpoint in the runs saved.

Ok great, thank you!