interesting, so you actually enqueue a task-generating task, which will eventually, once executed, enqueue all the configuration task (as you proposed earlier).
ColossalDeer61 we can add to the script Task.init
and we will have this service in the UI, with connection to the configuration, users can change the configuration from the UI and send this script to execute (in services queue for example). This way others can change the configuration and run this script.
` from trains import Task
service_task = Task.init(project_name="services", task_name="clone and enqueue by configuration")
configuration_file = {
"stage_1": {
"batch_size": 32,
"epochs": 10
},
"stage_2": {
"batch_size": 64,
"epochs": 20
},
}
service_task.connect(configuration_file)
template_task = Task.get_task(task_id=<YOUR TEMPLATE TASK>)
for name, params in configuration_file.items():
# clone the template task into a new write enabled task (where we can change parameters)
cloned_task = Task.clone(source_task=template_task,
name=template_task.name + ' {}'.format(name),
parent=template_task.id)
# get the original template parameters
cloned_task_parameters = cloned_task.get_parameters()
# override with random samples form grid
for k, cloned_params in params.items():
cloned_task_parameters[k] = cloned_params
# put back into the new cloned task
cloned_task.set_parameters(cloned_task_parameters)
print('Experiment {} set with parameters {}'.format(name, cloned_task_parameters))
# enqueue the task for execution
Task.enqueue(cloned_task.id, queue_name="default") # <--- Change "default" to your queue name
print('Experiment id={} enqueue for execution'.format(cloned_task.id)) `
Otherwise I might as well replace it with my own script that simply sends the configurations list to some random training server, which in turn will execute a version of TimelyPenguin76 's script. And the user will not even be aware of that. From his point of view the experiments will miraculously appear in the UI 🙂
That's an optional plan B
I don't mind writing JS or other scripts for that, if there's a hook waiting for me 🙂
This is certainly a good way, which we use today.
I am looking for an even simpler way, for less technical people, who could apply this remotely, using the UI.
edit : the issue is less concerning technical level, but rather access to training machines
Hi ColossalDeer61 ,
Not from the UI, but you can run a simple script to do that (assuming you can parse your configuration file), here is an example:
` from trains import Task
configuration_file = {
"stage_1": {
"batch_size": 32,
"epochs": 10
},
"stage_2": {
"batch_size": 64,
"epochs": 20
},
}
template_task = Task.get_task(task_id=<YOUR TEMPLATE TASK>)
for name, params in configuration_file.items():
# clone the template task into a new write enabled task (where we can change parameters)
cloned_task = Task.clone(source_task=template_task,
name=template_task.name + ' {}'.format(name),
parent=template_task.id)
# get the original template parameters
cloned_task_parameters = cloned_task.get_parameters()
# override
for k, cloned_params in params.items():
cloned_task_parameters[k] = cloned_params
# put back into the new cloned task
cloned_task.set_parameters(cloned_task_parameters)
print('Experiment {} set with parameters {}'.format(name, cloned_task_parameters))
# enqueue the task for execution
Task.enqueue(cloned_task.id, queue_name="default") # <--- Change "default" to your queue name
print('Experiment id={} enqueue for execution'.format(cloned_task.id)) `can this to the trick?