Well, it's a little verbose, I agree 🙂
I'm sure you know, but for the community's sake I'll just say it's possible to use a more pythonic syntax instead of the for loop:model = next(m for m in Task.get_task(training_task_id).get_models()["output"] if m.name == model_name)
This will raise StopIteration
error if no such model is found, or alternatively:model = next((m for m in Task.get_task(training_task_id).get_models()["output"] if m.name == model_name), None)
Which will return None
is not model is found
well, if you know your model id you can simplify things a little bit.mdl = clearml.Model(model_id)
m_output = mdl.get_local_copy()