truefoundry 0.5.1rc6__py3-none-any.whl → 0.5.1rc7__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/ml/autogen/client/__init__.py +12 -3
- truefoundry/ml/autogen/client/api/mlfoundry_artifacts_api.py +164 -0
- truefoundry/ml/autogen/client/models/__init__.py +12 -3
- truefoundry/ml/autogen/client/models/sklearn_framework.py +4 -7
- truefoundry/ml/autogen/client/models/sklearn_model_schema.py +1 -1
- truefoundry/ml/autogen/client/models/{serialization_format.py → sklearn_serialization_format.py} +5 -5
- truefoundry/ml/autogen/client/models/validate_external_storage_root_request_dto.py +71 -0
- truefoundry/ml/autogen/client/models/validate_external_storage_root_response_dto.py +69 -0
- truefoundry/ml/autogen/client/models/xg_boost_framework.py +4 -7
- truefoundry/ml/autogen/client/models/xg_boost_model_schema.py +10 -4
- truefoundry/ml/autogen/client/models/xg_boost_serialization_format.py +36 -0
- truefoundry/ml/autogen/client_README.md +5 -1
- truefoundry/ml/autogen/entities/artifacts.py +49 -36
- truefoundry/ml/model_framework.py +97 -69
- {truefoundry-0.5.1rc6.dist-info → truefoundry-0.5.1rc7.dist-info}/METADATA +1 -1
- {truefoundry-0.5.1rc6.dist-info → truefoundry-0.5.1rc7.dist-info}/RECORD +18 -15
- {truefoundry-0.5.1rc6.dist-info → truefoundry-0.5.1rc7.dist-info}/WHEEL +0 -0
- {truefoundry-0.5.1rc6.dist-info → truefoundry-0.5.1rc7.dist-info}/entry_points.txt +0 -0
|
@@ -363,9 +363,6 @@ from truefoundry.ml.autogen.client.models.search_runs_request_dto import (
|
|
|
363
363
|
from truefoundry.ml.autogen.client.models.search_runs_response_dto import (
|
|
364
364
|
SearchRunsResponseDto,
|
|
365
365
|
)
|
|
366
|
-
from truefoundry.ml.autogen.client.models.serialization_format import (
|
|
367
|
-
SerializationFormat,
|
|
368
|
-
)
|
|
369
366
|
from truefoundry.ml.autogen.client.models.set_experiment_tag_request_dto import (
|
|
370
367
|
SetExperimentTagRequestDto,
|
|
371
368
|
)
|
|
@@ -373,6 +370,9 @@ from truefoundry.ml.autogen.client.models.set_tag_request_dto import SetTagReque
|
|
|
373
370
|
from truefoundry.ml.autogen.client.models.signed_url_dto import SignedURLDto
|
|
374
371
|
from truefoundry.ml.autogen.client.models.sklearn_framework import SklearnFramework
|
|
375
372
|
from truefoundry.ml.autogen.client.models.sklearn_model_schema import SklearnModelSchema
|
|
373
|
+
from truefoundry.ml.autogen.client.models.sklearn_serialization_format import (
|
|
374
|
+
SklearnSerializationFormat,
|
|
375
|
+
)
|
|
376
376
|
from truefoundry.ml.autogen.client.models.source import Source
|
|
377
377
|
from truefoundry.ml.autogen.client.models.source1 import Source1
|
|
378
378
|
from truefoundry.ml.autogen.client.models.spa_cy_framework import SpaCyFramework
|
|
@@ -423,6 +423,12 @@ from truefoundry.ml.autogen.client.models.update_run_response_dto import (
|
|
|
423
423
|
)
|
|
424
424
|
from truefoundry.ml.autogen.client.models.url import Url
|
|
425
425
|
from truefoundry.ml.autogen.client.models.user_message import UserMessage
|
|
426
|
+
from truefoundry.ml.autogen.client.models.validate_external_storage_root_request_dto import (
|
|
427
|
+
ValidateExternalStorageRootRequestDto,
|
|
428
|
+
)
|
|
429
|
+
from truefoundry.ml.autogen.client.models.validate_external_storage_root_response_dto import (
|
|
430
|
+
ValidateExternalStorageRootResponseDto,
|
|
431
|
+
)
|
|
426
432
|
from truefoundry.ml.autogen.client.models.validation_error import ValidationError
|
|
427
433
|
from truefoundry.ml.autogen.client.models.validation_error_loc_inner import (
|
|
428
434
|
ValidationErrorLocInner,
|
|
@@ -431,3 +437,6 @@ from truefoundry.ml.autogen.client.models.xg_boost_framework import XGBoostFrame
|
|
|
431
437
|
from truefoundry.ml.autogen.client.models.xg_boost_model_schema import (
|
|
432
438
|
XGBoostModelSchema,
|
|
433
439
|
)
|
|
440
|
+
from truefoundry.ml.autogen.client.models.xg_boost_serialization_format import (
|
|
441
|
+
XGBoostSerializationFormat,
|
|
442
|
+
)
|
|
@@ -167,6 +167,12 @@ from truefoundry.ml.autogen.client.models.update_dataset_request_dto import (
|
|
|
167
167
|
from truefoundry.ml.autogen.client.models.update_model_version_request_dto import (
|
|
168
168
|
UpdateModelVersionRequestDto,
|
|
169
169
|
)
|
|
170
|
+
from truefoundry.ml.autogen.client.models.validate_external_storage_root_request_dto import (
|
|
171
|
+
ValidateExternalStorageRootRequestDto,
|
|
172
|
+
)
|
|
173
|
+
from truefoundry.ml.autogen.client.models.validate_external_storage_root_response_dto import (
|
|
174
|
+
ValidateExternalStorageRootResponseDto,
|
|
175
|
+
)
|
|
170
176
|
from truefoundry.pydantic_v1 import (
|
|
171
177
|
StrictInt,
|
|
172
178
|
StrictStr,
|
|
@@ -7215,3 +7221,161 @@ class MlfoundryArtifactsApi:
|
|
|
7215
7221
|
collection_formats=_collection_formats,
|
|
7216
7222
|
_request_auth=_params.get("_request_auth"),
|
|
7217
7223
|
)
|
|
7224
|
+
|
|
7225
|
+
@validate_arguments
|
|
7226
|
+
def validate_external_storage_root_path_post(
|
|
7227
|
+
self,
|
|
7228
|
+
validate_external_storage_root_request_dto: ValidateExternalStorageRootRequestDto,
|
|
7229
|
+
**kwargs,
|
|
7230
|
+
) -> ValidateExternalStorageRootResponseDto: # noqa: E501
|
|
7231
|
+
"""Validate External Storage Root Path # noqa: E501
|
|
7232
|
+
|
|
7233
|
+
This method makes a synchronous HTTP request by default. To make an
|
|
7234
|
+
asynchronous HTTP request, please pass async_req=True
|
|
7235
|
+
|
|
7236
|
+
>>> thread = api.validate_external_storage_root_path_post(validate_external_storage_root_request_dto, async_req=True)
|
|
7237
|
+
>>> result = thread.get()
|
|
7238
|
+
|
|
7239
|
+
:param validate_external_storage_root_request_dto: (required)
|
|
7240
|
+
:type validate_external_storage_root_request_dto: ValidateExternalStorageRootRequestDto
|
|
7241
|
+
:param async_req: Whether to execute the request asynchronously.
|
|
7242
|
+
:type async_req: bool, optional
|
|
7243
|
+
:param _request_timeout: timeout setting for this request.
|
|
7244
|
+
If one number provided, it will be total request
|
|
7245
|
+
timeout. It can also be a pair (tuple) of
|
|
7246
|
+
(connection, read) timeouts.
|
|
7247
|
+
:return: Returns the result object.
|
|
7248
|
+
If the method is called asynchronously,
|
|
7249
|
+
returns the request thread.
|
|
7250
|
+
:rtype: ValidateExternalStorageRootResponseDto
|
|
7251
|
+
"""
|
|
7252
|
+
kwargs["_return_http_data_only"] = True
|
|
7253
|
+
if "_preload_content" in kwargs:
|
|
7254
|
+
message = "Error! Please call the validate_external_storage_root_path_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
|
|
7255
|
+
raise ValueError(message)
|
|
7256
|
+
return self.validate_external_storage_root_path_post_with_http_info(
|
|
7257
|
+
validate_external_storage_root_request_dto, **kwargs
|
|
7258
|
+
) # noqa: E501
|
|
7259
|
+
|
|
7260
|
+
@validate_arguments
|
|
7261
|
+
def validate_external_storage_root_path_post_with_http_info(
|
|
7262
|
+
self,
|
|
7263
|
+
validate_external_storage_root_request_dto: ValidateExternalStorageRootRequestDto,
|
|
7264
|
+
**kwargs,
|
|
7265
|
+
) -> ApiResponse: # noqa: E501
|
|
7266
|
+
"""Validate External Storage Root Path # noqa: E501
|
|
7267
|
+
|
|
7268
|
+
This method makes a synchronous HTTP request by default. To make an
|
|
7269
|
+
asynchronous HTTP request, please pass async_req=True
|
|
7270
|
+
|
|
7271
|
+
>>> thread = api.validate_external_storage_root_path_post_with_http_info(validate_external_storage_root_request_dto, async_req=True)
|
|
7272
|
+
>>> result = thread.get()
|
|
7273
|
+
|
|
7274
|
+
:param validate_external_storage_root_request_dto: (required)
|
|
7275
|
+
:type validate_external_storage_root_request_dto: ValidateExternalStorageRootRequestDto
|
|
7276
|
+
:param async_req: Whether to execute the request asynchronously.
|
|
7277
|
+
:type async_req: bool, optional
|
|
7278
|
+
:param _preload_content: if False, the ApiResponse.data will
|
|
7279
|
+
be set to none and raw_data will store the
|
|
7280
|
+
HTTP response body without reading/decoding.
|
|
7281
|
+
Default is True.
|
|
7282
|
+
:type _preload_content: bool, optional
|
|
7283
|
+
:param _return_http_data_only: response data instead of ApiResponse
|
|
7284
|
+
object with status code, headers, etc
|
|
7285
|
+
:type _return_http_data_only: bool, optional
|
|
7286
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
7287
|
+
number provided, it will be total request
|
|
7288
|
+
timeout. It can also be a pair (tuple) of
|
|
7289
|
+
(connection, read) timeouts.
|
|
7290
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
7291
|
+
request; this effectively ignores the authentication
|
|
7292
|
+
in the spec for a single request.
|
|
7293
|
+
:type _request_auth: dict, optional
|
|
7294
|
+
:type _content_type: string, optional: force content-type for the request
|
|
7295
|
+
:return: Returns the result object.
|
|
7296
|
+
If the method is called asynchronously,
|
|
7297
|
+
returns the request thread.
|
|
7298
|
+
:rtype: tuple(ValidateExternalStorageRootResponseDto, status_code(int), headers(HTTPHeaderDict))
|
|
7299
|
+
"""
|
|
7300
|
+
|
|
7301
|
+
_params = locals()
|
|
7302
|
+
|
|
7303
|
+
_all_params = ["validate_external_storage_root_request_dto"]
|
|
7304
|
+
_all_params.extend(
|
|
7305
|
+
[
|
|
7306
|
+
"async_req",
|
|
7307
|
+
"_return_http_data_only",
|
|
7308
|
+
"_preload_content",
|
|
7309
|
+
"_request_timeout",
|
|
7310
|
+
"_request_auth",
|
|
7311
|
+
"_content_type",
|
|
7312
|
+
"_headers",
|
|
7313
|
+
]
|
|
7314
|
+
)
|
|
7315
|
+
|
|
7316
|
+
# validate the arguments
|
|
7317
|
+
for _key, _val in _params["kwargs"].items():
|
|
7318
|
+
if _key not in _all_params:
|
|
7319
|
+
raise ApiTypeError(
|
|
7320
|
+
"Got an unexpected keyword argument '%s'"
|
|
7321
|
+
" to method validate_external_storage_root_path_post" % _key
|
|
7322
|
+
)
|
|
7323
|
+
_params[_key] = _val
|
|
7324
|
+
del _params["kwargs"]
|
|
7325
|
+
|
|
7326
|
+
_collection_formats = {}
|
|
7327
|
+
|
|
7328
|
+
# process the path parameters
|
|
7329
|
+
_path_params = {}
|
|
7330
|
+
|
|
7331
|
+
# process the query parameters
|
|
7332
|
+
_query_params = []
|
|
7333
|
+
# process the header parameters
|
|
7334
|
+
_header_params = dict(_params.get("_headers", {}))
|
|
7335
|
+
# process the form parameters
|
|
7336
|
+
_form_params = []
|
|
7337
|
+
_files = {}
|
|
7338
|
+
# process the body parameter
|
|
7339
|
+
_body_params = None
|
|
7340
|
+
if _params["validate_external_storage_root_request_dto"] is not None:
|
|
7341
|
+
_body_params = _params["validate_external_storage_root_request_dto"]
|
|
7342
|
+
|
|
7343
|
+
# set the HTTP header `Accept`
|
|
7344
|
+
_header_params["Accept"] = self.api_client.select_header_accept(
|
|
7345
|
+
["application/json"]
|
|
7346
|
+
) # noqa: E501
|
|
7347
|
+
|
|
7348
|
+
# set the HTTP header `Content-Type`
|
|
7349
|
+
_content_types_list = _params.get(
|
|
7350
|
+
"_content_type",
|
|
7351
|
+
self.api_client.select_header_content_type(["application/json"]),
|
|
7352
|
+
)
|
|
7353
|
+
if _content_types_list:
|
|
7354
|
+
_header_params["Content-Type"] = _content_types_list
|
|
7355
|
+
|
|
7356
|
+
# authentication setting
|
|
7357
|
+
_auth_settings = ["HTTPBearer", "APIKeyCookie"] # noqa: E501
|
|
7358
|
+
|
|
7359
|
+
_response_types_map = {
|
|
7360
|
+
"200": "ValidateExternalStorageRootResponseDto",
|
|
7361
|
+
"422": "HTTPValidationError",
|
|
7362
|
+
}
|
|
7363
|
+
|
|
7364
|
+
return self.api_client.call_api(
|
|
7365
|
+
"/api/2.0/mlflow/mlfoundry-artifacts/artifact-versions/validate-storage-root",
|
|
7366
|
+
"POST",
|
|
7367
|
+
_path_params,
|
|
7368
|
+
_query_params,
|
|
7369
|
+
_header_params,
|
|
7370
|
+
body=_body_params,
|
|
7371
|
+
post_params=_form_params,
|
|
7372
|
+
files=_files,
|
|
7373
|
+
response_types_map=_response_types_map,
|
|
7374
|
+
auth_settings=_auth_settings,
|
|
7375
|
+
async_req=_params.get("async_req"),
|
|
7376
|
+
_return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501
|
|
7377
|
+
_preload_content=_params.get("_preload_content", True),
|
|
7378
|
+
_request_timeout=_params.get("_request_timeout"),
|
|
7379
|
+
collection_formats=_collection_formats,
|
|
7380
|
+
_request_auth=_params.get("_request_auth"),
|
|
7381
|
+
)
|
|
@@ -334,9 +334,6 @@ from truefoundry.ml.autogen.client.models.search_runs_request_dto import (
|
|
|
334
334
|
from truefoundry.ml.autogen.client.models.search_runs_response_dto import (
|
|
335
335
|
SearchRunsResponseDto,
|
|
336
336
|
)
|
|
337
|
-
from truefoundry.ml.autogen.client.models.serialization_format import (
|
|
338
|
-
SerializationFormat,
|
|
339
|
-
)
|
|
340
337
|
from truefoundry.ml.autogen.client.models.set_experiment_tag_request_dto import (
|
|
341
338
|
SetExperimentTagRequestDto,
|
|
342
339
|
)
|
|
@@ -344,6 +341,9 @@ from truefoundry.ml.autogen.client.models.set_tag_request_dto import SetTagReque
|
|
|
344
341
|
from truefoundry.ml.autogen.client.models.signed_url_dto import SignedURLDto
|
|
345
342
|
from truefoundry.ml.autogen.client.models.sklearn_framework import SklearnFramework
|
|
346
343
|
from truefoundry.ml.autogen.client.models.sklearn_model_schema import SklearnModelSchema
|
|
344
|
+
from truefoundry.ml.autogen.client.models.sklearn_serialization_format import (
|
|
345
|
+
SklearnSerializationFormat,
|
|
346
|
+
)
|
|
347
347
|
from truefoundry.ml.autogen.client.models.source import Source
|
|
348
348
|
from truefoundry.ml.autogen.client.models.source1 import Source1
|
|
349
349
|
from truefoundry.ml.autogen.client.models.spa_cy_framework import SpaCyFramework
|
|
@@ -394,6 +394,12 @@ from truefoundry.ml.autogen.client.models.update_run_response_dto import (
|
|
|
394
394
|
)
|
|
395
395
|
from truefoundry.ml.autogen.client.models.url import Url
|
|
396
396
|
from truefoundry.ml.autogen.client.models.user_message import UserMessage
|
|
397
|
+
from truefoundry.ml.autogen.client.models.validate_external_storage_root_request_dto import (
|
|
398
|
+
ValidateExternalStorageRootRequestDto,
|
|
399
|
+
)
|
|
400
|
+
from truefoundry.ml.autogen.client.models.validate_external_storage_root_response_dto import (
|
|
401
|
+
ValidateExternalStorageRootResponseDto,
|
|
402
|
+
)
|
|
397
403
|
from truefoundry.ml.autogen.client.models.validation_error import ValidationError
|
|
398
404
|
from truefoundry.ml.autogen.client.models.validation_error_loc_inner import (
|
|
399
405
|
ValidationErrorLocInner,
|
|
@@ -402,3 +408,6 @@ from truefoundry.ml.autogen.client.models.xg_boost_framework import XGBoostFrame
|
|
|
402
408
|
from truefoundry.ml.autogen.client.models.xg_boost_model_schema import (
|
|
403
409
|
XGBoostModelSchema,
|
|
404
410
|
)
|
|
411
|
+
from truefoundry.ml.autogen.client.models.xg_boost_serialization_format import (
|
|
412
|
+
XGBoostSerializationFormat,
|
|
413
|
+
)
|
|
@@ -18,10 +18,10 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
from typing import Optional
|
|
20
20
|
|
|
21
|
-
from truefoundry.ml.autogen.client.models.serialization_format import (
|
|
22
|
-
SerializationFormat,
|
|
23
|
-
)
|
|
24
21
|
from truefoundry.ml.autogen.client.models.sklearn_model_schema import SklearnModelSchema
|
|
22
|
+
from truefoundry.ml.autogen.client.models.sklearn_serialization_format import (
|
|
23
|
+
SklearnSerializationFormat,
|
|
24
|
+
)
|
|
25
25
|
from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, validator
|
|
26
26
|
|
|
27
27
|
|
|
@@ -38,10 +38,7 @@ class SklearnFramework(BaseModel):
|
|
|
38
38
|
default=None,
|
|
39
39
|
description="+label=Model file path +usage=Relative path to the model file",
|
|
40
40
|
)
|
|
41
|
-
serialization_format: Optional[
|
|
42
|
-
default=None,
|
|
43
|
-
description="+label=Serialization format +usage=Serialization format used for the model",
|
|
44
|
-
)
|
|
41
|
+
serialization_format: Optional[SklearnSerializationFormat] = None
|
|
45
42
|
model_schema: Optional[SklearnModelSchema] = None
|
|
46
43
|
__properties = ["type", "model_filepath", "serialization_format", "model_schema"]
|
|
47
44
|
|
truefoundry/ml/autogen/client/models/{serialization_format.py → sklearn_serialization_format.py}
RENAMED
|
@@ -17,9 +17,9 @@ import re # noqa: F401
|
|
|
17
17
|
from aenum import Enum
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
class
|
|
20
|
+
class SklearnSerializationFormat(str, Enum):
|
|
21
21
|
"""
|
|
22
|
-
+label=Serialization format +usage=Serialization format used for
|
|
22
|
+
+label=Serialization format +usage=Serialization format used for sklearn models
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
"""
|
|
@@ -30,6 +30,6 @@ class SerializationFormat(str, Enum):
|
|
|
30
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) -> SklearnSerializationFormat:
|
|
34
|
+
"""Create an instance of SklearnSerializationFormat from a JSON string"""
|
|
35
|
+
return SklearnSerializationFormat(json.loads(json_str))
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ValidateExternalStorageRootRequestDto(BaseModel):
|
|
24
|
+
"""
|
|
25
|
+
ValidateExternalStorageRootRequestDto
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
storage_root_uri: StrictStr = Field(...)
|
|
29
|
+
experiment_id: StrictStr = Field(...)
|
|
30
|
+
__properties = ["storage_root_uri", "experiment_id"]
|
|
31
|
+
|
|
32
|
+
class Config:
|
|
33
|
+
"""Pydantic configuration"""
|
|
34
|
+
|
|
35
|
+
allow_population_by_field_name = True
|
|
36
|
+
validate_assignment = True
|
|
37
|
+
|
|
38
|
+
def to_str(self) -> str:
|
|
39
|
+
"""Returns the string representation of the model using alias"""
|
|
40
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
41
|
+
|
|
42
|
+
def to_json(self) -> str:
|
|
43
|
+
"""Returns the JSON representation of the model using alias"""
|
|
44
|
+
return json.dumps(self.to_dict())
|
|
45
|
+
|
|
46
|
+
@classmethod
|
|
47
|
+
def from_json(cls, json_str: str) -> ValidateExternalStorageRootRequestDto:
|
|
48
|
+
"""Create an instance of ValidateExternalStorageRootRequestDto from a JSON string"""
|
|
49
|
+
return cls.from_dict(json.loads(json_str))
|
|
50
|
+
|
|
51
|
+
def to_dict(self):
|
|
52
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
53
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
54
|
+
return _dict
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_dict(cls, obj: dict) -> ValidateExternalStorageRootRequestDto:
|
|
58
|
+
"""Create an instance of ValidateExternalStorageRootRequestDto from a dict"""
|
|
59
|
+
if obj is None:
|
|
60
|
+
return None
|
|
61
|
+
|
|
62
|
+
if not isinstance(obj, dict):
|
|
63
|
+
return ValidateExternalStorageRootRequestDto.parse_obj(obj)
|
|
64
|
+
|
|
65
|
+
_obj = ValidateExternalStorageRootRequestDto.parse_obj(
|
|
66
|
+
{
|
|
67
|
+
"storage_root_uri": obj.get("storage_root_uri"),
|
|
68
|
+
"experiment_id": obj.get("experiment_id"),
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
return _obj
|
|
@@ -0,0 +1,69 @@
|
|
|
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 BaseModel, Field, StrictBool, StrictStr
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ValidateExternalStorageRootResponseDto(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
ValidateExternalStorageRootResponseDto
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
is_valid: StrictBool = Field(...)
|
|
30
|
+
message: Optional[StrictStr] = None
|
|
31
|
+
__properties = ["is_valid", "message"]
|
|
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) -> ValidateExternalStorageRootResponseDto:
|
|
49
|
+
"""Create an instance of ValidateExternalStorageRootResponseDto 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) -> ValidateExternalStorageRootResponseDto:
|
|
59
|
+
"""Create an instance of ValidateExternalStorageRootResponseDto from a dict"""
|
|
60
|
+
if obj is None:
|
|
61
|
+
return None
|
|
62
|
+
|
|
63
|
+
if not isinstance(obj, dict):
|
|
64
|
+
return ValidateExternalStorageRootResponseDto.parse_obj(obj)
|
|
65
|
+
|
|
66
|
+
_obj = ValidateExternalStorageRootResponseDto.parse_obj(
|
|
67
|
+
{"is_valid": obj.get("is_valid"), "message": obj.get("message")}
|
|
68
|
+
)
|
|
69
|
+
return _obj
|
|
@@ -18,12 +18,12 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
from typing import Optional
|
|
20
20
|
|
|
21
|
-
from truefoundry.ml.autogen.client.models.serialization_format import (
|
|
22
|
-
SerializationFormat,
|
|
23
|
-
)
|
|
24
21
|
from truefoundry.ml.autogen.client.models.xg_boost_model_schema import (
|
|
25
22
|
XGBoostModelSchema,
|
|
26
23
|
)
|
|
24
|
+
from truefoundry.ml.autogen.client.models.xg_boost_serialization_format import (
|
|
25
|
+
XGBoostSerializationFormat,
|
|
26
|
+
)
|
|
27
27
|
from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, validator
|
|
28
28
|
|
|
29
29
|
|
|
@@ -36,10 +36,7 @@ class XGBoostFramework(BaseModel):
|
|
|
36
36
|
default=...,
|
|
37
37
|
description="+label=Type +usage=Type of the framework +value=xgboost",
|
|
38
38
|
)
|
|
39
|
-
serialization_format: Optional[
|
|
40
|
-
default=None,
|
|
41
|
-
description="+label=Serialization format +usage=Serialization format used for the model",
|
|
42
|
-
)
|
|
39
|
+
serialization_format: Optional[XGBoostSerializationFormat] = None
|
|
43
40
|
model_filepath: Optional[StrictStr] = Field(
|
|
44
41
|
default=None,
|
|
45
42
|
description="+label=Model file path +usage=Relative path to the model file",
|
|
@@ -18,16 +18,15 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
from typing import Any, Dict
|
|
20
20
|
|
|
21
|
-
from truefoundry.
|
|
22
|
-
from truefoundry.pydantic_v1 import BaseModel, Field, conlist
|
|
21
|
+
from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, conlist, validator
|
|
23
22
|
|
|
24
23
|
|
|
25
24
|
class XGBoostModelSchema(BaseModel):
|
|
26
25
|
"""
|
|
27
|
-
|
|
26
|
+
+label=XGBoost Model Schema # noqa: E501
|
|
28
27
|
"""
|
|
29
28
|
|
|
30
|
-
infer_method_name:
|
|
29
|
+
infer_method_name: StrictStr = Field(
|
|
31
30
|
default=...,
|
|
32
31
|
description="+label=Inference Method Name +usage=Name of the method used for inference",
|
|
33
32
|
)
|
|
@@ -39,6 +38,13 @@ class XGBoostModelSchema(BaseModel):
|
|
|
39
38
|
)
|
|
40
39
|
__properties = ["infer_method_name", "inputs", "outputs"]
|
|
41
40
|
|
|
41
|
+
@validator("infer_method_name")
|
|
42
|
+
def infer_method_name_validate_enum(cls, value):
|
|
43
|
+
"""Validates the enum"""
|
|
44
|
+
if value not in ("predict",):
|
|
45
|
+
raise ValueError("must be one of enum values ('predict')")
|
|
46
|
+
return value
|
|
47
|
+
|
|
42
48
|
class Config:
|
|
43
49
|
"""Pydantic configuration"""
|
|
44
50
|
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
import json
|
|
15
|
+
import re # noqa: F401
|
|
16
|
+
|
|
17
|
+
from aenum import Enum
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class XGBoostSerializationFormat(str, Enum):
|
|
21
|
+
"""
|
|
22
|
+
+label=Serialization format +usage=Serialization format used for XGBoost models
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
"""
|
|
26
|
+
allowed enum values
|
|
27
|
+
"""
|
|
28
|
+
CLOUDPICKLE = "cloudpickle"
|
|
29
|
+
JOBLIB = "joblib"
|
|
30
|
+
PICKLE = "pickle"
|
|
31
|
+
JSON = "json"
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
def from_json(cls, json_str: str) -> XGBoostSerializationFormat:
|
|
35
|
+
"""Create an instance of XGBoostSerializationFormat from a JSON string"""
|
|
36
|
+
return XGBoostSerializationFormat(json.loads(json_str))
|
|
@@ -133,6 +133,7 @@ Class | Method | HTTP request | Description
|
|
|
133
133
|
*MlfoundryArtifactsApi* | [**update_artifact_version_post**](truefoundry/ml/autogen/client/docs/MlfoundryArtifactsApi.md#update_artifact_version_post) | **POST** /api/2.0/mlflow/mlfoundry-artifacts/artifact-versions/update | Update Artifact Version
|
|
134
134
|
*MlfoundryArtifactsApi* | [**update_dataset_post**](truefoundry/ml/autogen/client/docs/MlfoundryArtifactsApi.md#update_dataset_post) | **POST** /api/2.0/mlflow/mlfoundry-artifacts/datasets/update | Update Dataset
|
|
135
135
|
*MlfoundryArtifactsApi* | [**update_model_version_post**](truefoundry/ml/autogen/client/docs/MlfoundryArtifactsApi.md#update_model_version_post) | **POST** /api/2.0/mlflow/mlfoundry-artifacts/model-versions/update | Update Model Version
|
|
136
|
+
*MlfoundryArtifactsApi* | [**validate_external_storage_root_path_post**](truefoundry/ml/autogen/client/docs/MlfoundryArtifactsApi.md#validate_external_storage_root_path_post) | **POST** /api/2.0/mlflow/mlfoundry-artifacts/artifact-versions/validate-storage-root | Validate External Storage Root Path
|
|
136
137
|
*RunArtifactsApi* | [**list_run_artifacts_get**](truefoundry/ml/autogen/client/docs/RunArtifactsApi.md#list_run_artifacts_get) | **GET** /api/2.0/mlflow/artifacts/list | List Run Artifacts
|
|
137
138
|
*RunsApi* | [**create_run_post**](truefoundry/ml/autogen/client/docs/RunsApi.md#create_run_post) | **POST** /api/2.0/mlflow/runs/create | Create Run
|
|
138
139
|
*RunsApi* | [**delete_run_post**](truefoundry/ml/autogen/client/docs/RunsApi.md#delete_run_post) | **POST** /api/2.0/mlflow/runs/delete | Delete Run
|
|
@@ -299,12 +300,12 @@ Class | Method | HTTP request | Description
|
|
|
299
300
|
- [RunTagDto](truefoundry/ml/autogen/client/docs/RunTagDto.md)
|
|
300
301
|
- [SearchRunsRequestDto](truefoundry/ml/autogen/client/docs/SearchRunsRequestDto.md)
|
|
301
302
|
- [SearchRunsResponseDto](truefoundry/ml/autogen/client/docs/SearchRunsResponseDto.md)
|
|
302
|
-
- [SerializationFormat](truefoundry/ml/autogen/client/docs/SerializationFormat.md)
|
|
303
303
|
- [SetExperimentTagRequestDto](truefoundry/ml/autogen/client/docs/SetExperimentTagRequestDto.md)
|
|
304
304
|
- [SetTagRequestDto](truefoundry/ml/autogen/client/docs/SetTagRequestDto.md)
|
|
305
305
|
- [SignedURLDto](truefoundry/ml/autogen/client/docs/SignedURLDto.md)
|
|
306
306
|
- [SklearnFramework](truefoundry/ml/autogen/client/docs/SklearnFramework.md)
|
|
307
307
|
- [SklearnModelSchema](truefoundry/ml/autogen/client/docs/SklearnModelSchema.md)
|
|
308
|
+
- [SklearnSerializationFormat](truefoundry/ml/autogen/client/docs/SklearnSerializationFormat.md)
|
|
308
309
|
- [Source](truefoundry/ml/autogen/client/docs/Source.md)
|
|
309
310
|
- [Source1](truefoundry/ml/autogen/client/docs/Source1.md)
|
|
310
311
|
- [SpaCyFramework](truefoundry/ml/autogen/client/docs/SpaCyFramework.md)
|
|
@@ -329,10 +330,13 @@ Class | Method | HTTP request | Description
|
|
|
329
330
|
- [UpdateRunResponseDto](truefoundry/ml/autogen/client/docs/UpdateRunResponseDto.md)
|
|
330
331
|
- [Url](truefoundry/ml/autogen/client/docs/Url.md)
|
|
331
332
|
- [UserMessage](truefoundry/ml/autogen/client/docs/UserMessage.md)
|
|
333
|
+
- [ValidateExternalStorageRootRequestDto](truefoundry/ml/autogen/client/docs/ValidateExternalStorageRootRequestDto.md)
|
|
334
|
+
- [ValidateExternalStorageRootResponseDto](truefoundry/ml/autogen/client/docs/ValidateExternalStorageRootResponseDto.md)
|
|
332
335
|
- [ValidationError](truefoundry/ml/autogen/client/docs/ValidationError.md)
|
|
333
336
|
- [ValidationErrorLocInner](truefoundry/ml/autogen/client/docs/ValidationErrorLocInner.md)
|
|
334
337
|
- [XGBoostFramework](truefoundry/ml/autogen/client/docs/XGBoostFramework.md)
|
|
335
338
|
- [XGBoostModelSchema](truefoundry/ml/autogen/client/docs/XGBoostModelSchema.md)
|
|
339
|
+
- [XGBoostSerializationFormat](truefoundry/ml/autogen/client/docs/XGBoostSerializationFormat.md)
|
|
336
340
|
|
|
337
341
|
|
|
338
342
|
<a id="documentation-for-authorization"></a>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# generated by datamodel-codegen:
|
|
2
2
|
# filename: artifacts.json
|
|
3
|
-
# timestamp: 2024-12-
|
|
3
|
+
# timestamp: 2024-12-09T09:04:12+00:00
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
@@ -60,19 +60,6 @@ class BaseArtifactVersion(BaseModel):
|
|
|
60
60
|
)
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
class BaseModelSchema(BaseModel):
|
|
64
|
-
infer_method_name: str = Field(
|
|
65
|
-
...,
|
|
66
|
-
description="+label=Inference Method Name\n+usage=Name of the method used for inference",
|
|
67
|
-
)
|
|
68
|
-
inputs: List[Dict[str, Any]] = Field(
|
|
69
|
-
..., description="+label= Input Schema\n+usage=Schema of the input"
|
|
70
|
-
)
|
|
71
|
-
outputs: List[Dict[str, Any]] = Field(
|
|
72
|
-
..., description="+label= Output Schema\n+usage=Schema of the output"
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
|
|
76
63
|
class MimeType(str, Enum):
|
|
77
64
|
"""
|
|
78
65
|
+label=MIME Type
|
|
@@ -289,17 +276,6 @@ class PyTorchFramework(BaseModel):
|
|
|
289
276
|
)
|
|
290
277
|
|
|
291
278
|
|
|
292
|
-
class SerializationFormat(str, Enum):
|
|
293
|
-
"""
|
|
294
|
-
+label=Serialization format
|
|
295
|
-
+usage=Serialization format used for the model
|
|
296
|
-
"""
|
|
297
|
-
|
|
298
|
-
cloudpickle = "cloudpickle"
|
|
299
|
-
joblib = "joblib"
|
|
300
|
-
pickle = "pickle"
|
|
301
|
-
|
|
302
|
-
|
|
303
279
|
class InferMethodName(str, Enum):
|
|
304
280
|
"""
|
|
305
281
|
+label=Inference Method Name
|
|
@@ -310,11 +286,32 @@ class InferMethodName(str, Enum):
|
|
|
310
286
|
predict_proba = "predict_proba"
|
|
311
287
|
|
|
312
288
|
|
|
313
|
-
class SklearnModelSchema(
|
|
289
|
+
class SklearnModelSchema(BaseModel):
|
|
290
|
+
"""
|
|
291
|
+
+label=Sklearn Model Schema
|
|
292
|
+
"""
|
|
293
|
+
|
|
314
294
|
infer_method_name: InferMethodName = Field(
|
|
315
295
|
...,
|
|
316
296
|
description="+label=Inference Method Name\n+usage=Name of the method used for inference",
|
|
317
297
|
)
|
|
298
|
+
inputs: List[Dict[str, Any]] = Field(
|
|
299
|
+
..., description="+label= Input Schema\n+usage=Schema of the input"
|
|
300
|
+
)
|
|
301
|
+
outputs: List[Dict[str, Any]] = Field(
|
|
302
|
+
..., description="+label= Output Schema\n+usage=Schema of the output"
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
class SklearnSerializationFormat(str, Enum):
|
|
307
|
+
"""
|
|
308
|
+
+label=Serialization format
|
|
309
|
+
+usage=Serialization format used for sklearn models
|
|
310
|
+
"""
|
|
311
|
+
|
|
312
|
+
cloudpickle = "cloudpickle"
|
|
313
|
+
joblib = "joblib"
|
|
314
|
+
pickle = "pickle"
|
|
318
315
|
|
|
319
316
|
|
|
320
317
|
class SpaCyFramework(BaseModel):
|
|
@@ -448,11 +445,33 @@ class UserMessage(BaseModel):
|
|
|
448
445
|
)
|
|
449
446
|
|
|
450
447
|
|
|
451
|
-
class XGBoostModelSchema(
|
|
452
|
-
|
|
448
|
+
class XGBoostModelSchema(BaseModel):
|
|
449
|
+
"""
|
|
450
|
+
+label=XGBoost Model Schema
|
|
451
|
+
"""
|
|
452
|
+
|
|
453
|
+
infer_method_name: Literal["predict"] = Field(
|
|
453
454
|
...,
|
|
454
455
|
description="+label=Inference Method Name\n+usage=Name of the method used for inference",
|
|
455
456
|
)
|
|
457
|
+
inputs: List[Dict[str, Any]] = Field(
|
|
458
|
+
..., description="+label= Input Schema\n+usage=Schema of the input"
|
|
459
|
+
)
|
|
460
|
+
outputs: List[Dict[str, Any]] = Field(
|
|
461
|
+
..., description="+label= Output Schema\n+usage=Schema of the output"
|
|
462
|
+
)
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
class XGBoostSerializationFormat(str, Enum):
|
|
466
|
+
"""
|
|
467
|
+
+label=Serialization format
|
|
468
|
+
+usage=Serialization format used for XGBoost models
|
|
469
|
+
"""
|
|
470
|
+
|
|
471
|
+
cloudpickle = "cloudpickle"
|
|
472
|
+
joblib = "joblib"
|
|
473
|
+
pickle = "pickle"
|
|
474
|
+
json = "json"
|
|
456
475
|
|
|
457
476
|
|
|
458
477
|
class AgentOpenAPITool(BaseModel):
|
|
@@ -561,10 +580,7 @@ class SklearnFramework(BaseModel):
|
|
|
561
580
|
None,
|
|
562
581
|
description="+label=Model file path\n+usage=Relative path to the model file",
|
|
563
582
|
)
|
|
564
|
-
serialization_format: Optional[
|
|
565
|
-
None,
|
|
566
|
-
description="+label=Serialization format\n+usage=Serialization format used for the model",
|
|
567
|
-
)
|
|
583
|
+
serialization_format: Optional[SklearnSerializationFormat] = None
|
|
568
584
|
model_schema: Optional[SklearnModelSchema] = None
|
|
569
585
|
|
|
570
586
|
|
|
@@ -577,10 +593,7 @@ class XGBoostFramework(BaseModel):
|
|
|
577
593
|
type: Literal["xgboost"] = Field(
|
|
578
594
|
..., description="+label=Type\n+usage=Type of the framework\n+value=xgboost"
|
|
579
595
|
)
|
|
580
|
-
serialization_format: Optional[
|
|
581
|
-
None,
|
|
582
|
-
description="+label=Serialization format\n+usage=Serialization format used for the model",
|
|
583
|
-
)
|
|
596
|
+
serialization_format: Optional[XGBoostSerializationFormat] = None
|
|
584
597
|
model_filepath: Optional[str] = Field(
|
|
585
598
|
None,
|
|
586
599
|
description="+label=Model file path\n+usage=Relative path to the model file",
|
|
@@ -20,7 +20,10 @@ from truefoundry.common.utils import (
|
|
|
20
20
|
get_python_version_major_minor,
|
|
21
21
|
list_pip_packages_installed,
|
|
22
22
|
)
|
|
23
|
-
from truefoundry.ml.autogen.client import
|
|
23
|
+
from truefoundry.ml.autogen.client import (
|
|
24
|
+
SklearnSerializationFormat,
|
|
25
|
+
XGBoostSerializationFormat,
|
|
26
|
+
)
|
|
24
27
|
from truefoundry.ml.autogen.entities import artifacts as autogen_artifacts
|
|
25
28
|
from truefoundry.ml.autogen.models import infer_signature
|
|
26
29
|
from truefoundry.ml.enums import ModelFramework
|
|
@@ -35,46 +38,13 @@ if TYPE_CHECKING:
|
|
|
35
38
|
|
|
36
39
|
# Map serialization format to corresponding pip packages
|
|
37
40
|
SERIALIZATION_FORMAT_TO_PACKAGES_NAME_MAP = {
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
SklearnSerializationFormat.JOBLIB: ["joblib"],
|
|
42
|
+
SklearnSerializationFormat.CLOUDPICKLE: ["cloudpickle"],
|
|
43
|
+
XGBoostSerializationFormat.JOBLIB: ["joblib"],
|
|
44
|
+
XGBoostSerializationFormat.CLOUDPICKLE: ["cloudpickle"],
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
|
|
43
|
-
class _SerializationFormatLoaderRegistry:
|
|
44
|
-
def __init__(self):
|
|
45
|
-
# An OrderedDict is used to maintain the order of loaders based on priority
|
|
46
|
-
# The loaders are added in the following order:
|
|
47
|
-
# 1. joblib (if available)
|
|
48
|
-
# 2. cloudpickle (if available)
|
|
49
|
-
# 3. pickle (default fallback)
|
|
50
|
-
# This ensures that when looking up a loader, it follows the correct loading priority.
|
|
51
|
-
self._loader_map: Dict[SerializationFormat, Callable[[bytes], object]] = (
|
|
52
|
-
OrderedDict()
|
|
53
|
-
)
|
|
54
|
-
try:
|
|
55
|
-
from joblib import load as joblib_load
|
|
56
|
-
|
|
57
|
-
self._loader_map[SerializationFormat.JOBLIB] = joblib_load
|
|
58
|
-
except ImportError:
|
|
59
|
-
pass
|
|
60
|
-
|
|
61
|
-
try:
|
|
62
|
-
from cloudpickle import load as cloudpickle_load
|
|
63
|
-
|
|
64
|
-
self._loader_map[SerializationFormat.CLOUDPICKLE] = cloudpickle_load
|
|
65
|
-
except ImportError:
|
|
66
|
-
pass
|
|
67
|
-
|
|
68
|
-
# Add pickle loader as a fallback
|
|
69
|
-
self._loader_map[SerializationFormat.PICKLE] = pickle_load
|
|
70
|
-
|
|
71
|
-
def get_loader_map(self) -> Dict[SerializationFormat, Callable[[bytes], object]]:
|
|
72
|
-
return self._loader_map
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
_serialization_format_loader_registry = _SerializationFormatLoaderRegistry()
|
|
76
|
-
|
|
77
|
-
|
|
78
48
|
class FastAIFramework(autogen_artifacts.FastAIFramework):
|
|
79
49
|
"""FastAI model Framework"""
|
|
80
50
|
|
|
@@ -180,6 +150,87 @@ ModelFrameworkType = Union[
|
|
|
180
150
|
]
|
|
181
151
|
|
|
182
152
|
|
|
153
|
+
class _SerializationFormatLoaderRegistry:
|
|
154
|
+
def __init__(self, framework: Type[Union[SklearnFramework, XGBoostFramework]]):
|
|
155
|
+
# An OrderedDict is used to maintain the order of loaders based on priority
|
|
156
|
+
# The loaders are added in the following order:
|
|
157
|
+
# 1. joblib (if available)
|
|
158
|
+
# 2. cloudpickle (if available)
|
|
159
|
+
# 3. pickle (default fallback)
|
|
160
|
+
# This ensures that when looking up a loader, it follows the correct loading priority.
|
|
161
|
+
self._loader_map: Dict[
|
|
162
|
+
Union[SklearnSerializationFormat, XGBoostSerializationFormat],
|
|
163
|
+
Callable[[bytes], object],
|
|
164
|
+
] = OrderedDict()
|
|
165
|
+
format_class: Union[SklearnSerializationFormat, XGBoostSerializationFormat] = (
|
|
166
|
+
SklearnSerializationFormat
|
|
167
|
+
if framework == SklearnFramework
|
|
168
|
+
else XGBoostSerializationFormat
|
|
169
|
+
)
|
|
170
|
+
is_xgboost = framework == XGBoostFramework
|
|
171
|
+
|
|
172
|
+
try:
|
|
173
|
+
from joblib import load as joblib_load
|
|
174
|
+
|
|
175
|
+
self._loader_map[format_class.JOBLIB] = joblib_load
|
|
176
|
+
except ImportError:
|
|
177
|
+
pass
|
|
178
|
+
|
|
179
|
+
try:
|
|
180
|
+
from cloudpickle import load as cloudpickle_load
|
|
181
|
+
|
|
182
|
+
self._loader_map[format_class.CLOUDPICKLE] = cloudpickle_load
|
|
183
|
+
|
|
184
|
+
except ImportError:
|
|
185
|
+
pass
|
|
186
|
+
|
|
187
|
+
if is_xgboost:
|
|
188
|
+
try:
|
|
189
|
+
from xgboost import Booster
|
|
190
|
+
|
|
191
|
+
booster = Booster()
|
|
192
|
+
self._loader_map[format_class.JSON] = booster.load_model
|
|
193
|
+
except ImportError:
|
|
194
|
+
pass
|
|
195
|
+
|
|
196
|
+
# Add pickle loader as a fallback
|
|
197
|
+
self._loader_map[format_class.PICKLE] = pickle_load
|
|
198
|
+
|
|
199
|
+
def get_loader_map(
|
|
200
|
+
self,
|
|
201
|
+
) -> Dict[
|
|
202
|
+
Union[SklearnSerializationFormat, XGBoostSerializationFormat],
|
|
203
|
+
Callable[[bytes], object],
|
|
204
|
+
]:
|
|
205
|
+
return self._loader_map
|
|
206
|
+
|
|
207
|
+
def _detect_model_serialization_format(
|
|
208
|
+
self,
|
|
209
|
+
model_file_path: str,
|
|
210
|
+
) -> Optional[Union[SklearnSerializationFormat, XGBoostSerializationFormat]]:
|
|
211
|
+
"""
|
|
212
|
+
The function will attempt to load the model using each different serialization format's loader and return the first successful one.
|
|
213
|
+
|
|
214
|
+
Args:
|
|
215
|
+
model_file_path (str): The path to the file to be loaded.
|
|
216
|
+
|
|
217
|
+
Returns:
|
|
218
|
+
Optional[Union[SklearnSerializationFormat, XGBoostSerializationFormat]]: The serialization format if successfully loaded, None otherwise.
|
|
219
|
+
"""
|
|
220
|
+
# Attempt to load the model using each framework
|
|
221
|
+
for (
|
|
222
|
+
serialization_format,
|
|
223
|
+
loader,
|
|
224
|
+
) in self._loader_map.items():
|
|
225
|
+
try:
|
|
226
|
+
with open(model_file_path, "rb") as f:
|
|
227
|
+
loader(f)
|
|
228
|
+
return serialization_format
|
|
229
|
+
except Exception:
|
|
230
|
+
continue
|
|
231
|
+
return None
|
|
232
|
+
|
|
233
|
+
|
|
183
234
|
class _ModelFramework(BaseModel):
|
|
184
235
|
__root__: ModelFrameworkType = Field(discriminator="type")
|
|
185
236
|
|
|
@@ -259,32 +310,6 @@ def _get_required_framework_pip_packages(framework: "ModelFrameworkType") -> Lis
|
|
|
259
310
|
return _MODEL_FRAMEWORK_TO_PIP_PACKAGES.get(framework.__class__, [])
|
|
260
311
|
|
|
261
312
|
|
|
262
|
-
def _detect_model_serialization_format(
|
|
263
|
-
model_file_path: str,
|
|
264
|
-
) -> Optional[SerializationFormat]:
|
|
265
|
-
"""
|
|
266
|
-
The function will attempt to load the model using each framework's loader and return the first successful one.
|
|
267
|
-
|
|
268
|
-
Args:
|
|
269
|
-
model_file_path (str): The path to the file to be loaded.
|
|
270
|
-
|
|
271
|
-
Returns:
|
|
272
|
-
Optional[SerializationFormat]: The serialization format if successfully loaded, None otherwise.
|
|
273
|
-
"""
|
|
274
|
-
# Attempt to load the model using each framework
|
|
275
|
-
for (
|
|
276
|
-
serialization_format,
|
|
277
|
-
loader,
|
|
278
|
-
) in _serialization_format_loader_registry.get_loader_map().items():
|
|
279
|
-
try:
|
|
280
|
-
with open(model_file_path, "rb") as f:
|
|
281
|
-
loader(f)
|
|
282
|
-
return serialization_format
|
|
283
|
-
except Exception:
|
|
284
|
-
continue
|
|
285
|
-
return None
|
|
286
|
-
|
|
287
|
-
|
|
288
313
|
def _fetch_framework_specific_pip_packages(
|
|
289
314
|
framework: "ModelFrameworkType",
|
|
290
315
|
) -> List[str]:
|
|
@@ -431,12 +456,15 @@ def auto_update_model_framework_details(
|
|
|
431
456
|
if os.path.isfile(model_file_or_folder)
|
|
432
457
|
else os.path.join(model_file_or_folder, framework.model_filepath)
|
|
433
458
|
)
|
|
434
|
-
framework.serialization_format
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
459
|
+
if not framework.serialization_format:
|
|
460
|
+
loader_registry = _SerializationFormatLoaderRegistry(
|
|
461
|
+
framework=framework
|
|
462
|
+
)
|
|
463
|
+
framework.serialization_format = (
|
|
464
|
+
loader_registry._detect_model_serialization_format(
|
|
465
|
+
model_file_path=absolute_model_filepath
|
|
466
|
+
)
|
|
438
467
|
)
|
|
439
|
-
)
|
|
440
468
|
|
|
441
469
|
|
|
442
470
|
def sklearn_infer_schema(
|
|
@@ -111,7 +111,7 @@ truefoundry/ml/__init__.py,sha256=VtP0B3DNFFV_1b4WHkAo_XRMvWHmyeEwDu984t4cy8s,20
|
|
|
111
111
|
truefoundry/ml/artifact/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
112
112
|
truefoundry/ml/artifact/truefoundry_artifact_repo.py,sha256=FksxhUpRHb9pgWZmAB16DhXqkAL6UIAPA1S3RJUApQU,46201
|
|
113
113
|
truefoundry/ml/autogen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
114
|
-
truefoundry/ml/autogen/client/__init__.py,sha256=
|
|
114
|
+
truefoundry/ml/autogen/client/__init__.py,sha256=Da3NzHW9aCi9zjQZteTm1aPTuyHDVqrFDtzwsdqIPbc,19981
|
|
115
115
|
truefoundry/ml/autogen/client/api/__init__.py,sha256=NyMBxBmIzB1o5LzZZwz9LiydHB3-hPqc_sevsnY6Jrw,746
|
|
116
116
|
truefoundry/ml/autogen/client/api/auth_api.py,sha256=zpWzJhUmW6HHMY_atlUf0B25k77E1kue2hmix5I5Ih0,7017
|
|
117
117
|
truefoundry/ml/autogen/client/api/deprecated_api.py,sha256=mu5x_skNcwz8v1Tr6VP72-tVP7pmBV9muyKy_2NH3F0,38824
|
|
@@ -119,14 +119,14 @@ truefoundry/ml/autogen/client/api/experiments_api.py,sha256=mRKS8qGzcFJUpTWjfQoF
|
|
|
119
119
|
truefoundry/ml/autogen/client/api/generate_code_snippet_api.py,sha256=C8iABP-pYIyIoTlL8PFi3ZBG_6B_dkQf09eErNeoj7A,22316
|
|
120
120
|
truefoundry/ml/autogen/client/api/health_api.py,sha256=IAPhRAo9CLUT5ipVR1fCf-qDx57UR0wg5ekhtUl8lug,11554
|
|
121
121
|
truefoundry/ml/autogen/client/api/metrics_api.py,sha256=q3L38eD-2hu4_9YvcSdnWDYXD2V8il-X9reinOAABek,14908
|
|
122
|
-
truefoundry/ml/autogen/client/api/mlfoundry_artifacts_api.py,sha256=
|
|
122
|
+
truefoundry/ml/autogen/client/api/mlfoundry_artifacts_api.py,sha256=5FSOinHzGTbNh-F6KdpxFlVwPrtKVKn4jzr4Dwp9bpw,313554
|
|
123
123
|
truefoundry/ml/autogen/client/api/run_artifacts_api.py,sha256=x-vVnY2LEFChZxiiFauswRWwFz6Qqh30PKXjzuTvxmc,8799
|
|
124
124
|
truefoundry/ml/autogen/client/api/runs_api.py,sha256=-aghrZ2VYuZOw_vBtOzWDsnK7Ji29oZQxK2CLRgyo2w,119232
|
|
125
125
|
truefoundry/ml/autogen/client/api_client.py,sha256=M31IycWorn10FYS8WbO_Whaipr0tVu2pVWFCfbS7XCo,29167
|
|
126
126
|
truefoundry/ml/autogen/client/api_response.py,sha256=KRyvecPMXF05PaxILHZ8JHoP4rgKBjKONMgG83aU-rM,844
|
|
127
127
|
truefoundry/ml/autogen/client/configuration.py,sha256=V1oaEnxt-NfpaNmp-EZpf2glovzVhM2coWYt8HBNB4M,15723
|
|
128
128
|
truefoundry/ml/autogen/client/exceptions.py,sha256=XbCbDHhYT3BVejdoGNPgEa4oS56ypkwFdxk1iOc_tFY,5355
|
|
129
|
-
truefoundry/ml/autogen/client/models/__init__.py,sha256=
|
|
129
|
+
truefoundry/ml/autogen/client/models/__init__.py,sha256=4mkEcTiiMIGu16f2idqmFFaeT3T7E1qDIorrhhXReEk,18603
|
|
130
130
|
truefoundry/ml/autogen/client/models/add_custom_metrics_to_model_version_request_dto.py,sha256=_ISDspicTGjBCYYXubKfRYYSSQVyW3AvG-jFh47-Zfc,2163
|
|
131
131
|
truefoundry/ml/autogen/client/models/add_features_to_model_version_request_dto.py,sha256=OT1-98DyWNfAHz_EgD2gMX2XkrGQ4Re945fhoAl8qSE,2099
|
|
132
132
|
truefoundry/ml/autogen/client/models/agent.py,sha256=lUAbs092yo9hZmqzX6atKebDNf1uEwTf5jLvjOdvoeM,3872
|
|
@@ -270,12 +270,12 @@ truefoundry/ml/autogen/client/models/run_response_dto.py,sha256=iayBnhwmByVC3iiw
|
|
|
270
270
|
truefoundry/ml/autogen/client/models/run_tag_dto.py,sha256=CdWwi9P-CXk1vvXWRHN2tHqRckgH-Igur1fowsS-I80,1795
|
|
271
271
|
truefoundry/ml/autogen/client/models/search_runs_request_dto.py,sha256=TxUqdYG5aKj6qdqsqNDe_ih45o0cMw3jwGu2Hrv1X48,2852
|
|
272
272
|
truefoundry/ml/autogen/client/models/search_runs_response_dto.py,sha256=u0l11v7p7zdxtaqV_RBoMtB2Zy8pJbvtMwZiL4B4qMg,2636
|
|
273
|
-
truefoundry/ml/autogen/client/models/serialization_format.py,sha256=CYq9DR1yipEGBA00XjBWyeJf_PIT8_l_F1tm6QafgRM,821
|
|
274
273
|
truefoundry/ml/autogen/client/models/set_experiment_tag_request_dto.py,sha256=nrmi_NxLD1fI2gwlpdqFSMnBS11gRkjS4_GQFHgBcXs,2118
|
|
275
274
|
truefoundry/ml/autogen/client/models/set_tag_request_dto.py,sha256=IRgAdMcWBxmjNV6nZJej4pcNfLmZwrelEZ3otwt7eeE,2144
|
|
276
275
|
truefoundry/ml/autogen/client/models/signed_url_dto.py,sha256=9oHoXBj07xTdc04rqOqJO3eOjQWXCyWPhfHg-6qX60w,1897
|
|
277
|
-
truefoundry/ml/autogen/client/models/sklearn_framework.py,sha256=
|
|
278
|
-
truefoundry/ml/autogen/client/models/sklearn_model_schema.py,sha256=
|
|
276
|
+
truefoundry/ml/autogen/client/models/sklearn_framework.py,sha256=1-NDqQL31S6O2qYm_EUTxQT2KFF1XCborUuTMGkGZjE,3318
|
|
277
|
+
truefoundry/ml/autogen/client/models/sklearn_model_schema.py,sha256=ZSmwGRw0R-4iAFUiYjhGNqq8hL_WzHX8rJU_cTXoko4,2549
|
|
278
|
+
truefoundry/ml/autogen/client/models/sklearn_serialization_format.py,sha256=jdJg9MPqVGGDDOn4X7KqxepfGQfGmxpn6SFdcKPjxZo,854
|
|
279
279
|
truefoundry/ml/autogen/client/models/source.py,sha256=ZG2-3oIs_M8mZNPjoIRPzhHqlm63vLCVQC9idUxQ0XU,5180
|
|
280
280
|
truefoundry/ml/autogen/client/models/source1.py,sha256=io35b9uVzqSvOHw6RlCXxM30thN-vHm1upaSiN2i0II,5183
|
|
281
281
|
truefoundry/ml/autogen/client/models/spa_cy_framework.py,sha256=Kyrvhdalnl1uQLoPMGMry2PuFGCcQ8AGp4Cx4B9AGXQ,2150
|
|
@@ -300,13 +300,16 @@ truefoundry/ml/autogen/client/models/update_run_request_dto.py,sha256=fn4VB4Zlll
|
|
|
300
300
|
truefoundry/ml/autogen/client/models/update_run_response_dto.py,sha256=wolIFiihGZCBBkuj7mJEYCmGAOqDLFo_bNLcH4LeXSo,2231
|
|
301
301
|
truefoundry/ml/autogen/client/models/url.py,sha256=zMyOmdVkp1ANnQnc9GrHt42xlVwES7FTjrpOp_OtHqo,4953
|
|
302
302
|
truefoundry/ml/autogen/client/models/user_message.py,sha256=3TEM8qH_zT3dgM197bl44uV7m20IWn6sWeLGfStsN90,2784
|
|
303
|
+
truefoundry/ml/autogen/client/models/validate_external_storage_root_request_dto.py,sha256=vIvIIabschL01XXA1WH33Nx8GTMGC0SJzIEq5HXIKN4,2172
|
|
304
|
+
truefoundry/ml/autogen/client/models/validate_external_storage_root_response_dto.py,sha256=ulOfhhYtuxPoBxTusCcwbu668gW1hew4vq7dGk0itKc,2122
|
|
303
305
|
truefoundry/ml/autogen/client/models/validation_error.py,sha256=mFjwoc8g2-Usu1HXZhOQKQ4TGvLy4lwCzk8dHrJ69aA,2597
|
|
304
306
|
truefoundry/ml/autogen/client/models/validation_error_loc_inner.py,sha256=nThJ5Gmy8W2Wok-ZOI4sK7uRe1BAkLS0qzq-XZbq8zs,4915
|
|
305
|
-
truefoundry/ml/autogen/client/models/xg_boost_framework.py,sha256=
|
|
306
|
-
truefoundry/ml/autogen/client/models/xg_boost_model_schema.py,sha256=
|
|
307
|
+
truefoundry/ml/autogen/client/models/xg_boost_framework.py,sha256=a0EHzncxe_hSFUCAk3nFOMuh8ztQQQBLbTfg0IbwTE8,3324
|
|
308
|
+
truefoundry/ml/autogen/client/models/xg_boost_model_schema.py,sha256=QKJkiERNqF8UiolX2FjvhkUkUlUgDoo3CpTYPAdCxV8,2735
|
|
309
|
+
truefoundry/ml/autogen/client/models/xg_boost_serialization_format.py,sha256=wFFSH0Z9MP8eT_fysHfUu4iqdjEZART-HxTH4e4gNI8,872
|
|
307
310
|
truefoundry/ml/autogen/client/rest.py,sha256=9goba8qHjQuVx5O_yRaTKu7PvBnb7r7swfy3dwuTEgk,14281
|
|
308
|
-
truefoundry/ml/autogen/client_README.md,sha256=
|
|
309
|
-
truefoundry/ml/autogen/entities/artifacts.py,sha256=
|
|
311
|
+
truefoundry/ml/autogen/client_README.md,sha256=9g4j_zKjNJleHNZu_N15KaFRsCAspWI_xMzuHkgq6iQ,36930
|
|
312
|
+
truefoundry/ml/autogen/entities/artifacts.py,sha256=tH_gCB-w2A4Yq8kJck9vLVCQ1CxnIKVzBhDWMdH3Uho,20294
|
|
310
313
|
truefoundry/ml/autogen/models/__init__.py,sha256=--TGRea9SQBWFfwtcl3ekb1XGfFTdEkQGSG8a2SJ60I,187
|
|
311
314
|
truefoundry/ml/autogen/models/exceptions.py,sha256=q3n7FGBrg_hUy1UyoefhMnhcXUAaqXlLIGHoOVzn_d8,1390
|
|
312
315
|
truefoundry/ml/autogen/models/schema.py,sha256=IhpO9qbygLqEamP3NIt3m90SseJXCOm1ZTqNbNbW-M0,55772
|
|
@@ -346,7 +349,7 @@ truefoundry/ml/log_types/utils.py,sha256=xjJ21jdPScvFmw3TbVh5NCzbzJwaqiXJyiiT4xx
|
|
|
346
349
|
truefoundry/ml/logger.py,sha256=VT-BF3BnBYTWVq87O58F0c8uXMu94gYzsiFlGY3_7Ao,458
|
|
347
350
|
truefoundry/ml/mlfoundry_api.py,sha256=PefznXwBPBv8TD4RYid9aiE8WWEkZQAHoaAbvklFoRs,62364
|
|
348
351
|
truefoundry/ml/mlfoundry_run.py,sha256=RLTZGz3htyxNmG1Xat9WevawEIjDoUCbWrSNql8WynI,44597
|
|
349
|
-
truefoundry/ml/model_framework.py,sha256=
|
|
352
|
+
truefoundry/ml/model_framework.py,sha256=trqqzy1-BpW3bF4V7wETiOlRBdlcQi2Lk7MXORngmoU,17585
|
|
350
353
|
truefoundry/ml/run_utils.py,sha256=0W208wSLUrbdfk2pjNcZlkUi9bNxG2JORqoe-5rVqHI,2423
|
|
351
354
|
truefoundry/ml/session.py,sha256=F83GTC5WwGBjnJ69Ct8MqMnlutYc56JCc6YhEY1Wl-A,5394
|
|
352
355
|
truefoundry/ml/validation_utils.py,sha256=J5atNhcJLvKj64ralSV9Y5Fv1Rt4SE237ICdP9-7sP4,12149
|
|
@@ -367,7 +370,7 @@ truefoundry/workflow/remote_filesystem/tfy_signed_url_client.py,sha256=5mBCIc-ON
|
|
|
367
370
|
truefoundry/workflow/remote_filesystem/tfy_signed_url_fs.py,sha256=Hf6Dk6Fu6P7DqsK5ULgraf9DStjgigf-kjaRAMBW-RU,8680
|
|
368
371
|
truefoundry/workflow/task.py,sha256=ToitYiKcNzFCtOVQwz1W8sRjbR97eVS7vQBdbgUQtKg,1779
|
|
369
372
|
truefoundry/workflow/workflow.py,sha256=WaTqUjhwfAXDWu4E5ehuwAxrCbDJkoAf1oWmR2E9Qy0,4575
|
|
370
|
-
truefoundry-0.5.
|
|
371
|
-
truefoundry-0.5.
|
|
372
|
-
truefoundry-0.5.
|
|
373
|
-
truefoundry-0.5.
|
|
373
|
+
truefoundry-0.5.1rc7.dist-info/METADATA,sha256=p7N_7W876IqUUAqgllMzYDrKisvxTAPUmfib0G30Uwo,2887
|
|
374
|
+
truefoundry-0.5.1rc7.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
375
|
+
truefoundry-0.5.1rc7.dist-info/entry_points.txt,sha256=TXvUxQkI6zmqJuycPsyxEIMr3oqfDjgrWj0m_9X12x4,95
|
|
376
|
+
truefoundry-0.5.1rc7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|