# HuggingFace Model hyperparameter search with ray as backend not saving best trial hyperparameters

**URL:** <https://discuss.huggingface.co/t/huggingface-model-hyperparameter-search-with-ray-as-backend-not-saving-best-trial-hyperparameters/68395>\
**Category:** Amazon SageMaker\
**Created:** [January 8, 2024, 3:45pm UTC](https://discuss.huggingface.co/t/huggingface-model-hyperparameter-search-with-ray-as-backend-not-saving-best-trial-hyperparameters/68395 "2024-01-08T15:45:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jillvillany](https://avatars.discourse-cdn.com/v4/letter/j/e9c0ed/32.png) [@jillvillany](https://discuss.huggingface.co/u/jillvillany)\
**Post date:** [January 8, 2024, 3:45pm UTC](https://discuss.huggingface.co/t/huggingface-model-hyperparameter-search-with-ray-as-backend-not-saving-best-trial-hyperparameters/68395/1 "2024-01-08T15:45:56Z")

</div>

I have no problem running this locally, but am encountering an issue using the sagemaker HuggingFace etimator. When running a HUggingFace hyperparameter\_search, the hyperparameters for a trial are not saving. Thus, at the end of the tuning job when running `best_trial.hyperparameters` I get an empty dictionary. I double checked the saved files in the model.tar.gz file and the `params.json` file is empty.

Local dependency versions:  
python = 3.10.11  
sagemaker = “2.203.0”  
transformers = “4.28.0”  
torch = “2.1.2+cpu”  
ray = “2.6.3”

Instantiation of sgaemaker hugging face estimator:  
transformers\_version = ‘4.28’,  
pytorch\_version = ‘2.0’  
py\_version = ‘py310’

within sagemaker container run:  
os.system(“pip install ray==2.6.3”)
