Unanswered
I Wonder What Is The Best Practice Today To Fetch A Model From Another Task By Models Name Or Id ?
Currently, I See This Can Be Done As
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
159 Views
0
Answers
3 years ago
one year ago