From 04fe7dffe3b12fe5851178c35866d810e6cd2fcc Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Sat, 2 Sep 2023 17:49:02 +0300 Subject: [PATCH] Fix OutputModel should prefer connected task name over filename stem --- .gitignore | 5 +++-- clearml/model.py | 14 +++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 95025315..26218bce 100644 --- a/.gitignore +++ b/.gitignore @@ -7,8 +7,9 @@ # Python *.pyc __pycache__ -build/ -dist/ +/build/ +/dist/ +*/conda_build/build/ *.egg-info .env .venv/ diff --git a/clearml/model.py b/clearml/model.py index 79a7f53b..f143da82 100644 --- a/clearml/model.py +++ b/clearml/model.py @@ -2400,11 +2400,15 @@ class OutputModel(BaseModel): # make sure the created model is updated: out_model_file_name = target_filename or weights_filename or register_uri - name = ( - Path(out_model_file_name).stem - if out_model_file_name - else (self._task_connect_name or "Output Model") - ) + + # prefer self._task_connect_name if exists + if self._task_connect_name: + name = self._task_connect_name + elif out_model_file_name: + name = Path(out_model_file_name).stem + else: + name = "Output Model" + if not self._base_model: model = self._get_force_base_model(task_model_entry=name) else: