From c8a690569f5966156626ff6a5f9dbb99e1205dc9 Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Mon, 18 Jan 2021 11:31:37 +0200 Subject: [PATCH] Fix trying to upload model file as a folder, automatically package the folder --- clearml/model.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/clearml/model.py b/clearml/model.py index c3eb46c1..4105b8bd 100644 --- a/clearml/model.py +++ b/clearml/model.py @@ -1139,6 +1139,15 @@ class OutputModel(BaseModel): raise Exception('Missing a task for this model') if weights_filename is not None: + # Check if weights_filename is a folder, is package upload + if Path(weights_filename).is_dir(): + return self.update_weights_package( + weights_path=weights_filename, + upload_uri=upload_uri, + target_filename=target_filename or Path(weights_filename).name, + auto_delete_file=auto_delete_file, + iteration=iteration) + # make sure we delete the previous file, if it exists if self._model_local_filename != weights_filename: delete_previous_weights_file(self._model_local_filename)