truefoundry 0.4.9rc1__py3-none-any.whl → 0.5.0__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/deploy/__init__.py +5 -0
- truefoundry/deploy/builder/builders/tfy_python_buildpack/dockerfile_template.py +2 -2
- truefoundry/deploy/lib/dao/application.py +2 -1
- truefoundry/deploy/v2/lib/patched_models.py +8 -0
- truefoundry/ml/__init__.py +41 -1
- truefoundry/ml/autogen/client/__init__.py +44 -14
- truefoundry/ml/autogen/client/api/__init__.py +3 -3
- truefoundry/ml/autogen/client/api/deprecated_api.py +333 -0
- truefoundry/ml/autogen/client/api/generate_code_snippet_api.py +526 -0
- truefoundry/ml/autogen/client/api/mlfoundry_artifacts_api.py +0 -322
- truefoundry/ml/autogen/client/api_client.py +8 -1
- truefoundry/ml/autogen/client/models/__init__.py +41 -11
- truefoundry/ml/autogen/client/models/add_features_to_model_version_request_dto.py +3 -17
- truefoundry/ml/autogen/client/models/agent.py +1 -1
- truefoundry/ml/autogen/client/models/agent_app.py +1 -1
- truefoundry/ml/autogen/client/models/agent_open_api_tool.py +1 -1
- truefoundry/ml/autogen/client/models/agent_open_api_tool_with_fqn.py +1 -1
- truefoundry/ml/autogen/client/models/agent_with_fqn.py +1 -1
- truefoundry/ml/autogen/client/models/artifact_version_dto.py +3 -5
- truefoundry/ml/autogen/client/models/artifact_version_manifest.py +111 -0
- truefoundry/ml/autogen/client/models/assistant_message.py +1 -1
- truefoundry/ml/autogen/client/models/blob_storage_reference.py +1 -1
- truefoundry/ml/autogen/client/models/chat_prompt.py +1 -1
- truefoundry/ml/autogen/client/models/command.py +152 -0
- truefoundry/ml/autogen/client/models/{feature_dto.py → create_workflow_task_config_request_dto.py} +18 -14
- truefoundry/ml/autogen/client/models/{external_model_source.py → external_artifact_source.py} +12 -11
- truefoundry/ml/autogen/client/models/fast_ai_framework.py +75 -0
- truefoundry/ml/autogen/client/models/finalize_artifact_version_request_dto.py +3 -5
- 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/image_content_part.py +1 -1
- 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/manifest.py +154 -0
- truefoundry/ml/autogen/client/models/model_version_dto.py +7 -8
- truefoundry/ml/autogen/client/models/model_version_environment.py +97 -0
- truefoundry/ml/autogen/client/models/model_version_manifest.py +30 -6
- 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/{feature_value_type.py → serialization_format.py} +8 -8
- truefoundry/ml/autogen/client/models/sklearn_framework.py +92 -0
- truefoundry/ml/autogen/client/models/source.py +23 -46
- truefoundry/ml/autogen/client/models/source1.py +154 -0
- 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/system_message.py +1 -1
- truefoundry/ml/autogen/client/models/{tensorflow_framework.py → tensor_flow_framework.py} +11 -10
- truefoundry/ml/autogen/client/models/text_content_part.py +1 -1
- truefoundry/ml/autogen/client/models/transformers_framework.py +10 -4
- 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 → true_foundry_artifact_source.py} +13 -11
- truefoundry/ml/autogen/client/models/update_artifact_version_request_dto.py +11 -1
- truefoundry/ml/autogen/client/models/update_model_version_request_dto.py +1 -13
- truefoundry/ml/autogen/client/models/user_message.py +1 -1
- truefoundry/ml/autogen/client/models/xg_boost_framework.py +92 -0
- truefoundry/ml/autogen/client_README.md +30 -12
- truefoundry/ml/autogen/entities/artifacts.py +87 -9
- truefoundry/ml/autogen/models/__init__.py +4 -0
- truefoundry/ml/autogen/models/exceptions.py +30 -0
- truefoundry/ml/autogen/models/schema.py +1547 -0
- truefoundry/ml/autogen/models/signature.py +139 -0
- truefoundry/ml/autogen/models/utils.py +699 -0
- truefoundry/ml/log_types/artifacts/artifact.py +131 -63
- truefoundry/ml/log_types/artifacts/general_artifact.py +7 -26
- truefoundry/ml/log_types/artifacts/model.py +195 -197
- truefoundry/ml/mlfoundry_api.py +47 -52
- truefoundry/ml/mlfoundry_run.py +35 -43
- truefoundry/ml/model_framework.py +169 -0
- {truefoundry-0.4.9rc1.dist-info → truefoundry-0.5.0.dist-info}/METADATA +1 -1
- {truefoundry-0.4.9rc1.dist-info → truefoundry-0.5.0.dist-info}/RECORD +75 -53
- truefoundry/ml/autogen/client/api/python_deployment_config_api.py +0 -201
- truefoundry/ml/autogen/client/models/model_schema_dto.py +0 -85
- truefoundry/ml/autogen/client/models/prediction_type.py +0 -34
- {truefoundry-0.4.9rc1.dist-info → truefoundry-0.5.0.dist-info}/WHEEL +0 -0
- {truefoundry-0.4.9rc1.dist-info → truefoundry-0.5.0.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,154 @@
|
|
|
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.ml.autogen.client.models.artifact_version_manifest import (
|
|
22
|
+
ArtifactVersionManifest,
|
|
23
|
+
)
|
|
24
|
+
from truefoundry.ml.autogen.client.models.model_version_manifest import (
|
|
25
|
+
ModelVersionManifest,
|
|
26
|
+
)
|
|
27
|
+
from truefoundry.pydantic_v1 import (
|
|
28
|
+
BaseModel,
|
|
29
|
+
Field,
|
|
30
|
+
ValidationError,
|
|
31
|
+
validator,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
MANIFEST_ANY_OF_SCHEMAS = ["ArtifactVersionManifest", "ModelVersionManifest"]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class Manifest(BaseModel):
|
|
38
|
+
"""
|
|
39
|
+
Manifest
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
# data type: ModelVersionManifest
|
|
43
|
+
anyof_schema_1_validator: Optional[ModelVersionManifest] = None
|
|
44
|
+
# data type: ArtifactVersionManifest
|
|
45
|
+
anyof_schema_2_validator: Optional[ArtifactVersionManifest] = None
|
|
46
|
+
if TYPE_CHECKING:
|
|
47
|
+
actual_instance: Union[ArtifactVersionManifest, ModelVersionManifest]
|
|
48
|
+
else:
|
|
49
|
+
actual_instance: Any
|
|
50
|
+
any_of_schemas: List[str] = Field(MANIFEST_ANY_OF_SCHEMAS, const=True)
|
|
51
|
+
|
|
52
|
+
class Config:
|
|
53
|
+
validate_assignment = True
|
|
54
|
+
|
|
55
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
56
|
+
if args:
|
|
57
|
+
if len(args) > 1:
|
|
58
|
+
raise ValueError(
|
|
59
|
+
"If a position argument is used, only 1 is allowed to set `actual_instance`"
|
|
60
|
+
)
|
|
61
|
+
if kwargs:
|
|
62
|
+
raise ValueError(
|
|
63
|
+
"If a position argument is used, keyword arguments cannot be used."
|
|
64
|
+
)
|
|
65
|
+
super().__init__(actual_instance=args[0])
|
|
66
|
+
else:
|
|
67
|
+
super().__init__(**kwargs)
|
|
68
|
+
|
|
69
|
+
@validator("actual_instance")
|
|
70
|
+
def actual_instance_must_validate_anyof(cls, v):
|
|
71
|
+
instance = Manifest.construct()
|
|
72
|
+
error_messages = []
|
|
73
|
+
# validate data type: ModelVersionManifest
|
|
74
|
+
if not isinstance(v, ModelVersionManifest):
|
|
75
|
+
error_messages.append(
|
|
76
|
+
f"Error! Input type `{type(v)}` is not `ModelVersionManifest`"
|
|
77
|
+
)
|
|
78
|
+
else:
|
|
79
|
+
return v
|
|
80
|
+
|
|
81
|
+
# validate data type: ArtifactVersionManifest
|
|
82
|
+
if not isinstance(v, ArtifactVersionManifest):
|
|
83
|
+
error_messages.append(
|
|
84
|
+
f"Error! Input type `{type(v)}` is not `ArtifactVersionManifest`"
|
|
85
|
+
)
|
|
86
|
+
else:
|
|
87
|
+
return v
|
|
88
|
+
|
|
89
|
+
if error_messages:
|
|
90
|
+
# no match
|
|
91
|
+
raise ValueError(
|
|
92
|
+
"No match found when setting the actual_instance in Manifest with anyOf schemas: ArtifactVersionManifest, ModelVersionManifest. Details: "
|
|
93
|
+
+ ", ".join(error_messages)
|
|
94
|
+
)
|
|
95
|
+
else:
|
|
96
|
+
return v
|
|
97
|
+
|
|
98
|
+
@classmethod
|
|
99
|
+
def from_dict(cls, obj: dict) -> Manifest:
|
|
100
|
+
return cls.from_json(json.dumps(obj))
|
|
101
|
+
|
|
102
|
+
@classmethod
|
|
103
|
+
def from_json(cls, json_str: str) -> Manifest:
|
|
104
|
+
"""Returns the object represented by the json string"""
|
|
105
|
+
instance = Manifest.construct()
|
|
106
|
+
error_messages = []
|
|
107
|
+
# anyof_schema_1_validator: Optional[ModelVersionManifest] = None
|
|
108
|
+
try:
|
|
109
|
+
instance.actual_instance = ModelVersionManifest.from_json(json_str)
|
|
110
|
+
return instance
|
|
111
|
+
except (ValidationError, ValueError) as e:
|
|
112
|
+
error_messages.append(str(e))
|
|
113
|
+
# anyof_schema_2_validator: Optional[ArtifactVersionManifest] = None
|
|
114
|
+
try:
|
|
115
|
+
instance.actual_instance = ArtifactVersionManifest.from_json(json_str)
|
|
116
|
+
return instance
|
|
117
|
+
except (ValidationError, ValueError) as e:
|
|
118
|
+
error_messages.append(str(e))
|
|
119
|
+
|
|
120
|
+
if error_messages:
|
|
121
|
+
# no match
|
|
122
|
+
raise ValueError(
|
|
123
|
+
"No match found when deserializing the JSON string into Manifest with anyOf schemas: ArtifactVersionManifest, ModelVersionManifest. Details: "
|
|
124
|
+
+ ", ".join(error_messages)
|
|
125
|
+
)
|
|
126
|
+
else:
|
|
127
|
+
return instance
|
|
128
|
+
|
|
129
|
+
def to_json(self) -> str:
|
|
130
|
+
"""Returns the JSON representation of the actual instance"""
|
|
131
|
+
if self.actual_instance is None:
|
|
132
|
+
return "null"
|
|
133
|
+
|
|
134
|
+
to_json = getattr(self.actual_instance, "to_json", None)
|
|
135
|
+
if callable(to_json):
|
|
136
|
+
return self.actual_instance.to_json()
|
|
137
|
+
else:
|
|
138
|
+
return json.dumps(self.actual_instance)
|
|
139
|
+
|
|
140
|
+
def to_dict(self) -> dict:
|
|
141
|
+
"""Returns the dict representation of the actual instance"""
|
|
142
|
+
if self.actual_instance is None:
|
|
143
|
+
return "null"
|
|
144
|
+
|
|
145
|
+
to_json = getattr(self.actual_instance, "to_json", None)
|
|
146
|
+
if callable(to_json):
|
|
147
|
+
return self.actual_instance.to_dict()
|
|
148
|
+
else:
|
|
149
|
+
# primitive type
|
|
150
|
+
return self.actual_instance
|
|
151
|
+
|
|
152
|
+
def to_str(self) -> str:
|
|
153
|
+
"""Returns the string representation of the actual instance"""
|
|
154
|
+
return pprint.pformat(self.dict())
|
|
@@ -26,7 +26,6 @@ from truefoundry.ml.autogen.client.models.artifact_version_status import (
|
|
|
26
26
|
ArtifactVersionStatus,
|
|
27
27
|
)
|
|
28
28
|
from truefoundry.ml.autogen.client.models.metric_dto import MetricDto
|
|
29
|
-
from truefoundry.ml.autogen.client.models.model_schema_dto import ModelSchemaDto
|
|
30
29
|
from truefoundry.ml.autogen.client.models.model_version_manifest import (
|
|
31
30
|
ModelVersionManifest,
|
|
32
31
|
)
|
|
@@ -58,7 +57,7 @@ class ModelVersionDto(BaseModel):
|
|
|
58
57
|
step: Optional[StrictInt] = 0
|
|
59
58
|
created_by: Optional[StrictStr] = None
|
|
60
59
|
created_by_subject: Subject = Field(...)
|
|
61
|
-
model_schema: Optional[
|
|
60
|
+
model_schema: Optional[Dict[str, Any]] = None
|
|
62
61
|
custom_metrics: Optional[conlist(Dict[str, Any])] = None
|
|
63
62
|
created_at: Optional[datetime] = None
|
|
64
63
|
updated_at: Optional[datetime] = None
|
|
@@ -73,6 +72,7 @@ class ModelVersionDto(BaseModel):
|
|
|
73
72
|
artifact_size: Optional[StrictInt] = None
|
|
74
73
|
manifest: Optional[ModelVersionManifest] = None
|
|
75
74
|
serialization_format: ArtifactVersionSerializationFormat = Field(...)
|
|
75
|
+
deployable: Optional[StrictBool] = False
|
|
76
76
|
__properties = [
|
|
77
77
|
"id",
|
|
78
78
|
"model_id",
|
|
@@ -101,6 +101,7 @@ class ModelVersionDto(BaseModel):
|
|
|
101
101
|
"artifact_size",
|
|
102
102
|
"manifest",
|
|
103
103
|
"serialization_format",
|
|
104
|
+
"deployable",
|
|
104
105
|
]
|
|
105
106
|
|
|
106
107
|
class Config:
|
|
@@ -128,9 +129,6 @@ class ModelVersionDto(BaseModel):
|
|
|
128
129
|
# override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of created_by_subject
|
|
129
130
|
if self.created_by_subject:
|
|
130
131
|
_dict["created_by_subject"] = self.created_by_subject.to_dict()
|
|
131
|
-
# override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of model_schema
|
|
132
|
-
if self.model_schema:
|
|
133
|
-
_dict["model_schema"] = self.model_schema.to_dict()
|
|
134
132
|
# override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of each item in metrics (list)
|
|
135
133
|
_items = []
|
|
136
134
|
if self.metrics:
|
|
@@ -168,9 +166,7 @@ class ModelVersionDto(BaseModel):
|
|
|
168
166
|
"created_by_subject": Subject.from_dict(obj.get("created_by_subject"))
|
|
169
167
|
if obj.get("created_by_subject") is not None
|
|
170
168
|
else None,
|
|
171
|
-
"model_schema":
|
|
172
|
-
if obj.get("model_schema") is not None
|
|
173
|
-
else None,
|
|
169
|
+
"model_schema": obj.get("model_schema"),
|
|
174
170
|
"custom_metrics": obj.get("custom_metrics"),
|
|
175
171
|
"created_at": obj.get("created_at"),
|
|
176
172
|
"updated_at": obj.get("updated_at"),
|
|
@@ -191,6 +187,9 @@ class ModelVersionDto(BaseModel):
|
|
|
191
187
|
if obj.get("manifest") is not None
|
|
192
188
|
else None,
|
|
193
189
|
"serialization_format": obj.get("serialization_format"),
|
|
190
|
+
"deployable": obj.get("deployable")
|
|
191
|
+
if obj.get("deployable") is not None
|
|
192
|
+
else False,
|
|
194
193
|
}
|
|
195
194
|
)
|
|
196
195
|
return _obj
|
|
@@ -0,0 +1,97 @@
|
|
|
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 Optional
|
|
20
|
+
|
|
21
|
+
from truefoundry.pydantic_v1 import (
|
|
22
|
+
BaseModel,
|
|
23
|
+
Field,
|
|
24
|
+
StrictStr,
|
|
25
|
+
conlist,
|
|
26
|
+
constr,
|
|
27
|
+
validator,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class ModelVersionEnvironment(BaseModel):
|
|
32
|
+
"""
|
|
33
|
+
+label=ModelVersionEnvironment # noqa: E501
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
python_version: Optional[constr(strict=True)] = Field(
|
|
37
|
+
default=None,
|
|
38
|
+
description="+label=Python Version +usage=Python version for the model version",
|
|
39
|
+
)
|
|
40
|
+
pip_packages: Optional[conlist(StrictStr)] = Field(
|
|
41
|
+
default=None,
|
|
42
|
+
description="+label=PIP Packages +usage=PIP packages for the model version",
|
|
43
|
+
)
|
|
44
|
+
__properties = ["python_version", "pip_packages"]
|
|
45
|
+
|
|
46
|
+
@validator("python_version")
|
|
47
|
+
def python_version_validate_regular_expression(cls, value):
|
|
48
|
+
"""Validates the regular expression"""
|
|
49
|
+
if value is None:
|
|
50
|
+
return value
|
|
51
|
+
|
|
52
|
+
if not re.match(r"^\d+(\.\d+){1,2}([\-\.a-z0-9]+)?$", value):
|
|
53
|
+
raise ValueError(
|
|
54
|
+
r"must validate the regular expression /^\d+(\.\d+){1,2}([\-\.a-z0-9]+)?$/"
|
|
55
|
+
)
|
|
56
|
+
return value
|
|
57
|
+
|
|
58
|
+
class Config:
|
|
59
|
+
"""Pydantic configuration"""
|
|
60
|
+
|
|
61
|
+
allow_population_by_field_name = True
|
|
62
|
+
validate_assignment = True
|
|
63
|
+
|
|
64
|
+
def to_str(self) -> str:
|
|
65
|
+
"""Returns the string representation of the model using alias"""
|
|
66
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
67
|
+
|
|
68
|
+
def to_json(self) -> str:
|
|
69
|
+
"""Returns the JSON representation of the model using alias"""
|
|
70
|
+
return json.dumps(self.to_dict())
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def from_json(cls, json_str: str) -> ModelVersionEnvironment:
|
|
74
|
+
"""Create an instance of ModelVersionEnvironment from a JSON string"""
|
|
75
|
+
return cls.from_dict(json.loads(json_str))
|
|
76
|
+
|
|
77
|
+
def to_dict(self):
|
|
78
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
79
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: dict) -> ModelVersionEnvironment:
|
|
84
|
+
"""Create an instance of ModelVersionEnvironment from a dict"""
|
|
85
|
+
if obj is None:
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
if not isinstance(obj, dict):
|
|
89
|
+
return ModelVersionEnvironment.parse_obj(obj)
|
|
90
|
+
|
|
91
|
+
_obj = ModelVersionEnvironment.parse_obj(
|
|
92
|
+
{
|
|
93
|
+
"python_version": obj.get("python_version"),
|
|
94
|
+
"pip_packages": obj.get("pip_packages"),
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
return _obj
|
|
@@ -19,7 +19,10 @@ import re # noqa: F401
|
|
|
19
19
|
from typing import Any, Dict, Optional
|
|
20
20
|
|
|
21
21
|
from truefoundry.ml.autogen.client.models.framework import Framework
|
|
22
|
-
from truefoundry.ml.autogen.client.models.
|
|
22
|
+
from truefoundry.ml.autogen.client.models.model_version_environment import (
|
|
23
|
+
ModelVersionEnvironment,
|
|
24
|
+
)
|
|
25
|
+
from truefoundry.ml.autogen.client.models.source1 import Source1
|
|
23
26
|
from truefoundry.pydantic_v1 import (
|
|
24
27
|
BaseModel,
|
|
25
28
|
Field,
|
|
@@ -41,15 +44,29 @@ class ModelVersionManifest(BaseModel):
|
|
|
41
44
|
)
|
|
42
45
|
metadata: Dict[str, Any] = Field(
|
|
43
46
|
default=...,
|
|
44
|
-
description="+label=Metadata +docs=Metadata for the
|
|
47
|
+
description="+label=Metadata +docs=Metadata for the model version +usage=Metadata for the model version +uiType=JsonInput",
|
|
45
48
|
)
|
|
46
49
|
type: Optional[StrictStr] = "model-version"
|
|
47
|
-
source:
|
|
50
|
+
source: Source1 = Field(...)
|
|
48
51
|
framework: Optional[Framework] = None
|
|
52
|
+
environment: Optional[ModelVersionEnvironment] = None
|
|
49
53
|
step: Optional[conint(strict=True, ge=0)] = Field(
|
|
50
54
|
default=0, description="+label=Step"
|
|
51
55
|
)
|
|
52
|
-
|
|
56
|
+
model_schema: Optional[Dict[str, Any]] = Field(
|
|
57
|
+
default=None,
|
|
58
|
+
description="+label=Model Schema +usage=Schema of the model +uiType=Hidden",
|
|
59
|
+
)
|
|
60
|
+
__properties = [
|
|
61
|
+
"description",
|
|
62
|
+
"metadata",
|
|
63
|
+
"type",
|
|
64
|
+
"source",
|
|
65
|
+
"framework",
|
|
66
|
+
"environment",
|
|
67
|
+
"step",
|
|
68
|
+
"model_schema",
|
|
69
|
+
]
|
|
53
70
|
|
|
54
71
|
@validator("type")
|
|
55
72
|
def type_validate_enum(cls, value):
|
|
@@ -57,7 +74,7 @@ class ModelVersionManifest(BaseModel):
|
|
|
57
74
|
if value is None:
|
|
58
75
|
return value
|
|
59
76
|
|
|
60
|
-
if value not in ("model-version"):
|
|
77
|
+
if value not in ("model-version",):
|
|
61
78
|
raise ValueError("must be one of enum values ('model-version')")
|
|
62
79
|
return value
|
|
63
80
|
|
|
@@ -89,6 +106,9 @@ class ModelVersionManifest(BaseModel):
|
|
|
89
106
|
# override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of framework
|
|
90
107
|
if self.framework:
|
|
91
108
|
_dict["framework"] = self.framework.to_dict()
|
|
109
|
+
# override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of environment
|
|
110
|
+
if self.environment:
|
|
111
|
+
_dict["environment"] = self.environment.to_dict()
|
|
92
112
|
return _dict
|
|
93
113
|
|
|
94
114
|
@classmethod
|
|
@@ -107,13 +127,17 @@ class ModelVersionManifest(BaseModel):
|
|
|
107
127
|
"type": obj.get("type")
|
|
108
128
|
if obj.get("type") is not None
|
|
109
129
|
else "model-version",
|
|
110
|
-
"source":
|
|
130
|
+
"source": Source1.from_dict(obj.get("source"))
|
|
111
131
|
if obj.get("source") is not None
|
|
112
132
|
else None,
|
|
113
133
|
"framework": Framework.from_dict(obj.get("framework"))
|
|
114
134
|
if obj.get("framework") is not None
|
|
115
135
|
else None,
|
|
136
|
+
"environment": ModelVersionEnvironment.from_dict(obj.get("environment"))
|
|
137
|
+
if obj.get("environment") is not None
|
|
138
|
+
else None,
|
|
116
139
|
"step": obj.get("step") if obj.get("step") is not None else 0,
|
|
140
|
+
"model_schema": obj.get("model_schema"),
|
|
117
141
|
}
|
|
118
142
|
)
|
|
119
143
|
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 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
|
|
@@ -17,19 +17,19 @@ import re # noqa: F401
|
|
|
17
17
|
from aenum import Enum
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
class
|
|
20
|
+
class SerializationFormat(str, Enum):
|
|
21
21
|
"""
|
|
22
|
-
|
|
22
|
+
+label=Serialization format +usage=Serialization format used for the model
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
"""
|
|
26
26
|
allowed enum values
|
|
27
27
|
"""
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
CLOUDPICKLE = "cloudpickle"
|
|
29
|
+
JOBLIB = "joblib"
|
|
30
|
+
PICKLE = "pickle"
|
|
31
31
|
|
|
32
32
|
@classmethod
|
|
33
|
-
def from_json(cls, json_str: str) ->
|
|
34
|
-
"""Create an instance of
|
|
35
|
-
return
|
|
33
|
+
def from_json(cls, json_str: str) -> SerializationFormat:
|
|
34
|
+
"""Create an instance of SerializationFormat from a JSON string"""
|
|
35
|
+
return SerializationFormat(json.loads(json_str))
|