Do you inherit from SearchStrategy
in you implementation (you can read about it https://allegro.ai/docs/automation_optimization_searchstrategy.html#automation-optimization-searchstrategy )? If not, can you share how?
About the docstring, thanks 🙂 we will update it with the exceptions.
Hi ThankfulOwl72 ,
You can create only one main execution Task. In the code you wrote, you are trying to have two tasks, which causing the exception. You can read more about the task object in the https://allegro.ai/docs/task.html#trains.task.Task .
The reuse_last_task_id
will create a new task, which is not the default for https://allegro.ai/docs/task.html#task.Task.init (will override the last one)
What is your use case? maybe I can help with that
BTW, you can use Task.init()
without parameters to receive the running task (for the second call).
If this is the case (you have results
and you want a new task to connect to each result), you can just clone the base task, update task parameters and enqueue it for execution (similar to https://github.com/allegroai/trains/blob/master/examples/automation/manual_random_param_search_example.py example), can this do the trick?
Thanks for the prompt answer! My use case is the following:
I am running a grid search (my own implementation, not the trains grid search) and would like the experiments to be grouped together. I wanted to achieve that by having the same project and putting each step of the grid search as experiment.
My grid search is essentially just a loop. You can think of my use case as:for results_params_dict in results: experiment = Task.init("grid_search", "my_experiment") experiment.connect(results_params_dict)
Independently of my use case: the docstring of Task.init states a new task will always be created if- the ``reuse_last_task_id`` parameter is assigned ``False``.
I cannot reuse the running task in the grid search since it would overwrite the hyperparameters instead of creating a new experiment with the new hyperparameters
I guess I could use Task.create for that but it has the downside of "not being reproducible"
Hi ThankfulOwl72 checkout TrainsJob
object. It should essentially do what you need:
https://github.com/allegroai/trains/blob/master/trains/automation/job.py#L14