mirror of
https://github.com/clearml/clearml
synced 2025-06-23 01:55:38 +00:00
OutputModel with task=None should use current task, if exists
This commit is contained in:
parent
99f987aafb
commit
9130a06210
@ -862,7 +862,7 @@ class OutputModel(BaseModel):
|
|||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
task, # type: Task
|
task=None, # type: Optional[Task]
|
||||||
config_text=None, # type: Optional[str]
|
config_text=None, # type: Optional[str]
|
||||||
config_dict=None, # type: Optional[dict]
|
config_dict=None, # type: Optional[dict]
|
||||||
label_enumeration=None, # type: Optional[Dict[str, int]]
|
label_enumeration=None, # type: Optional[Dict[str, int]]
|
||||||
@ -904,6 +904,12 @@ class OutputModel(BaseModel):
|
|||||||
:type framework: str or Framework object
|
:type framework: str or Framework object
|
||||||
:param base_model_id: optional, model id to be reused
|
:param base_model_id: optional, model id to be reused
|
||||||
"""
|
"""
|
||||||
|
if not task:
|
||||||
|
from .task import Task
|
||||||
|
task = Task.current_task()
|
||||||
|
if not task:
|
||||||
|
raise ValueError("task object was not provided, and no current task was found")
|
||||||
|
|
||||||
super(OutputModel, self).__init__(task=task)
|
super(OutputModel, self).__init__(task=task)
|
||||||
|
|
||||||
config_text = self._resolve_config(config_text=config_text, config_dict=config_dict)
|
config_text = self._resolve_config(config_text=config_text, config_dict=config_dict)
|
||||||
|
Loading…
Reference in New Issue
Block a user