Fix auto model logging using relative path (use full absolute path)

This commit is contained in:
allegroai 2020-09-15 18:11:31 +03:00
parent 2a2d4b6114
commit d36f6c26da
2 changed files with 5 additions and 3 deletions

View File

@ -168,8 +168,9 @@ class WeightsFileHandler(object):
if task is None:
return filepath
local_model_path = os.path.abspath(filepath) if filepath else filepath
model_info = WeightsFileHandler.ModelInfo(
model=None, upload_filename=None, local_model_path=filepath,
model=None, upload_filename=None, local_model_path=local_model_path,
local_model_id=filepath, framework=framework, task=task)
# call pre model callback functions
for cb in WeightsFileHandler._model_pre_callbacks.values():
@ -311,8 +312,9 @@ class WeightsFileHandler(object):
# WeightsFileHandler._model_out_store_lookup.pop(id(model))
# trains_out_model, ref_model = None, None
local_model_path = os.path.abspath(saved_path) if saved_path else saved_path
model_info = WeightsFileHandler.ModelInfo(
model=trains_out_model, upload_filename=None, local_model_path=saved_path,
model=trains_out_model, upload_filename=None, local_model_path=local_model_path,
local_model_id=saved_path, framework=framework, task=task)
if not model_info.local_model_path:

View File

@ -42,7 +42,7 @@ def get_filename_from_file_object(file_object, flush=False, analyze_file_handle=
if isinstance(file_object, six.string_types):
# noinspection PyBroadException
try:
return os.path.abspath(file_object)
return os.path.abspath(file_object) if file_object else file_object
except Exception:
return file_object
elif hasattr(file_object, 'name'):