also hpo controller:
` import os
from clearml import Task
os.environ['MPLBACKEND'] = "TkAg"
CLEARML_PROJECT = "Vodafone Sentiment full"
CLEARML_TASK = "HPO optimizer Controller"
os.environ["CLEARML_PROJECT"] = CLEARML_PROJECT
os.environ["CLEARML_TASK"] = CLEARML_TASK
Task.set_credentials(
api_host=" ",
web_host=" ",
files_host=" ",
key='88888888888',
secret='888888888888888'
)
from clearml.automation import UniformParameterRange, UniformIntegerParameterRange, DiscreteParameterRange
from clearml.automation import HyperParameterOptimizer
from clearml.automation import GridSearch
from clearml import Task
task = Task.init(project_name=CLEARML_PROJECT,
task_name=CLEARML_TASK,
task_type=Task.TaskTypes.optimizer,
reuse_last_task_id=False)
optimizer = HyperParameterOptimizer(
specifying the task to be optimized, task must be in system already so it can be cloned
base_task_id=base_task,
setting the hyper-parameters to optimize
hyper_parameters=[
UniformIntegerParameterRange('General/epochs', min_value=2, max_value=12, step_size=5),
UniformParameterRange('General/lr', min_value=0.000001, max_value=0.0001, step_size=0.002),
],
setting the objective metric we want to maximize/minimize
objective_metric_title='f1',
objective_metric_series='eval',
objective_metric_sign='max',
setting optimizer
optimizer_class=GridSearch,
configuring optimization parameters
execution_queue='default',
max_number_of_concurrent_tasks=4,
optimization_time_limit=60.,
compute_time_limit=120,
total_max_jobs=20,
min_iteration_per_job=0,
max_iteration_per_job=15,
)
optimizer.set_report_period(1)
start the optimization process
this function returns immediately
optimizer.start()
set the time limit for the optimization process (2 hours)
optimizer.set_time_limit(in_minutes=120.0)
wait until process is done (notice we are controlling the optimization process in the background)
optimizer.wait()
optimization is completed, print the top performing experiments id
top_exp = optimizer.get_top_experiments(top_k=3)
print([t.id for t in top_exp])
make sure background optimization stopped
optimizer.stop() `