Fix OutputModel should prefer connected task name over filename stem

This commit is contained in:
allegroai 2023-09-02 17:49:02 +03:00
parent 71c74f977b
commit 04fe7dffe3
2 changed files with 12 additions and 7 deletions

5
.gitignore vendored
View File

@ -7,8 +7,9 @@
# Python
*.pyc
__pycache__
build/
dist/
/build/
/dist/
*/conda_build/build/
*.egg-info
.env
.venv/

View File

@ -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: