Skip to content

Instantly share code, notes, and snippets.

@thepycoder
Created February 28, 2022 13:58
Show Gist options
  • Save thepycoder/64595d0cf7ca99689c991b8c0667cf51 to your computer and use it in GitHub Desktop.
Save thepycoder/64595d0cf7ca99689c991b8c0667cf51 to your computer and use it in GitHub Desktop.
Dummy Model
from clearml import Task
task = Task.init(project_name="HPO Example", task_name="basic dict example")
example_configuration = {
'epochs': 3,
'lr': 0.001,
'comments': 'I like apple juice'
}
task.connect(example_configuration)
# The actual meat of your code can be literally anything!
# As an example, we can just output anything we want, and it will be optimized!
# So let's use a dumb and simple model that will not return accuracy or loss,
# but just the amount of epochs times 10
class Model:
def run():
return example_configuration['epochs'] * 10
# We create our fake 'model output'
model_output = Model().run()
# We create a logger to tell clearML how the "model" performed. If using e.g. Tensorflow this will be added automatically.
logger = task.get_logger()
# Tell ClearML how it went! Again, when using an ML framework, this will be captured automatically
logger.report_scalar('Optimization Metric', 'model_output', iteration=0, value=model_output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment