truefoundry 0.5.1rc1__py3-none-any.whl → 0.5.1rc2__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/__init__.py +1 -1
- truefoundry/ml/log_types/artifacts/model.py +18 -0
- {truefoundry-0.5.1rc1.dist-info → truefoundry-0.5.1rc2.dist-info}/METADATA +1 -1
- {truefoundry-0.5.1rc1.dist-info → truefoundry-0.5.1rc2.dist-info}/RECORD +6 -7
- truefoundry/ml/log_types/artifacts/model_extras.py +0 -48
- {truefoundry-0.5.1rc1.dist-info → truefoundry-0.5.1rc2.dist-info}/WHEEL +0 -0
- {truefoundry-0.5.1rc1.dist-info → truefoundry-0.5.1rc2.dist-info}/entry_points.txt +0 -0
truefoundry/ml/__init__.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
from truefoundry.ml.autogen.client.models import LibraryName, ModelVersionEnvironment
|
|
2
|
-
from truefoundry.ml.autogen.models import infer_signature
|
|
3
2
|
from truefoundry.ml.enums import (
|
|
4
3
|
DataSlice,
|
|
5
4
|
FileFormat,
|
|
@@ -17,6 +16,7 @@ from truefoundry.ml.log_types.artifacts.artifact import (
|
|
|
17
16
|
from truefoundry.ml.log_types.artifacts.dataset import DataDirectory, DataDirectoryPath
|
|
18
17
|
from truefoundry.ml.log_types.artifacts.model import (
|
|
19
18
|
ModelVersion,
|
|
19
|
+
infer_signature,
|
|
20
20
|
)
|
|
21
21
|
from truefoundry.ml.logger import init_logger
|
|
22
22
|
from truefoundry.ml.mlfoundry_api import get_client
|
|
@@ -54,6 +54,9 @@ from truefoundry.ml.session import _get_api_client
|
|
|
54
54
|
from truefoundry.pydantic_v1 import BaseModel, Extra
|
|
55
55
|
|
|
56
56
|
if TYPE_CHECKING:
|
|
57
|
+
import numpy as np
|
|
58
|
+
import pandas as pd
|
|
59
|
+
|
|
57
60
|
from truefoundry.ml.mlfoundry_run import MlFoundryRun
|
|
58
61
|
|
|
59
62
|
|
|
@@ -624,3 +627,18 @@ def _log_model_version( # noqa: C901
|
|
|
624
627
|
)
|
|
625
628
|
)
|
|
626
629
|
return ModelVersion.from_fqn(fqn=artifact_version_response.artifact_version.fqn)
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
def infer_signature(
|
|
633
|
+
model_input: Any = None,
|
|
634
|
+
model_output: Optional[
|
|
635
|
+
Union["pd.DataFrame", "np.ndarray", Dict[str, "np.ndarray"]]
|
|
636
|
+
] = None,
|
|
637
|
+
params: Optional[Dict[str, Any]] = None,
|
|
638
|
+
):
|
|
639
|
+
# TODO: Importing this globally causes hard dependencies on some libraries like pandas
|
|
640
|
+
from truefoundry.ml.autogen.models import infer_signature as _infer_signature
|
|
641
|
+
|
|
642
|
+
return _infer_signature(
|
|
643
|
+
model_input=model_input, model_output=model_output, params=params
|
|
644
|
+
)
|
|
@@ -107,7 +107,7 @@ truefoundry/deploy/v2/lib/models.py,sha256=pSolLMTArDuYpeNsmeeS5DWliloN_iCDfZSpR
|
|
|
107
107
|
truefoundry/deploy/v2/lib/patched_models.py,sha256=NTU8J_CwdvEuF9zNXwFyN3suOp_196Wrm75DDy5qcXE,14184
|
|
108
108
|
truefoundry/deploy/v2/lib/source.py,sha256=VHKuFREiixUP40D3Mrz-TA70spu1M0RbCzl--qwlFaY,9263
|
|
109
109
|
truefoundry/logger.py,sha256=u-YCNjg5HBwE70uQcpjIG64Ghos-K2ulTWaxC03BSj4,714
|
|
110
|
-
truefoundry/ml/__init__.py,sha256=
|
|
110
|
+
truefoundry/ml/__init__.py,sha256=aPrCvFWkb_MGMliT3rBaF4CBcF0AdaymC9DFuK5J7DM,1926
|
|
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
|
|
@@ -331,8 +331,7 @@ truefoundry/ml/log_types/artifacts/artifact.py,sha256=6X4lO23DwM7yTgUOY4RRoYMrf9
|
|
|
331
331
|
truefoundry/ml/log_types/artifacts/constants.py,sha256=qKxQ5mMvJE4j83BvGW3qNTKunxCiBg_EEjTdgbgJtyE,1036
|
|
332
332
|
truefoundry/ml/log_types/artifacts/dataset.py,sha256=a4dxd2EN8p7Ci-cLGGiDOboN3t0395_XhWE1dmTw1Q4,13112
|
|
333
333
|
truefoundry/ml/log_types/artifacts/general_artifact.py,sha256=B4XErLr-m6RmQWtxMTu3wlFRFcqSwPYp6J0OL4Ng6L0,3179
|
|
334
|
-
truefoundry/ml/log_types/artifacts/model.py,sha256=
|
|
335
|
-
truefoundry/ml/log_types/artifacts/model_extras.py,sha256=TIE73bLKfwIVzNiVcjmaZ841A70BHBwu4XAM6ZAQRFI,1045
|
|
334
|
+
truefoundry/ml/log_types/artifacts/model.py,sha256=BqZPUt3rKYdlceZ35NNU6a31m0FVEKYbrHQb9tIe8wg,23854
|
|
336
335
|
truefoundry/ml/log_types/artifacts/utils.py,sha256=yhIZYe3Y-J0rG0Wcwql_Qjxe9hlefFbXUfRFqg4E9cM,7502
|
|
337
336
|
truefoundry/ml/log_types/image/__init__.py,sha256=fcOq8yQnNj1rkLcPeIjLXBpdA1WIeiPsXOlAAvMxx7M,76
|
|
338
337
|
truefoundry/ml/log_types/image/constants.py,sha256=wLtGEOA4T5fZHSlOXPuNDLX3lpbCtwlvGKPFk_1fah0,255
|
|
@@ -366,7 +365,7 @@ truefoundry/workflow/remote_filesystem/tfy_signed_url_client.py,sha256=5mBCIc-ON
|
|
|
366
365
|
truefoundry/workflow/remote_filesystem/tfy_signed_url_fs.py,sha256=Hf6Dk6Fu6P7DqsK5ULgraf9DStjgigf-kjaRAMBW-RU,8680
|
|
367
366
|
truefoundry/workflow/task.py,sha256=ToitYiKcNzFCtOVQwz1W8sRjbR97eVS7vQBdbgUQtKg,1779
|
|
368
367
|
truefoundry/workflow/workflow.py,sha256=WaTqUjhwfAXDWu4E5ehuwAxrCbDJkoAf1oWmR2E9Qy0,4575
|
|
369
|
-
truefoundry-0.5.
|
|
370
|
-
truefoundry-0.5.
|
|
371
|
-
truefoundry-0.5.
|
|
372
|
-
truefoundry-0.5.
|
|
368
|
+
truefoundry-0.5.1rc2.dist-info/METADATA,sha256=vL0TH3dHp17F31KFqk_0vWHF2xefUVPUJHN54CsI7MA,2887
|
|
369
|
+
truefoundry-0.5.1rc2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
370
|
+
truefoundry-0.5.1rc2.dist-info/entry_points.txt,sha256=TXvUxQkI6zmqJuycPsyxEIMr3oqfDjgrWj0m_9X12x4,95
|
|
371
|
+
truefoundry-0.5.1rc2.dist-info/RECORD,,
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import enum
|
|
2
|
-
from typing import List, Type, TypeVar
|
|
3
|
-
|
|
4
|
-
from truefoundry.ml.autogen.client import ( # type: ignore[attr-defined]
|
|
5
|
-
ModelSchemaDto,
|
|
6
|
-
)
|
|
7
|
-
from truefoundry.ml.exceptions import MlFoundryException
|
|
8
|
-
from truefoundry.pydantic_v1 import BaseModel
|
|
9
|
-
|
|
10
|
-
T = TypeVar("T")
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class BaseEnum(enum.Enum):
|
|
14
|
-
@classmethod
|
|
15
|
-
def values(cls: Type[T]) -> List[T]:
|
|
16
|
-
return [member.value for member in cls]
|
|
17
|
-
|
|
18
|
-
@classmethod
|
|
19
|
-
def _missing_(cls: Type[T], value: object):
|
|
20
|
-
raise MlFoundryException(
|
|
21
|
-
f"Unknown value for type {cls.__name__}: {value}", status_code=400
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
@enum.unique
|
|
26
|
-
class CustomMetricValueType(str, BaseEnum):
|
|
27
|
-
FLOAT = "float"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
@enum.unique
|
|
31
|
-
class CustomMetricType(str, BaseEnum):
|
|
32
|
-
METRIC = "metric"
|
|
33
|
-
PROJECTION = "projection"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
class CustomMetric(BaseModel):
|
|
37
|
-
class Config:
|
|
38
|
-
validate_assignment = True
|
|
39
|
-
use_enum_values = True
|
|
40
|
-
extra = "allow"
|
|
41
|
-
|
|
42
|
-
name: str
|
|
43
|
-
value_type: CustomMetricValueType
|
|
44
|
-
type: CustomMetricType
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
class ModelSchema(ModelSchemaDto):
|
|
48
|
-
pass
|
|
File without changes
|
|
File without changes
|