truefoundry 0.4.4rc12__py3-none-any.whl → 0.5.0rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of truefoundry might be problematic. Click here for more details.
- truefoundry/common/constants.py +6 -1
- truefoundry/common/utils.py +0 -18
- truefoundry/logger.py +1 -0
- truefoundry/ml/__init__.py +36 -0
- truefoundry/ml/artifact/truefoundry_artifact_repo.py +433 -415
- truefoundry/ml/autogen/client/__init__.py +29 -6
- truefoundry/ml/autogen/client/api/__init__.py +3 -3
- truefoundry/ml/autogen/client/api/deprecated_api.py +7 -7
- truefoundry/ml/autogen/client/api/generate_code_snippet_api.py +526 -0
- truefoundry/ml/autogen/client/models/__init__.py +26 -3
- truefoundry/ml/autogen/client/models/command.py +152 -0
- truefoundry/ml/autogen/client/models/create_workflow_task_config_request_dto.py +72 -0
- truefoundry/ml/autogen/client/models/external_model_source.py +3 -2
- truefoundry/ml/autogen/client/models/fast_ai_framework.py +75 -0
- truefoundry/ml/autogen/client/models/framework.py +250 -14
- truefoundry/ml/autogen/client/models/gluon_framework.py +74 -0
- truefoundry/ml/autogen/client/models/{upload_model_source.py → h2_o_framework.py} +11 -11
- truefoundry/ml/autogen/client/models/keras_framework.py +74 -0
- truefoundry/ml/autogen/client/models/light_gbm_framework.py +75 -0
- truefoundry/ml/autogen/client/models/model_version_manifest.py +1 -1
- truefoundry/ml/autogen/client/models/onnx_framework.py +74 -0
- truefoundry/ml/autogen/client/models/paddle_framework.py +75 -0
- truefoundry/ml/autogen/client/models/py_torch_framework.py +75 -0
- truefoundry/ml/autogen/client/models/sklearn_framework.py +75 -0
- truefoundry/ml/autogen/client/models/source.py +9 -32
- truefoundry/ml/autogen/client/models/spa_cy_framework.py +74 -0
- truefoundry/ml/autogen/client/models/stats_models_framework.py +75 -0
- truefoundry/ml/autogen/client/models/{tensorflow_framework.py → tensor_flow_framework.py} +10 -9
- truefoundry/ml/autogen/client/models/transformers_framework.py +3 -2
- truefoundry/ml/autogen/client/models/trigger_job_run_config_request_dto.py +90 -0
- truefoundry/ml/autogen/client/models/trigger_job_run_config_response_dto.py +71 -0
- truefoundry/ml/autogen/client/models/truefoundry_model_source.py +5 -3
- truefoundry/ml/autogen/client/models/xg_boost_framework.py +75 -0
- truefoundry/ml/autogen/client_README.md +22 -5
- truefoundry/ml/autogen/entities/artifacts.py +19 -2
- truefoundry/ml/log_types/artifacts/artifact.py +10 -6
- truefoundry/ml/log_types/artifacts/dataset.py +13 -5
- truefoundry/ml/log_types/artifacts/general_artifact.py +3 -1
- truefoundry/ml/log_types/artifacts/model.py +172 -194
- truefoundry/ml/log_types/artifacts/utils.py +43 -26
- truefoundry/ml/log_types/image/image.py +2 -0
- truefoundry/ml/log_types/plot.py +2 -0
- truefoundry/ml/mlfoundry_api.py +47 -18
- truefoundry/ml/mlfoundry_run.py +27 -12
- truefoundry/ml/model_framework.py +169 -0
- truefoundry/workflow/__init__.py +3 -1
- truefoundry/workflow/remote_filesystem/__init__.py +8 -0
- truefoundry/workflow/remote_filesystem/logger.py +36 -0
- truefoundry/{common → workflow/remote_filesystem}/tfy_signed_url_client.py +1 -2
- truefoundry/{common → workflow/remote_filesystem}/tfy_signed_url_fs.py +5 -2
- {truefoundry-0.4.4rc12.dist-info → truefoundry-0.5.0rc1.dist-info}/METADATA +1 -1
- {truefoundry-0.4.4rc12.dist-info → truefoundry-0.5.0rc1.dist-info}/RECORD +54 -36
- truefoundry/ml/autogen/client/api/python_deployment_config_api.py +0 -201
- {truefoundry-0.4.4rc12.dist-info → truefoundry-0.5.0rc1.dist-info}/WHEEL +0 -0
- {truefoundry-0.4.4rc12.dist-info → truefoundry-0.5.0rc1.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
FastAPI
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
from typing import TYPE_CHECKING, Any, List, Optional, Union
|
|
20
|
+
|
|
21
|
+
from truefoundry.pydantic_v1 import (
|
|
22
|
+
BaseModel,
|
|
23
|
+
Field,
|
|
24
|
+
StrictStr,
|
|
25
|
+
ValidationError,
|
|
26
|
+
conlist,
|
|
27
|
+
validator,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
COMMAND_ANY_OF_SCHEMAS = ["List[str]", "str"]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class Command(BaseModel):
|
|
34
|
+
"""
|
|
35
|
+
Command
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
# data type: str
|
|
39
|
+
anyof_schema_1_validator: Optional[StrictStr] = None
|
|
40
|
+
# data type: List[str]
|
|
41
|
+
anyof_schema_2_validator: Optional[conlist(StrictStr)] = None
|
|
42
|
+
if TYPE_CHECKING:
|
|
43
|
+
actual_instance: Union[List[str], str]
|
|
44
|
+
else:
|
|
45
|
+
actual_instance: Any
|
|
46
|
+
any_of_schemas: List[str] = Field(COMMAND_ANY_OF_SCHEMAS, const=True)
|
|
47
|
+
|
|
48
|
+
class Config:
|
|
49
|
+
validate_assignment = True
|
|
50
|
+
|
|
51
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
52
|
+
if args:
|
|
53
|
+
if len(args) > 1:
|
|
54
|
+
raise ValueError(
|
|
55
|
+
"If a position argument is used, only 1 is allowed to set `actual_instance`"
|
|
56
|
+
)
|
|
57
|
+
if kwargs:
|
|
58
|
+
raise ValueError(
|
|
59
|
+
"If a position argument is used, keyword arguments cannot be used."
|
|
60
|
+
)
|
|
61
|
+
super().__init__(actual_instance=args[0])
|
|
62
|
+
else:
|
|
63
|
+
super().__init__(**kwargs)
|
|
64
|
+
|
|
65
|
+
@validator("actual_instance")
|
|
66
|
+
def actual_instance_must_validate_anyof(cls, v):
|
|
67
|
+
instance = Command.construct()
|
|
68
|
+
error_messages = []
|
|
69
|
+
# validate data type: str
|
|
70
|
+
try:
|
|
71
|
+
instance.anyof_schema_1_validator = v
|
|
72
|
+
return v
|
|
73
|
+
except (ValidationError, ValueError) as e:
|
|
74
|
+
error_messages.append(str(e))
|
|
75
|
+
# validate data type: List[str]
|
|
76
|
+
try:
|
|
77
|
+
instance.anyof_schema_2_validator = v
|
|
78
|
+
return v
|
|
79
|
+
except (ValidationError, ValueError) as e:
|
|
80
|
+
error_messages.append(str(e))
|
|
81
|
+
if error_messages:
|
|
82
|
+
# no match
|
|
83
|
+
raise ValueError(
|
|
84
|
+
"No match found when setting the actual_instance in Command with anyOf schemas: List[str], str. Details: "
|
|
85
|
+
+ ", ".join(error_messages)
|
|
86
|
+
)
|
|
87
|
+
else:
|
|
88
|
+
return v
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_dict(cls, obj: dict) -> Command:
|
|
92
|
+
return cls.from_json(json.dumps(obj))
|
|
93
|
+
|
|
94
|
+
@classmethod
|
|
95
|
+
def from_json(cls, json_str: str) -> Command:
|
|
96
|
+
"""Returns the object represented by the json string"""
|
|
97
|
+
instance = Command.construct()
|
|
98
|
+
error_messages = []
|
|
99
|
+
# deserialize data into str
|
|
100
|
+
try:
|
|
101
|
+
# validation
|
|
102
|
+
instance.anyof_schema_1_validator = json.loads(json_str)
|
|
103
|
+
# assign value to actual_instance
|
|
104
|
+
instance.actual_instance = instance.anyof_schema_1_validator
|
|
105
|
+
return instance
|
|
106
|
+
except (ValidationError, ValueError) as e:
|
|
107
|
+
error_messages.append(str(e))
|
|
108
|
+
# deserialize data into List[str]
|
|
109
|
+
try:
|
|
110
|
+
# validation
|
|
111
|
+
instance.anyof_schema_2_validator = json.loads(json_str)
|
|
112
|
+
# assign value to actual_instance
|
|
113
|
+
instance.actual_instance = instance.anyof_schema_2_validator
|
|
114
|
+
return instance
|
|
115
|
+
except (ValidationError, ValueError) as e:
|
|
116
|
+
error_messages.append(str(e))
|
|
117
|
+
|
|
118
|
+
if error_messages:
|
|
119
|
+
# no match
|
|
120
|
+
raise ValueError(
|
|
121
|
+
"No match found when deserializing the JSON string into Command with anyOf schemas: List[str], str. Details: "
|
|
122
|
+
+ ", ".join(error_messages)
|
|
123
|
+
)
|
|
124
|
+
else:
|
|
125
|
+
return instance
|
|
126
|
+
|
|
127
|
+
def to_json(self) -> str:
|
|
128
|
+
"""Returns the JSON representation of the actual instance"""
|
|
129
|
+
if self.actual_instance is None:
|
|
130
|
+
return "null"
|
|
131
|
+
|
|
132
|
+
to_json = getattr(self.actual_instance, "to_json", None)
|
|
133
|
+
if callable(to_json):
|
|
134
|
+
return self.actual_instance.to_json()
|
|
135
|
+
else:
|
|
136
|
+
return json.dumps(self.actual_instance)
|
|
137
|
+
|
|
138
|
+
def to_dict(self) -> dict:
|
|
139
|
+
"""Returns the dict representation of the actual instance"""
|
|
140
|
+
if self.actual_instance is None:
|
|
141
|
+
return "null"
|
|
142
|
+
|
|
143
|
+
to_json = getattr(self.actual_instance, "to_json", None)
|
|
144
|
+
if callable(to_json):
|
|
145
|
+
return self.actual_instance.to_dict()
|
|
146
|
+
else:
|
|
147
|
+
# primitive type
|
|
148
|
+
return self.actual_instance
|
|
149
|
+
|
|
150
|
+
def to_str(self) -> str:
|
|
151
|
+
"""Returns the string representation of the actual instance"""
|
|
152
|
+
return pprint.pformat(self.dict())
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
FastAPI
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
from typing import Any, Dict, Optional
|
|
20
|
+
|
|
21
|
+
from truefoundry.pydantic_v1 import BaseModel, StrictStr
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class CreateWorkflowTaskConfigRequestDto(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
CreateWorkflowTaskConfigRequestDto
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
task_name: Optional[StrictStr] = None
|
|
30
|
+
workflow_task_config: Optional[Dict[str, Any]] = None
|
|
31
|
+
__properties = ["task_name", "workflow_task_config"]
|
|
32
|
+
|
|
33
|
+
class Config:
|
|
34
|
+
"""Pydantic configuration"""
|
|
35
|
+
|
|
36
|
+
allow_population_by_field_name = True
|
|
37
|
+
validate_assignment = True
|
|
38
|
+
|
|
39
|
+
def to_str(self) -> str:
|
|
40
|
+
"""Returns the string representation of the model using alias"""
|
|
41
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
42
|
+
|
|
43
|
+
def to_json(self) -> str:
|
|
44
|
+
"""Returns the JSON representation of the model using alias"""
|
|
45
|
+
return json.dumps(self.to_dict())
|
|
46
|
+
|
|
47
|
+
@classmethod
|
|
48
|
+
def from_json(cls, json_str: str) -> CreateWorkflowTaskConfigRequestDto:
|
|
49
|
+
"""Create an instance of CreateWorkflowTaskConfigRequestDto from a JSON string"""
|
|
50
|
+
return cls.from_dict(json.loads(json_str))
|
|
51
|
+
|
|
52
|
+
def to_dict(self):
|
|
53
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
54
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
55
|
+
return _dict
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_dict(cls, obj: dict) -> CreateWorkflowTaskConfigRequestDto:
|
|
59
|
+
"""Create an instance of CreateWorkflowTaskConfigRequestDto from a dict"""
|
|
60
|
+
if obj is None:
|
|
61
|
+
return None
|
|
62
|
+
|
|
63
|
+
if not isinstance(obj, dict):
|
|
64
|
+
return CreateWorkflowTaskConfigRequestDto.parse_obj(obj)
|
|
65
|
+
|
|
66
|
+
_obj = CreateWorkflowTaskConfigRequestDto.parse_obj(
|
|
67
|
+
{
|
|
68
|
+
"task_name": obj.get("task_name"),
|
|
69
|
+
"workflow_task_config": obj.get("workflow_task_config"),
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
return _obj
|
|
@@ -22,11 +22,12 @@ from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, validator
|
|
|
22
22
|
|
|
23
23
|
class ExternalModelSource(BaseModel):
|
|
24
24
|
"""
|
|
25
|
-
|
|
25
|
+
+label=External # noqa: E501
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
type: StrictStr = Field(
|
|
29
|
-
default=...,
|
|
29
|
+
default=...,
|
|
30
|
+
description="+label=Type +usage=Type of the source +value=external +type=External",
|
|
30
31
|
)
|
|
31
32
|
uri: StrictStr = Field(
|
|
32
33
|
default=..., description="+label=URI +usage=URI of the model source"
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
FastAPI
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
|
|
20
|
+
from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, validator
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class FastAIFramework(BaseModel):
|
|
24
|
+
"""
|
|
25
|
+
+docs=FastAI framework for the model version +label=FastAI # noqa: E501
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
type: StrictStr = Field(
|
|
29
|
+
default=...,
|
|
30
|
+
description="+label=Type +usage=Type of the framework +value=fastai",
|
|
31
|
+
)
|
|
32
|
+
__properties = ["type"]
|
|
33
|
+
|
|
34
|
+
@validator("type")
|
|
35
|
+
def type_validate_enum(cls, value):
|
|
36
|
+
"""Validates the enum"""
|
|
37
|
+
if value not in ("fastai"):
|
|
38
|
+
raise ValueError("must be one of enum values ('fastai')")
|
|
39
|
+
return value
|
|
40
|
+
|
|
41
|
+
class Config:
|
|
42
|
+
"""Pydantic configuration"""
|
|
43
|
+
|
|
44
|
+
allow_population_by_field_name = True
|
|
45
|
+
validate_assignment = True
|
|
46
|
+
|
|
47
|
+
def to_str(self) -> str:
|
|
48
|
+
"""Returns the string representation of the model using alias"""
|
|
49
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
50
|
+
|
|
51
|
+
def to_json(self) -> str:
|
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
|
53
|
+
return json.dumps(self.to_dict())
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_json(cls, json_str: str) -> FastAIFramework:
|
|
57
|
+
"""Create an instance of FastAIFramework from a JSON string"""
|
|
58
|
+
return cls.from_dict(json.loads(json_str))
|
|
59
|
+
|
|
60
|
+
def to_dict(self):
|
|
61
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
62
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
63
|
+
return _dict
|
|
64
|
+
|
|
65
|
+
@classmethod
|
|
66
|
+
def from_dict(cls, obj: dict) -> FastAIFramework:
|
|
67
|
+
"""Create an instance of FastAIFramework from a dict"""
|
|
68
|
+
if obj is None:
|
|
69
|
+
return None
|
|
70
|
+
|
|
71
|
+
if not isinstance(obj, dict):
|
|
72
|
+
return FastAIFramework.parse_obj(obj)
|
|
73
|
+
|
|
74
|
+
_obj = FastAIFramework.parse_obj({"type": obj.get("type")})
|
|
75
|
+
return _obj
|
|
@@ -18,12 +18,26 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
from typing import TYPE_CHECKING, Any, List, Optional, Union
|
|
20
20
|
|
|
21
|
-
from truefoundry.ml.autogen.client.models.
|
|
22
|
-
|
|
21
|
+
from truefoundry.ml.autogen.client.models.fast_ai_framework import FastAIFramework
|
|
22
|
+
from truefoundry.ml.autogen.client.models.gluon_framework import GluonFramework
|
|
23
|
+
from truefoundry.ml.autogen.client.models.h2_o_framework import H2OFramework
|
|
24
|
+
from truefoundry.ml.autogen.client.models.keras_framework import KerasFramework
|
|
25
|
+
from truefoundry.ml.autogen.client.models.light_gbm_framework import LightGBMFramework
|
|
26
|
+
from truefoundry.ml.autogen.client.models.onnx_framework import ONNXFramework
|
|
27
|
+
from truefoundry.ml.autogen.client.models.paddle_framework import PaddleFramework
|
|
28
|
+
from truefoundry.ml.autogen.client.models.py_torch_framework import PyTorchFramework
|
|
29
|
+
from truefoundry.ml.autogen.client.models.sklearn_framework import SklearnFramework
|
|
30
|
+
from truefoundry.ml.autogen.client.models.spa_cy_framework import SpaCyFramework
|
|
31
|
+
from truefoundry.ml.autogen.client.models.stats_models_framework import (
|
|
32
|
+
StatsModelsFramework,
|
|
33
|
+
)
|
|
34
|
+
from truefoundry.ml.autogen.client.models.tensor_flow_framework import (
|
|
35
|
+
TensorFlowFramework,
|
|
23
36
|
)
|
|
24
37
|
from truefoundry.ml.autogen.client.models.transformers_framework import (
|
|
25
38
|
TransformersFramework,
|
|
26
39
|
)
|
|
40
|
+
from truefoundry.ml.autogen.client.models.xg_boost_framework import XGBoostFramework
|
|
27
41
|
from truefoundry.pydantic_v1 import (
|
|
28
42
|
BaseModel,
|
|
29
43
|
Field,
|
|
@@ -31,20 +45,74 @@ from truefoundry.pydantic_v1 import (
|
|
|
31
45
|
validator,
|
|
32
46
|
)
|
|
33
47
|
|
|
34
|
-
FRAMEWORK_ANY_OF_SCHEMAS = [
|
|
48
|
+
FRAMEWORK_ANY_OF_SCHEMAS = [
|
|
49
|
+
"FastAIFramework",
|
|
50
|
+
"GluonFramework",
|
|
51
|
+
"H2OFramework",
|
|
52
|
+
"KerasFramework",
|
|
53
|
+
"LightGBMFramework",
|
|
54
|
+
"ONNXFramework",
|
|
55
|
+
"PaddleFramework",
|
|
56
|
+
"PyTorchFramework",
|
|
57
|
+
"SklearnFramework",
|
|
58
|
+
"SpaCyFramework",
|
|
59
|
+
"StatsModelsFramework",
|
|
60
|
+
"TensorFlowFramework",
|
|
61
|
+
"TransformersFramework",
|
|
62
|
+
"XGBoostFramework",
|
|
63
|
+
]
|
|
35
64
|
|
|
36
65
|
|
|
37
66
|
class Framework(BaseModel):
|
|
38
67
|
"""
|
|
39
|
-
+label=Framework +usage=Framework for the model version
|
|
68
|
+
+label=Framework +usage=Framework for the model version
|
|
40
69
|
"""
|
|
41
70
|
|
|
42
71
|
# data type: TransformersFramework
|
|
43
72
|
anyof_schema_1_validator: Optional[TransformersFramework] = None
|
|
44
|
-
# data type:
|
|
45
|
-
anyof_schema_2_validator: Optional[
|
|
73
|
+
# data type: TensorFlowFramework
|
|
74
|
+
anyof_schema_2_validator: Optional[TensorFlowFramework] = None
|
|
75
|
+
# data type: SklearnFramework
|
|
76
|
+
anyof_schema_3_validator: Optional[SklearnFramework] = None
|
|
77
|
+
# data type: PyTorchFramework
|
|
78
|
+
anyof_schema_4_validator: Optional[PyTorchFramework] = None
|
|
79
|
+
# data type: KerasFramework
|
|
80
|
+
anyof_schema_5_validator: Optional[KerasFramework] = None
|
|
81
|
+
# data type: XGBoostFramework
|
|
82
|
+
anyof_schema_6_validator: Optional[XGBoostFramework] = None
|
|
83
|
+
# data type: LightGBMFramework
|
|
84
|
+
anyof_schema_7_validator: Optional[LightGBMFramework] = None
|
|
85
|
+
# data type: FastAIFramework
|
|
86
|
+
anyof_schema_8_validator: Optional[FastAIFramework] = None
|
|
87
|
+
# data type: H2OFramework
|
|
88
|
+
anyof_schema_9_validator: Optional[H2OFramework] = None
|
|
89
|
+
# data type: ONNXFramework
|
|
90
|
+
anyof_schema_10_validator: Optional[ONNXFramework] = None
|
|
91
|
+
# data type: SpaCyFramework
|
|
92
|
+
anyof_schema_11_validator: Optional[SpaCyFramework] = None
|
|
93
|
+
# data type: StatsModelsFramework
|
|
94
|
+
anyof_schema_12_validator: Optional[StatsModelsFramework] = None
|
|
95
|
+
# data type: GluonFramework
|
|
96
|
+
anyof_schema_13_validator: Optional[GluonFramework] = None
|
|
97
|
+
# data type: PaddleFramework
|
|
98
|
+
anyof_schema_14_validator: Optional[PaddleFramework] = None
|
|
46
99
|
if TYPE_CHECKING:
|
|
47
|
-
actual_instance: Union[
|
|
100
|
+
actual_instance: Union[
|
|
101
|
+
FastAIFramework,
|
|
102
|
+
GluonFramework,
|
|
103
|
+
H2OFramework,
|
|
104
|
+
KerasFramework,
|
|
105
|
+
LightGBMFramework,
|
|
106
|
+
ONNXFramework,
|
|
107
|
+
PaddleFramework,
|
|
108
|
+
PyTorchFramework,
|
|
109
|
+
SklearnFramework,
|
|
110
|
+
SpaCyFramework,
|
|
111
|
+
StatsModelsFramework,
|
|
112
|
+
TensorFlowFramework,
|
|
113
|
+
TransformersFramework,
|
|
114
|
+
XGBoostFramework,
|
|
115
|
+
]
|
|
48
116
|
else:
|
|
49
117
|
actual_instance: Any
|
|
50
118
|
any_of_schemas: List[str] = Field(FRAMEWORK_ANY_OF_SCHEMAS, const=True)
|
|
@@ -78,10 +146,106 @@ class Framework(BaseModel):
|
|
|
78
146
|
else:
|
|
79
147
|
return v
|
|
80
148
|
|
|
81
|
-
# validate data type:
|
|
82
|
-
if not isinstance(v,
|
|
149
|
+
# validate data type: TensorFlowFramework
|
|
150
|
+
if not isinstance(v, TensorFlowFramework):
|
|
151
|
+
error_messages.append(
|
|
152
|
+
f"Error! Input type `{type(v)}` is not `TensorFlowFramework`"
|
|
153
|
+
)
|
|
154
|
+
else:
|
|
155
|
+
return v
|
|
156
|
+
|
|
157
|
+
# validate data type: SklearnFramework
|
|
158
|
+
if not isinstance(v, SklearnFramework):
|
|
159
|
+
error_messages.append(
|
|
160
|
+
f"Error! Input type `{type(v)}` is not `SklearnFramework`"
|
|
161
|
+
)
|
|
162
|
+
else:
|
|
163
|
+
return v
|
|
164
|
+
|
|
165
|
+
# validate data type: PyTorchFramework
|
|
166
|
+
if not isinstance(v, PyTorchFramework):
|
|
167
|
+
error_messages.append(
|
|
168
|
+
f"Error! Input type `{type(v)}` is not `PyTorchFramework`"
|
|
169
|
+
)
|
|
170
|
+
else:
|
|
171
|
+
return v
|
|
172
|
+
|
|
173
|
+
# validate data type: KerasFramework
|
|
174
|
+
if not isinstance(v, KerasFramework):
|
|
175
|
+
error_messages.append(
|
|
176
|
+
f"Error! Input type `{type(v)}` is not `KerasFramework`"
|
|
177
|
+
)
|
|
178
|
+
else:
|
|
179
|
+
return v
|
|
180
|
+
|
|
181
|
+
# validate data type: XGBoostFramework
|
|
182
|
+
if not isinstance(v, XGBoostFramework):
|
|
83
183
|
error_messages.append(
|
|
84
|
-
f"Error! Input type `{type(v)}` is not `
|
|
184
|
+
f"Error! Input type `{type(v)}` is not `XGBoostFramework`"
|
|
185
|
+
)
|
|
186
|
+
else:
|
|
187
|
+
return v
|
|
188
|
+
|
|
189
|
+
# validate data type: LightGBMFramework
|
|
190
|
+
if not isinstance(v, LightGBMFramework):
|
|
191
|
+
error_messages.append(
|
|
192
|
+
f"Error! Input type `{type(v)}` is not `LightGBMFramework`"
|
|
193
|
+
)
|
|
194
|
+
else:
|
|
195
|
+
return v
|
|
196
|
+
|
|
197
|
+
# validate data type: FastAIFramework
|
|
198
|
+
if not isinstance(v, FastAIFramework):
|
|
199
|
+
error_messages.append(
|
|
200
|
+
f"Error! Input type `{type(v)}` is not `FastAIFramework`"
|
|
201
|
+
)
|
|
202
|
+
else:
|
|
203
|
+
return v
|
|
204
|
+
|
|
205
|
+
# validate data type: H2OFramework
|
|
206
|
+
if not isinstance(v, H2OFramework):
|
|
207
|
+
error_messages.append(
|
|
208
|
+
f"Error! Input type `{type(v)}` is not `H2OFramework`"
|
|
209
|
+
)
|
|
210
|
+
else:
|
|
211
|
+
return v
|
|
212
|
+
|
|
213
|
+
# validate data type: ONNXFramework
|
|
214
|
+
if not isinstance(v, ONNXFramework):
|
|
215
|
+
error_messages.append(
|
|
216
|
+
f"Error! Input type `{type(v)}` is not `ONNXFramework`"
|
|
217
|
+
)
|
|
218
|
+
else:
|
|
219
|
+
return v
|
|
220
|
+
|
|
221
|
+
# validate data type: SpaCyFramework
|
|
222
|
+
if not isinstance(v, SpaCyFramework):
|
|
223
|
+
error_messages.append(
|
|
224
|
+
f"Error! Input type `{type(v)}` is not `SpaCyFramework`"
|
|
225
|
+
)
|
|
226
|
+
else:
|
|
227
|
+
return v
|
|
228
|
+
|
|
229
|
+
# validate data type: StatsModelsFramework
|
|
230
|
+
if not isinstance(v, StatsModelsFramework):
|
|
231
|
+
error_messages.append(
|
|
232
|
+
f"Error! Input type `{type(v)}` is not `StatsModelsFramework`"
|
|
233
|
+
)
|
|
234
|
+
else:
|
|
235
|
+
return v
|
|
236
|
+
|
|
237
|
+
# validate data type: GluonFramework
|
|
238
|
+
if not isinstance(v, GluonFramework):
|
|
239
|
+
error_messages.append(
|
|
240
|
+
f"Error! Input type `{type(v)}` is not `GluonFramework`"
|
|
241
|
+
)
|
|
242
|
+
else:
|
|
243
|
+
return v
|
|
244
|
+
|
|
245
|
+
# validate data type: PaddleFramework
|
|
246
|
+
if not isinstance(v, PaddleFramework):
|
|
247
|
+
error_messages.append(
|
|
248
|
+
f"Error! Input type `{type(v)}` is not `PaddleFramework`"
|
|
85
249
|
)
|
|
86
250
|
else:
|
|
87
251
|
return v
|
|
@@ -89,7 +253,7 @@ class Framework(BaseModel):
|
|
|
89
253
|
if error_messages:
|
|
90
254
|
# no match
|
|
91
255
|
raise ValueError(
|
|
92
|
-
"No match found when setting the actual_instance in Framework with anyOf schemas:
|
|
256
|
+
"No match found when setting the actual_instance in Framework with anyOf schemas: FastAIFramework, GluonFramework, H2OFramework, KerasFramework, LightGBMFramework, ONNXFramework, PaddleFramework, PyTorchFramework, SklearnFramework, SpaCyFramework, StatsModelsFramework, TensorFlowFramework, TransformersFramework, XGBoostFramework. Details: "
|
|
93
257
|
+ ", ".join(error_messages)
|
|
94
258
|
)
|
|
95
259
|
else:
|
|
@@ -110,9 +274,81 @@ class Framework(BaseModel):
|
|
|
110
274
|
return instance
|
|
111
275
|
except (ValidationError, ValueError) as e:
|
|
112
276
|
error_messages.append(str(e))
|
|
113
|
-
# anyof_schema_2_validator: Optional[
|
|
277
|
+
# anyof_schema_2_validator: Optional[TensorFlowFramework] = None
|
|
278
|
+
try:
|
|
279
|
+
instance.actual_instance = TensorFlowFramework.from_json(json_str)
|
|
280
|
+
return instance
|
|
281
|
+
except (ValidationError, ValueError) as e:
|
|
282
|
+
error_messages.append(str(e))
|
|
283
|
+
# anyof_schema_3_validator: Optional[SklearnFramework] = None
|
|
284
|
+
try:
|
|
285
|
+
instance.actual_instance = SklearnFramework.from_json(json_str)
|
|
286
|
+
return instance
|
|
287
|
+
except (ValidationError, ValueError) as e:
|
|
288
|
+
error_messages.append(str(e))
|
|
289
|
+
# anyof_schema_4_validator: Optional[PyTorchFramework] = None
|
|
290
|
+
try:
|
|
291
|
+
instance.actual_instance = PyTorchFramework.from_json(json_str)
|
|
292
|
+
return instance
|
|
293
|
+
except (ValidationError, ValueError) as e:
|
|
294
|
+
error_messages.append(str(e))
|
|
295
|
+
# anyof_schema_5_validator: Optional[KerasFramework] = None
|
|
296
|
+
try:
|
|
297
|
+
instance.actual_instance = KerasFramework.from_json(json_str)
|
|
298
|
+
return instance
|
|
299
|
+
except (ValidationError, ValueError) as e:
|
|
300
|
+
error_messages.append(str(e))
|
|
301
|
+
# anyof_schema_6_validator: Optional[XGBoostFramework] = None
|
|
302
|
+
try:
|
|
303
|
+
instance.actual_instance = XGBoostFramework.from_json(json_str)
|
|
304
|
+
return instance
|
|
305
|
+
except (ValidationError, ValueError) as e:
|
|
306
|
+
error_messages.append(str(e))
|
|
307
|
+
# anyof_schema_7_validator: Optional[LightGBMFramework] = None
|
|
308
|
+
try:
|
|
309
|
+
instance.actual_instance = LightGBMFramework.from_json(json_str)
|
|
310
|
+
return instance
|
|
311
|
+
except (ValidationError, ValueError) as e:
|
|
312
|
+
error_messages.append(str(e))
|
|
313
|
+
# anyof_schema_8_validator: Optional[FastAIFramework] = None
|
|
314
|
+
try:
|
|
315
|
+
instance.actual_instance = FastAIFramework.from_json(json_str)
|
|
316
|
+
return instance
|
|
317
|
+
except (ValidationError, ValueError) as e:
|
|
318
|
+
error_messages.append(str(e))
|
|
319
|
+
# anyof_schema_9_validator: Optional[H2OFramework] = None
|
|
320
|
+
try:
|
|
321
|
+
instance.actual_instance = H2OFramework.from_json(json_str)
|
|
322
|
+
return instance
|
|
323
|
+
except (ValidationError, ValueError) as e:
|
|
324
|
+
error_messages.append(str(e))
|
|
325
|
+
# anyof_schema_10_validator: Optional[ONNXFramework] = None
|
|
326
|
+
try:
|
|
327
|
+
instance.actual_instance = ONNXFramework.from_json(json_str)
|
|
328
|
+
return instance
|
|
329
|
+
except (ValidationError, ValueError) as e:
|
|
330
|
+
error_messages.append(str(e))
|
|
331
|
+
# anyof_schema_11_validator: Optional[SpaCyFramework] = None
|
|
332
|
+
try:
|
|
333
|
+
instance.actual_instance = SpaCyFramework.from_json(json_str)
|
|
334
|
+
return instance
|
|
335
|
+
except (ValidationError, ValueError) as e:
|
|
336
|
+
error_messages.append(str(e))
|
|
337
|
+
# anyof_schema_12_validator: Optional[StatsModelsFramework] = None
|
|
338
|
+
try:
|
|
339
|
+
instance.actual_instance = StatsModelsFramework.from_json(json_str)
|
|
340
|
+
return instance
|
|
341
|
+
except (ValidationError, ValueError) as e:
|
|
342
|
+
error_messages.append(str(e))
|
|
343
|
+
# anyof_schema_13_validator: Optional[GluonFramework] = None
|
|
344
|
+
try:
|
|
345
|
+
instance.actual_instance = GluonFramework.from_json(json_str)
|
|
346
|
+
return instance
|
|
347
|
+
except (ValidationError, ValueError) as e:
|
|
348
|
+
error_messages.append(str(e))
|
|
349
|
+
# anyof_schema_14_validator: Optional[PaddleFramework] = None
|
|
114
350
|
try:
|
|
115
|
-
instance.actual_instance =
|
|
351
|
+
instance.actual_instance = PaddleFramework.from_json(json_str)
|
|
116
352
|
return instance
|
|
117
353
|
except (ValidationError, ValueError) as e:
|
|
118
354
|
error_messages.append(str(e))
|
|
@@ -120,7 +356,7 @@ class Framework(BaseModel):
|
|
|
120
356
|
if error_messages:
|
|
121
357
|
# no match
|
|
122
358
|
raise ValueError(
|
|
123
|
-
"No match found when deserializing the JSON string into Framework with anyOf schemas:
|
|
359
|
+
"No match found when deserializing the JSON string into Framework with anyOf schemas: FastAIFramework, GluonFramework, H2OFramework, KerasFramework, LightGBMFramework, ONNXFramework, PaddleFramework, PyTorchFramework, SklearnFramework, SpaCyFramework, StatsModelsFramework, TensorFlowFramework, TransformersFramework, XGBoostFramework. Details: "
|
|
124
360
|
+ ", ".join(error_messages)
|
|
125
361
|
)
|
|
126
362
|
else:
|