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,74 @@
|
|
|
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 GluonFramework(BaseModel):
|
|
24
|
+
"""
|
|
25
|
+
+docs=Gluon framework for the model version +label=Gluon # noqa: E501
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
type: StrictStr = Field(
|
|
29
|
+
default=..., description="+label=Type +usage=Type of the framework +value=gluon"
|
|
30
|
+
)
|
|
31
|
+
__properties = ["type"]
|
|
32
|
+
|
|
33
|
+
@validator("type")
|
|
34
|
+
def type_validate_enum(cls, value):
|
|
35
|
+
"""Validates the enum"""
|
|
36
|
+
if value not in ("gluon"):
|
|
37
|
+
raise ValueError("must be one of enum values ('gluon')")
|
|
38
|
+
return value
|
|
39
|
+
|
|
40
|
+
class Config:
|
|
41
|
+
"""Pydantic configuration"""
|
|
42
|
+
|
|
43
|
+
allow_population_by_field_name = True
|
|
44
|
+
validate_assignment = True
|
|
45
|
+
|
|
46
|
+
def to_str(self) -> str:
|
|
47
|
+
"""Returns the string representation of the model using alias"""
|
|
48
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
49
|
+
|
|
50
|
+
def to_json(self) -> str:
|
|
51
|
+
"""Returns the JSON representation of the model using alias"""
|
|
52
|
+
return json.dumps(self.to_dict())
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def from_json(cls, json_str: str) -> GluonFramework:
|
|
56
|
+
"""Create an instance of GluonFramework from a JSON string"""
|
|
57
|
+
return cls.from_dict(json.loads(json_str))
|
|
58
|
+
|
|
59
|
+
def to_dict(self):
|
|
60
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
61
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
62
|
+
return _dict
|
|
63
|
+
|
|
64
|
+
@classmethod
|
|
65
|
+
def from_dict(cls, obj: dict) -> GluonFramework:
|
|
66
|
+
"""Create an instance of GluonFramework from a dict"""
|
|
67
|
+
if obj is None:
|
|
68
|
+
return None
|
|
69
|
+
|
|
70
|
+
if not isinstance(obj, dict):
|
|
71
|
+
return GluonFramework.parse_obj(obj)
|
|
72
|
+
|
|
73
|
+
_obj = GluonFramework.parse_obj({"type": obj.get("type")})
|
|
74
|
+
return _obj
|
|
@@ -20,21 +20,21 @@ import re # noqa: F401
|
|
|
20
20
|
from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, validator
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
class
|
|
23
|
+
class H2OFramework(BaseModel):
|
|
24
24
|
"""
|
|
25
|
-
|
|
25
|
+
+docs=H2O framework for the model version +label=H2O # noqa: E501
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
type: StrictStr = Field(
|
|
29
|
-
default=..., description="+label=Type +usage=Type of the
|
|
29
|
+
default=..., description="+label=Type +usage=Type of the framework +value=h2o"
|
|
30
30
|
)
|
|
31
31
|
__properties = ["type"]
|
|
32
32
|
|
|
33
33
|
@validator("type")
|
|
34
34
|
def type_validate_enum(cls, value):
|
|
35
35
|
"""Validates the enum"""
|
|
36
|
-
if value not in ("
|
|
37
|
-
raise ValueError("must be one of enum values ('
|
|
36
|
+
if value not in ("h2o"):
|
|
37
|
+
raise ValueError("must be one of enum values ('h2o')")
|
|
38
38
|
return value
|
|
39
39
|
|
|
40
40
|
class Config:
|
|
@@ -52,8 +52,8 @@ class UploadModelSource(BaseModel):
|
|
|
52
52
|
return json.dumps(self.to_dict())
|
|
53
53
|
|
|
54
54
|
@classmethod
|
|
55
|
-
def from_json(cls, json_str: str) ->
|
|
56
|
-
"""Create an instance of
|
|
55
|
+
def from_json(cls, json_str: str) -> H2OFramework:
|
|
56
|
+
"""Create an instance of H2OFramework from a JSON string"""
|
|
57
57
|
return cls.from_dict(json.loads(json_str))
|
|
58
58
|
|
|
59
59
|
def to_dict(self):
|
|
@@ -62,13 +62,13 @@ class UploadModelSource(BaseModel):
|
|
|
62
62
|
return _dict
|
|
63
63
|
|
|
64
64
|
@classmethod
|
|
65
|
-
def from_dict(cls, obj: dict) ->
|
|
66
|
-
"""Create an instance of
|
|
65
|
+
def from_dict(cls, obj: dict) -> H2OFramework:
|
|
66
|
+
"""Create an instance of H2OFramework from a dict"""
|
|
67
67
|
if obj is None:
|
|
68
68
|
return None
|
|
69
69
|
|
|
70
70
|
if not isinstance(obj, dict):
|
|
71
|
-
return
|
|
71
|
+
return H2OFramework.parse_obj(obj)
|
|
72
72
|
|
|
73
|
-
_obj =
|
|
73
|
+
_obj = H2OFramework.parse_obj({"type": obj.get("type")})
|
|
74
74
|
return _obj
|
|
@@ -0,0 +1,74 @@
|
|
|
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 KerasFramework(BaseModel):
|
|
24
|
+
"""
|
|
25
|
+
+docs=Keras framework for the model version +label=Keras # noqa: E501
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
type: StrictStr = Field(
|
|
29
|
+
default=..., description="+label=Type +usage=Type of the framework +value=keras"
|
|
30
|
+
)
|
|
31
|
+
__properties = ["type"]
|
|
32
|
+
|
|
33
|
+
@validator("type")
|
|
34
|
+
def type_validate_enum(cls, value):
|
|
35
|
+
"""Validates the enum"""
|
|
36
|
+
if value not in ("keras"):
|
|
37
|
+
raise ValueError("must be one of enum values ('keras')")
|
|
38
|
+
return value
|
|
39
|
+
|
|
40
|
+
class Config:
|
|
41
|
+
"""Pydantic configuration"""
|
|
42
|
+
|
|
43
|
+
allow_population_by_field_name = True
|
|
44
|
+
validate_assignment = True
|
|
45
|
+
|
|
46
|
+
def to_str(self) -> str:
|
|
47
|
+
"""Returns the string representation of the model using alias"""
|
|
48
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
49
|
+
|
|
50
|
+
def to_json(self) -> str:
|
|
51
|
+
"""Returns the JSON representation of the model using alias"""
|
|
52
|
+
return json.dumps(self.to_dict())
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def from_json(cls, json_str: str) -> KerasFramework:
|
|
56
|
+
"""Create an instance of KerasFramework from a JSON string"""
|
|
57
|
+
return cls.from_dict(json.loads(json_str))
|
|
58
|
+
|
|
59
|
+
def to_dict(self):
|
|
60
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
61
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
62
|
+
return _dict
|
|
63
|
+
|
|
64
|
+
@classmethod
|
|
65
|
+
def from_dict(cls, obj: dict) -> KerasFramework:
|
|
66
|
+
"""Create an instance of KerasFramework from a dict"""
|
|
67
|
+
if obj is None:
|
|
68
|
+
return None
|
|
69
|
+
|
|
70
|
+
if not isinstance(obj, dict):
|
|
71
|
+
return KerasFramework.parse_obj(obj)
|
|
72
|
+
|
|
73
|
+
_obj = KerasFramework.parse_obj({"type": obj.get("type")})
|
|
74
|
+
return _obj
|
|
@@ -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 LightGBMFramework(BaseModel):
|
|
24
|
+
"""
|
|
25
|
+
+docs=LightGBM framework for the model version +label=LightGBM # noqa: E501
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
type: StrictStr = Field(
|
|
29
|
+
default=...,
|
|
30
|
+
description="+label=Type +usage=Type of the framework +value=lightgbm",
|
|
31
|
+
)
|
|
32
|
+
__properties = ["type"]
|
|
33
|
+
|
|
34
|
+
@validator("type")
|
|
35
|
+
def type_validate_enum(cls, value):
|
|
36
|
+
"""Validates the enum"""
|
|
37
|
+
if value not in ("lightgbm"):
|
|
38
|
+
raise ValueError("must be one of enum values ('lightgbm')")
|
|
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) -> LightGBMFramework:
|
|
57
|
+
"""Create an instance of LightGBMFramework 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) -> LightGBMFramework:
|
|
67
|
+
"""Create an instance of LightGBMFramework from a dict"""
|
|
68
|
+
if obj is None:
|
|
69
|
+
return None
|
|
70
|
+
|
|
71
|
+
if not isinstance(obj, dict):
|
|
72
|
+
return LightGBMFramework.parse_obj(obj)
|
|
73
|
+
|
|
74
|
+
_obj = LightGBMFramework.parse_obj({"type": obj.get("type")})
|
|
75
|
+
return _obj
|
|
@@ -41,7 +41,7 @@ class ModelVersionManifest(BaseModel):
|
|
|
41
41
|
)
|
|
42
42
|
metadata: Dict[str, Any] = Field(
|
|
43
43
|
default=...,
|
|
44
|
-
description="+label=Metadata +docs=Metadata for the
|
|
44
|
+
description="+label=Metadata +docs=Metadata for the model version +usage=Metadata for the model version +uiType=JsonInput",
|
|
45
45
|
)
|
|
46
46
|
type: Optional[StrictStr] = "model-version"
|
|
47
47
|
source: Source = Field(...)
|
|
@@ -0,0 +1,74 @@
|
|
|
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 ONNXFramework(BaseModel):
|
|
24
|
+
"""
|
|
25
|
+
+docs=ONNX framework for the model version +label=ONNX # noqa: E501
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
type: StrictStr = Field(
|
|
29
|
+
default=..., description="+label=Type +usage=Type of the framework +value=onnx"
|
|
30
|
+
)
|
|
31
|
+
__properties = ["type"]
|
|
32
|
+
|
|
33
|
+
@validator("type")
|
|
34
|
+
def type_validate_enum(cls, value):
|
|
35
|
+
"""Validates the enum"""
|
|
36
|
+
if value not in ("onnx"):
|
|
37
|
+
raise ValueError("must be one of enum values ('onnx')")
|
|
38
|
+
return value
|
|
39
|
+
|
|
40
|
+
class Config:
|
|
41
|
+
"""Pydantic configuration"""
|
|
42
|
+
|
|
43
|
+
allow_population_by_field_name = True
|
|
44
|
+
validate_assignment = True
|
|
45
|
+
|
|
46
|
+
def to_str(self) -> str:
|
|
47
|
+
"""Returns the string representation of the model using alias"""
|
|
48
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
49
|
+
|
|
50
|
+
def to_json(self) -> str:
|
|
51
|
+
"""Returns the JSON representation of the model using alias"""
|
|
52
|
+
return json.dumps(self.to_dict())
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def from_json(cls, json_str: str) -> ONNXFramework:
|
|
56
|
+
"""Create an instance of ONNXFramework from a JSON string"""
|
|
57
|
+
return cls.from_dict(json.loads(json_str))
|
|
58
|
+
|
|
59
|
+
def to_dict(self):
|
|
60
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
61
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
62
|
+
return _dict
|
|
63
|
+
|
|
64
|
+
@classmethod
|
|
65
|
+
def from_dict(cls, obj: dict) -> ONNXFramework:
|
|
66
|
+
"""Create an instance of ONNXFramework from a dict"""
|
|
67
|
+
if obj is None:
|
|
68
|
+
return None
|
|
69
|
+
|
|
70
|
+
if not isinstance(obj, dict):
|
|
71
|
+
return ONNXFramework.parse_obj(obj)
|
|
72
|
+
|
|
73
|
+
_obj = ONNXFramework.parse_obj({"type": obj.get("type")})
|
|
74
|
+
return _obj
|
|
@@ -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 PaddleFramework(BaseModel):
|
|
24
|
+
"""
|
|
25
|
+
+docs=PaddlePaddle framework for the model version +label=Paddle # noqa: E501
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
type: StrictStr = Field(
|
|
29
|
+
default=...,
|
|
30
|
+
description="+label=Type +usage=Type of the framework +value=paddle",
|
|
31
|
+
)
|
|
32
|
+
__properties = ["type"]
|
|
33
|
+
|
|
34
|
+
@validator("type")
|
|
35
|
+
def type_validate_enum(cls, value):
|
|
36
|
+
"""Validates the enum"""
|
|
37
|
+
if value not in ("paddle"):
|
|
38
|
+
raise ValueError("must be one of enum values ('paddle')")
|
|
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) -> PaddleFramework:
|
|
57
|
+
"""Create an instance of PaddleFramework 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) -> PaddleFramework:
|
|
67
|
+
"""Create an instance of PaddleFramework from a dict"""
|
|
68
|
+
if obj is None:
|
|
69
|
+
return None
|
|
70
|
+
|
|
71
|
+
if not isinstance(obj, dict):
|
|
72
|
+
return PaddleFramework.parse_obj(obj)
|
|
73
|
+
|
|
74
|
+
_obj = PaddleFramework.parse_obj({"type": obj.get("type")})
|
|
75
|
+
return _obj
|
|
@@ -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 PyTorchFramework(BaseModel):
|
|
24
|
+
"""
|
|
25
|
+
+docs=PyTorch framework for the model version +label=PyTorch # noqa: E501
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
type: StrictStr = Field(
|
|
29
|
+
default=...,
|
|
30
|
+
description="+label=Type +usage=Type of the framework +value=pytorch",
|
|
31
|
+
)
|
|
32
|
+
__properties = ["type"]
|
|
33
|
+
|
|
34
|
+
@validator("type")
|
|
35
|
+
def type_validate_enum(cls, value):
|
|
36
|
+
"""Validates the enum"""
|
|
37
|
+
if value not in ("pytorch"):
|
|
38
|
+
raise ValueError("must be one of enum values ('pytorch')")
|
|
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) -> PyTorchFramework:
|
|
57
|
+
"""Create an instance of PyTorchFramework 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) -> PyTorchFramework:
|
|
67
|
+
"""Create an instance of PyTorchFramework from a dict"""
|
|
68
|
+
if obj is None:
|
|
69
|
+
return None
|
|
70
|
+
|
|
71
|
+
if not isinstance(obj, dict):
|
|
72
|
+
return PyTorchFramework.parse_obj(obj)
|
|
73
|
+
|
|
74
|
+
_obj = PyTorchFramework.parse_obj({"type": obj.get("type")})
|
|
75
|
+
return _obj
|
|
@@ -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 SklearnFramework(BaseModel):
|
|
24
|
+
"""
|
|
25
|
+
+docs=Scikit-learn framework for the model version +label=Sklearn # noqa: E501
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
type: StrictStr = Field(
|
|
29
|
+
default=...,
|
|
30
|
+
description="+label=Type +usage=Type of the framework +value=sklearn",
|
|
31
|
+
)
|
|
32
|
+
__properties = ["type"]
|
|
33
|
+
|
|
34
|
+
@validator("type")
|
|
35
|
+
def type_validate_enum(cls, value):
|
|
36
|
+
"""Validates the enum"""
|
|
37
|
+
if value not in ("sklearn"):
|
|
38
|
+
raise ValueError("must be one of enum values ('sklearn')")
|
|
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) -> SklearnFramework:
|
|
57
|
+
"""Create an instance of SklearnFramework 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) -> SklearnFramework:
|
|
67
|
+
"""Create an instance of SklearnFramework from a dict"""
|
|
68
|
+
if obj is None:
|
|
69
|
+
return None
|
|
70
|
+
|
|
71
|
+
if not isinstance(obj, dict):
|
|
72
|
+
return SklearnFramework.parse_obj(obj)
|
|
73
|
+
|
|
74
|
+
_obj = SklearnFramework.parse_obj({"type": obj.get("type")})
|
|
75
|
+
return _obj
|
|
@@ -24,7 +24,6 @@ from truefoundry.ml.autogen.client.models.external_model_source import (
|
|
|
24
24
|
from truefoundry.ml.autogen.client.models.truefoundry_model_source import (
|
|
25
25
|
TruefoundryModelSource,
|
|
26
26
|
)
|
|
27
|
-
from truefoundry.ml.autogen.client.models.upload_model_source import UploadModelSource
|
|
28
27
|
from truefoundry.pydantic_v1 import (
|
|
29
28
|
BaseModel,
|
|
30
29
|
Field,
|
|
@@ -32,28 +31,20 @@ from truefoundry.pydantic_v1 import (
|
|
|
32
31
|
validator,
|
|
33
32
|
)
|
|
34
33
|
|
|
35
|
-
SOURCE_ANY_OF_SCHEMAS = [
|
|
36
|
-
"ExternalModelSource",
|
|
37
|
-
"TruefoundryModelSource",
|
|
38
|
-
"UploadModelSource",
|
|
39
|
-
]
|
|
34
|
+
SOURCE_ANY_OF_SCHEMAS = ["ExternalModelSource", "TruefoundryModelSource"]
|
|
40
35
|
|
|
41
36
|
|
|
42
37
|
class Source(BaseModel):
|
|
43
38
|
"""
|
|
44
|
-
+label=
|
|
39
|
+
+label=Model Source +usage=Source for the model version +uiType=Group
|
|
45
40
|
"""
|
|
46
41
|
|
|
47
|
-
# data type: UploadModelSource
|
|
48
|
-
anyof_schema_1_validator: Optional[UploadModelSource] = None
|
|
49
42
|
# data type: TruefoundryModelSource
|
|
50
|
-
|
|
43
|
+
anyof_schema_1_validator: Optional[TruefoundryModelSource] = None
|
|
51
44
|
# data type: ExternalModelSource
|
|
52
|
-
|
|
45
|
+
anyof_schema_2_validator: Optional[ExternalModelSource] = None
|
|
53
46
|
if TYPE_CHECKING:
|
|
54
|
-
actual_instance: Union[
|
|
55
|
-
ExternalModelSource, TruefoundryModelSource, UploadModelSource
|
|
56
|
-
]
|
|
47
|
+
actual_instance: Union[ExternalModelSource, TruefoundryModelSource]
|
|
57
48
|
else:
|
|
58
49
|
actual_instance: Any
|
|
59
50
|
any_of_schemas: List[str] = Field(SOURCE_ANY_OF_SCHEMAS, const=True)
|
|
@@ -79,14 +70,6 @@ class Source(BaseModel):
|
|
|
79
70
|
def actual_instance_must_validate_anyof(cls, v):
|
|
80
71
|
instance = Source.construct()
|
|
81
72
|
error_messages = []
|
|
82
|
-
# validate data type: UploadModelSource
|
|
83
|
-
if not isinstance(v, UploadModelSource):
|
|
84
|
-
error_messages.append(
|
|
85
|
-
f"Error! Input type `{type(v)}` is not `UploadModelSource`"
|
|
86
|
-
)
|
|
87
|
-
else:
|
|
88
|
-
return v
|
|
89
|
-
|
|
90
73
|
# validate data type: TruefoundryModelSource
|
|
91
74
|
if not isinstance(v, TruefoundryModelSource):
|
|
92
75
|
error_messages.append(
|
|
@@ -106,7 +89,7 @@ class Source(BaseModel):
|
|
|
106
89
|
if error_messages:
|
|
107
90
|
# no match
|
|
108
91
|
raise ValueError(
|
|
109
|
-
"No match found when setting the actual_instance in Source with anyOf schemas: ExternalModelSource, TruefoundryModelSource
|
|
92
|
+
"No match found when setting the actual_instance in Source with anyOf schemas: ExternalModelSource, TruefoundryModelSource. Details: "
|
|
110
93
|
+ ", ".join(error_messages)
|
|
111
94
|
)
|
|
112
95
|
else:
|
|
@@ -121,19 +104,13 @@ class Source(BaseModel):
|
|
|
121
104
|
"""Returns the object represented by the json string"""
|
|
122
105
|
instance = Source.construct()
|
|
123
106
|
error_messages = []
|
|
124
|
-
# anyof_schema_1_validator: Optional[
|
|
125
|
-
try:
|
|
126
|
-
instance.actual_instance = UploadModelSource.from_json(json_str)
|
|
127
|
-
return instance
|
|
128
|
-
except (ValidationError, ValueError) as e:
|
|
129
|
-
error_messages.append(str(e))
|
|
130
|
-
# anyof_schema_2_validator: Optional[TruefoundryModelSource] = None
|
|
107
|
+
# anyof_schema_1_validator: Optional[TruefoundryModelSource] = None
|
|
131
108
|
try:
|
|
132
109
|
instance.actual_instance = TruefoundryModelSource.from_json(json_str)
|
|
133
110
|
return instance
|
|
134
111
|
except (ValidationError, ValueError) as e:
|
|
135
112
|
error_messages.append(str(e))
|
|
136
|
-
#
|
|
113
|
+
# anyof_schema_2_validator: Optional[ExternalModelSource] = None
|
|
137
114
|
try:
|
|
138
115
|
instance.actual_instance = ExternalModelSource.from_json(json_str)
|
|
139
116
|
return instance
|
|
@@ -143,7 +120,7 @@ class Source(BaseModel):
|
|
|
143
120
|
if error_messages:
|
|
144
121
|
# no match
|
|
145
122
|
raise ValueError(
|
|
146
|
-
"No match found when deserializing the JSON string into Source with anyOf schemas: ExternalModelSource, TruefoundryModelSource
|
|
123
|
+
"No match found when deserializing the JSON string into Source with anyOf schemas: ExternalModelSource, TruefoundryModelSource. Details: "
|
|
147
124
|
+ ", ".join(error_messages)
|
|
148
125
|
)
|
|
149
126
|
else:
|