import ray from ray import tune from ray.tune.trial import Trial def train(config, checkpoint_dir=None): for i in range(config["num_epochs"]): ... def test(config, checkpoint_dir=None): ... def custom_debug_string(trial): return f"Trial {trial.trial_id} ran successfully!" config = { "num_epochs": tune.grid_search([10, 20, 30]), ... } tune.run( train, config=config, resources_per_trial={"cpu": 1}, local_dir="/mnt/data", trial_name_creator=tune.function(lambda x: f"my-trial-{x}"), trial_runner=tune.run_trial.TrialRunner(debug_string=custom_debug_string) )In this example, `tune.run()` launches trials to optimize the `train()` function using different hyperparameter configurations in `config`. The optional `debug_string` parameter is set to a custom debug string generated by the `custom_debug_string()` function. This function takes in a `Trial` object and returns a message with the trial ID. This example showcases the use of multiple packages and libraries: `ray`, `ray.tune`, `ray.tune.trial`, `ray.tune.function`.