truefoundry 0.4.3__py3-none-any.whl → 0.4.4__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 +36 -2
- truefoundry/common/credential_provider.py +4 -2
- truefoundry/common/request_utils.py +1 -1
- truefoundry/common/servicefoundry_client.py +4 -2
- truefoundry/common/tfy_signed_url_client.py +260 -0
- truefoundry/common/tfy_signed_url_fs.py +244 -0
- truefoundry/common/utils.py +18 -5
- truefoundry/deploy/auto_gen/models.py +39 -4
- truefoundry/deploy/builder/builders/tfy_notebook_buildpack/dockerfile_template.py +1 -1
- truefoundry/deploy/builder/builders/tfy_python_buildpack/dockerfile_template.py +2 -4
- truefoundry/deploy/lib/clients/servicefoundry_client.py +2 -1
- truefoundry/deploy/lib/model/entity.py +0 -4
- truefoundry/deploy/python_deploy_codegen.py +79 -7
- truefoundry/ml/artifact/truefoundry_artifact_repo.py +448 -424
- truefoundry/ml/autogen/client/__init__.py +24 -3
- truefoundry/ml/autogen/client/api/experiments_api.py +0 -137
- truefoundry/ml/autogen/client/api/mlfoundry_artifacts_api.py +2 -0
- truefoundry/ml/autogen/client/models/__init__.py +24 -3
- truefoundry/ml/autogen/client/models/artifact_dto.py +9 -0
- truefoundry/ml/autogen/client/models/artifact_version_dto.py +26 -0
- truefoundry/ml/autogen/client/models/artifact_version_serialization_format.py +34 -0
- truefoundry/ml/autogen/client/models/create_artifact_version_response_dto.py +8 -2
- truefoundry/ml/autogen/client/models/create_run_request_dto.py +1 -10
- truefoundry/ml/autogen/client/models/dataset_dto.py +9 -0
- truefoundry/ml/autogen/client/models/experiment_dto.py +14 -3
- truefoundry/ml/autogen/client/models/external_model_source.py +79 -0
- truefoundry/ml/autogen/client/models/finalize_artifact_version_request_dto.py +11 -0
- truefoundry/ml/autogen/client/models/framework.py +154 -0
- truefoundry/ml/autogen/client/models/library_name.py +35 -0
- truefoundry/ml/autogen/client/models/model_dto.py +9 -0
- truefoundry/ml/autogen/client/models/model_version_dto.py +26 -0
- truefoundry/ml/autogen/client/models/model_version_manifest.py +119 -0
- truefoundry/ml/autogen/client/models/run_info_dto.py +10 -1
- truefoundry/ml/autogen/client/models/source.py +177 -0
- truefoundry/ml/autogen/client/models/subject.py +79 -0
- truefoundry/ml/autogen/client/models/subject_type.py +34 -0
- truefoundry/ml/autogen/client/models/tensorflow_framework.py +74 -0
- truefoundry/ml/autogen/client/models/transformers_framework.py +90 -0
- truefoundry/ml/autogen/client/models/truefoundry_model_source.py +79 -0
- truefoundry/ml/autogen/client/models/update_model_version_request_dto.py +11 -0
- truefoundry/ml/autogen/client/models/upload_model_source.py +74 -0
- truefoundry/ml/autogen/client_README.md +12 -2
- truefoundry/ml/autogen/entities/artifacts.py +236 -4
- truefoundry/ml/log_types/artifacts/artifact.py +10 -11
- truefoundry/ml/log_types/artifacts/dataset.py +13 -10
- truefoundry/ml/log_types/artifacts/general_artifact.py +3 -1
- truefoundry/ml/log_types/artifacts/model.py +18 -35
- truefoundry/ml/log_types/artifacts/utils.py +42 -25
- truefoundry/ml/log_types/image/image.py +2 -0
- truefoundry/ml/log_types/plot.py +2 -0
- truefoundry/ml/mlfoundry_api.py +7 -3
- truefoundry/ml/session.py +3 -1
- truefoundry/workflow/__init__.py +10 -0
- {truefoundry-0.4.3.dist-info → truefoundry-0.4.4.dist-info}/METADATA +1 -1
- {truefoundry-0.4.3.dist-info → truefoundry-0.4.4.dist-info}/RECORD +57 -45
- truefoundry/ml/autogen/client/models/list_seed_experiments_response_dto.py +0 -81
- truefoundry/ml/env_vars.py +0 -9
- {truefoundry-0.4.3.dist-info → truefoundry-0.4.4.dist-info}/WHEEL +0 -0
- {truefoundry-0.4.3.dist-info → truefoundry-0.4.4.dist-info}/entry_points.txt +0 -0
|
@@ -78,7 +78,6 @@ Class | Method | HTTP request | Description
|
|
|
78
78
|
*ExperimentsApi* | [**list_experiments_get**](truefoundry/ml/autogen/client/docs/ExperimentsApi.md#list_experiments_get) | **GET** /api/2.0/mlflow/experiments/list | List Experiments
|
|
79
79
|
*ExperimentsApi* | [**put_privacy_type_put**](truefoundry/ml/autogen/client/docs/ExperimentsApi.md#put_privacy_type_put) | **PUT** /api/2.0/mlflow/experiments/privacy-type | Put Privacy Type
|
|
80
80
|
*ExperimentsApi* | [**restore_experiment_post**](truefoundry/ml/autogen/client/docs/ExperimentsApi.md#restore_experiment_post) | **POST** /api/2.0/mlflow/experiments/restore | Restore Experiment
|
|
81
|
-
*ExperimentsApi* | [**seed_list_experiment_get**](truefoundry/ml/autogen/client/docs/ExperimentsApi.md#seed_list_experiment_get) | **GET** /api/2.0/mlflow/experiments/seed/list | Seed List Experiment
|
|
82
81
|
*ExperimentsApi* | [**set_experiment_tag_post**](truefoundry/ml/autogen/client/docs/ExperimentsApi.md#set_experiment_tag_post) | **POST** /api/2.0/mlflow/experiments/set-experiment-tag | Set Experiment Tag
|
|
83
82
|
*ExperimentsApi* | [**update_experiment_post**](truefoundry/ml/autogen/client/docs/ExperimentsApi.md#update_experiment_post) | **POST** /api/2.0/mlflow/experiments/update | Update Experiment
|
|
84
83
|
*HealthApi* | [**health_get**](truefoundry/ml/autogen/client/docs/HealthApi.md#health_get) | **GET** /health | Health
|
|
@@ -166,6 +165,7 @@ Class | Method | HTTP request | Description
|
|
|
166
165
|
- [ArtifactType](truefoundry/ml/autogen/client/docs/ArtifactType.md)
|
|
167
166
|
- [ArtifactVersionDto](truefoundry/ml/autogen/client/docs/ArtifactVersionDto.md)
|
|
168
167
|
- [ArtifactVersionResponseDto](truefoundry/ml/autogen/client/docs/ArtifactVersionResponseDto.md)
|
|
168
|
+
- [ArtifactVersionSerializationFormat](truefoundry/ml/autogen/client/docs/ArtifactVersionSerializationFormat.md)
|
|
169
169
|
- [ArtifactVersionStatus](truefoundry/ml/autogen/client/docs/ArtifactVersionStatus.md)
|
|
170
170
|
- [AssistantMessage](truefoundry/ml/autogen/client/docs/AssistantMessage.md)
|
|
171
171
|
- [AuthorizeUserForModelRequestDto](truefoundry/ml/autogen/client/docs/AuthorizeUserForModelRequestDto.md)
|
|
@@ -206,10 +206,12 @@ Class | Method | HTTP request | Description
|
|
|
206
206
|
- [ExperimentIdRequestDto](truefoundry/ml/autogen/client/docs/ExperimentIdRequestDto.md)
|
|
207
207
|
- [ExperimentResponseDto](truefoundry/ml/autogen/client/docs/ExperimentResponseDto.md)
|
|
208
208
|
- [ExperimentTagDto](truefoundry/ml/autogen/client/docs/ExperimentTagDto.md)
|
|
209
|
+
- [ExternalModelSource](truefoundry/ml/autogen/client/docs/ExternalModelSource.md)
|
|
209
210
|
- [FeatureDto](truefoundry/ml/autogen/client/docs/FeatureDto.md)
|
|
210
211
|
- [FeatureValueType](truefoundry/ml/autogen/client/docs/FeatureValueType.md)
|
|
211
212
|
- [FileInfoDto](truefoundry/ml/autogen/client/docs/FileInfoDto.md)
|
|
212
213
|
- [FinalizeArtifactVersionRequestDto](truefoundry/ml/autogen/client/docs/FinalizeArtifactVersionRequestDto.md)
|
|
214
|
+
- [Framework](truefoundry/ml/autogen/client/docs/Framework.md)
|
|
213
215
|
- [GetExperimentResponseDto](truefoundry/ml/autogen/client/docs/GetExperimentResponseDto.md)
|
|
214
216
|
- [GetLatestRunLogResponseDto](truefoundry/ml/autogen/client/docs/GetLatestRunLogResponseDto.md)
|
|
215
217
|
- [GetMetricHistoryResponse](truefoundry/ml/autogen/client/docs/GetMetricHistoryResponse.md)
|
|
@@ -227,6 +229,7 @@ Class | Method | HTTP request | Description
|
|
|
227
229
|
- [ImageUrl](truefoundry/ml/autogen/client/docs/ImageUrl.md)
|
|
228
230
|
- [InternalMetadata](truefoundry/ml/autogen/client/docs/InternalMetadata.md)
|
|
229
231
|
- [LatestRunLogDto](truefoundry/ml/autogen/client/docs/LatestRunLogDto.md)
|
|
232
|
+
- [LibraryName](truefoundry/ml/autogen/client/docs/LibraryName.md)
|
|
230
233
|
- [ListArtifactVersionsRequestDto](truefoundry/ml/autogen/client/docs/ListArtifactVersionsRequestDto.md)
|
|
231
234
|
- [ListArtifactVersionsResponseDto](truefoundry/ml/autogen/client/docs/ListArtifactVersionsResponseDto.md)
|
|
232
235
|
- [ListArtifactsRequestDto](truefoundry/ml/autogen/client/docs/ListArtifactsRequestDto.md)
|
|
@@ -248,7 +251,6 @@ Class | Method | HTTP request | Description
|
|
|
248
251
|
- [ListModelsResponseDto](truefoundry/ml/autogen/client/docs/ListModelsResponseDto.md)
|
|
249
252
|
- [ListRunArtifactsResponseDto](truefoundry/ml/autogen/client/docs/ListRunArtifactsResponseDto.md)
|
|
250
253
|
- [ListRunLogsResponseDto](truefoundry/ml/autogen/client/docs/ListRunLogsResponseDto.md)
|
|
251
|
-
- [ListSeedExperimentsResponseDto](truefoundry/ml/autogen/client/docs/ListSeedExperimentsResponseDto.md)
|
|
252
254
|
- [LogBatchRequestDto](truefoundry/ml/autogen/client/docs/LogBatchRequestDto.md)
|
|
253
255
|
- [LogMetricRequestDto](truefoundry/ml/autogen/client/docs/LogMetricRequestDto.md)
|
|
254
256
|
- [LogParamRequestDto](truefoundry/ml/autogen/client/docs/LogParamRequestDto.md)
|
|
@@ -261,6 +263,7 @@ Class | Method | HTTP request | Description
|
|
|
261
263
|
- [ModelResponseDto](truefoundry/ml/autogen/client/docs/ModelResponseDto.md)
|
|
262
264
|
- [ModelSchemaDto](truefoundry/ml/autogen/client/docs/ModelSchemaDto.md)
|
|
263
265
|
- [ModelVersionDto](truefoundry/ml/autogen/client/docs/ModelVersionDto.md)
|
|
266
|
+
- [ModelVersionManifest](truefoundry/ml/autogen/client/docs/ModelVersionManifest.md)
|
|
264
267
|
- [ModelVersionResponseDto](truefoundry/ml/autogen/client/docs/ModelVersionResponseDto.md)
|
|
265
268
|
- [MultiPartUploadDto](truefoundry/ml/autogen/client/docs/MultiPartUploadDto.md)
|
|
266
269
|
- [MultiPartUploadResponseDto](truefoundry/ml/autogen/client/docs/MultiPartUploadResponseDto.md)
|
|
@@ -284,17 +287,24 @@ Class | Method | HTTP request | Description
|
|
|
284
287
|
- [SetExperimentTagRequestDto](truefoundry/ml/autogen/client/docs/SetExperimentTagRequestDto.md)
|
|
285
288
|
- [SetTagRequestDto](truefoundry/ml/autogen/client/docs/SetTagRequestDto.md)
|
|
286
289
|
- [SignedURLDto](truefoundry/ml/autogen/client/docs/SignedURLDto.md)
|
|
290
|
+
- [Source](truefoundry/ml/autogen/client/docs/Source.md)
|
|
287
291
|
- [Stop](truefoundry/ml/autogen/client/docs/Stop.md)
|
|
288
292
|
- [StoreRunLogsRequestDto](truefoundry/ml/autogen/client/docs/StoreRunLogsRequestDto.md)
|
|
293
|
+
- [Subject](truefoundry/ml/autogen/client/docs/Subject.md)
|
|
294
|
+
- [SubjectType](truefoundry/ml/autogen/client/docs/SubjectType.md)
|
|
289
295
|
- [SystemMessage](truefoundry/ml/autogen/client/docs/SystemMessage.md)
|
|
296
|
+
- [TensorflowFramework](truefoundry/ml/autogen/client/docs/TensorflowFramework.md)
|
|
290
297
|
- [Text](truefoundry/ml/autogen/client/docs/Text.md)
|
|
291
298
|
- [TextContentPart](truefoundry/ml/autogen/client/docs/TextContentPart.md)
|
|
299
|
+
- [TransformersFramework](truefoundry/ml/autogen/client/docs/TransformersFramework.md)
|
|
300
|
+
- [TruefoundryModelSource](truefoundry/ml/autogen/client/docs/TruefoundryModelSource.md)
|
|
292
301
|
- [UpdateArtifactVersionRequestDto](truefoundry/ml/autogen/client/docs/UpdateArtifactVersionRequestDto.md)
|
|
293
302
|
- [UpdateDatasetRequestDto](truefoundry/ml/autogen/client/docs/UpdateDatasetRequestDto.md)
|
|
294
303
|
- [UpdateExperimentRequestDto](truefoundry/ml/autogen/client/docs/UpdateExperimentRequestDto.md)
|
|
295
304
|
- [UpdateModelVersionRequestDto](truefoundry/ml/autogen/client/docs/UpdateModelVersionRequestDto.md)
|
|
296
305
|
- [UpdateRunRequestDto](truefoundry/ml/autogen/client/docs/UpdateRunRequestDto.md)
|
|
297
306
|
- [UpdateRunResponseDto](truefoundry/ml/autogen/client/docs/UpdateRunResponseDto.md)
|
|
307
|
+
- [UploadModelSource](truefoundry/ml/autogen/client/docs/UploadModelSource.md)
|
|
298
308
|
- [Url](truefoundry/ml/autogen/client/docs/Url.md)
|
|
299
309
|
- [UserMessage](truefoundry/ml/autogen/client/docs/UserMessage.md)
|
|
300
310
|
- [ValidationError](truefoundry/ml/autogen/client/docs/ValidationError.md)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# generated by datamodel-codegen:
|
|
2
2
|
# filename: artifacts.json
|
|
3
|
-
# timestamp: 2024-
|
|
3
|
+
# timestamp: 2024-10-25T06:52:16+00:00
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
7
7
|
from enum import Enum
|
|
8
8
|
from typing import Any, Dict, List, Literal, Optional, Union
|
|
9
9
|
|
|
10
|
-
from truefoundry.pydantic_v1 import BaseModel, Field, constr
|
|
10
|
+
from truefoundry.pydantic_v1 import BaseModel, Field, conint, constr
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class Agent(BaseModel):
|
|
@@ -49,6 +49,17 @@ class AgentWithFQN(Agent):
|
|
|
49
49
|
fqn: str
|
|
50
50
|
|
|
51
51
|
|
|
52
|
+
class BaseArtifactVersion(BaseModel):
|
|
53
|
+
description: Optional[constr(max_length=512)] = Field(
|
|
54
|
+
None,
|
|
55
|
+
description="+label=Description\n+docs=Description of the artifact version",
|
|
56
|
+
)
|
|
57
|
+
metadata: Dict[str, Any] = Field(
|
|
58
|
+
...,
|
|
59
|
+
description="+label=Metadata\n+docs=Metadata for the model version\n+usage=Metadata for the model version\n+uiType=JsonInput",
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
52
63
|
class MimeType(str, Enum):
|
|
53
64
|
"""
|
|
54
65
|
+label=MIME Type
|
|
@@ -78,6 +89,51 @@ class BlobStorageReference(BaseModel):
|
|
|
78
89
|
)
|
|
79
90
|
|
|
80
91
|
|
|
92
|
+
class ExternalModelSource(BaseModel):
|
|
93
|
+
"""
|
|
94
|
+
+label=External
|
|
95
|
+
"""
|
|
96
|
+
|
|
97
|
+
type: Literal["external"] = Field(
|
|
98
|
+
...,
|
|
99
|
+
description="+label=Type\n+usage=Type of the source\n+value=external\n+type=External",
|
|
100
|
+
)
|
|
101
|
+
uri: str = Field(..., description="+label=URI\n+usage=URI of the model source")
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class FastAIFramework(BaseModel):
|
|
105
|
+
"""
|
|
106
|
+
+docs=FastAI framework for the model version
|
|
107
|
+
+label=FastAI
|
|
108
|
+
"""
|
|
109
|
+
|
|
110
|
+
type: Literal["fastai"] = Field(
|
|
111
|
+
..., description="+label=Type\n+usage=Type of the framework\n+value=fastai"
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class GluonFramework(BaseModel):
|
|
116
|
+
"""
|
|
117
|
+
+docs=Gluon framework for the model version
|
|
118
|
+
+label=Gluon
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
type: Literal["gluon"] = Field(
|
|
122
|
+
..., description="+label=Type\n+usage=Type of the framework\n+value=gluon"
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
class H2OFramework(BaseModel):
|
|
127
|
+
"""
|
|
128
|
+
+docs=H2O framework for the model version
|
|
129
|
+
+label=H2O
|
|
130
|
+
"""
|
|
131
|
+
|
|
132
|
+
type: Literal["h2o"] = Field(
|
|
133
|
+
..., description="+label=Type\n+usage=Type of the framework\n+value=h2o"
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
|
|
81
137
|
class ImageUrl(BaseModel):
|
|
82
138
|
"""
|
|
83
139
|
+label=URL for the image
|
|
@@ -108,6 +164,28 @@ class ImageContentPart(BaseModel):
|
|
|
108
164
|
)
|
|
109
165
|
|
|
110
166
|
|
|
167
|
+
class KerasFramework(BaseModel):
|
|
168
|
+
"""
|
|
169
|
+
+docs=Keras framework for the model version
|
|
170
|
+
+label=Keras
|
|
171
|
+
"""
|
|
172
|
+
|
|
173
|
+
type: Literal["keras"] = Field(
|
|
174
|
+
..., description="+label=Type\n+usage=Type of the framework\n+value=keras"
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
class LightGBMFramework(BaseModel):
|
|
179
|
+
"""
|
|
180
|
+
+docs=LightGBM framework for the model version
|
|
181
|
+
+label=LightGBM
|
|
182
|
+
"""
|
|
183
|
+
|
|
184
|
+
type: Literal["lightgbm"] = Field(
|
|
185
|
+
..., description="+label=Type\n+usage=Type of the framework\n+value=lightgbm"
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
|
|
111
189
|
class Parameters(BaseModel):
|
|
112
190
|
"""
|
|
113
191
|
+usage=Parameters for the provider
|
|
@@ -148,6 +226,61 @@ class ModelConfiguration(BaseModel):
|
|
|
148
226
|
)
|
|
149
227
|
|
|
150
228
|
|
|
229
|
+
class PaddleFramework(BaseModel):
|
|
230
|
+
"""
|
|
231
|
+
+docs=PaddlePaddle framework for the model version
|
|
232
|
+
+label=Paddle
|
|
233
|
+
"""
|
|
234
|
+
|
|
235
|
+
type: Literal["paddle"] = Field(
|
|
236
|
+
..., description="+label=Type\n+usage=Type of the framework\n+value=paddle"
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
class PyTorchFramework(BaseModel):
|
|
241
|
+
"""
|
|
242
|
+
+docs=PyTorch framework for the model version
|
|
243
|
+
+label=PyTorch
|
|
244
|
+
"""
|
|
245
|
+
|
|
246
|
+
type: Literal["pytorch"] = Field(
|
|
247
|
+
..., description="+label=Type\n+usage=Type of the framework\n+value=pytorch"
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
class SklearnFramework(BaseModel):
|
|
252
|
+
"""
|
|
253
|
+
+docs=Scikit-learn framework for the model version
|
|
254
|
+
+label=Sklearn
|
|
255
|
+
"""
|
|
256
|
+
|
|
257
|
+
type: Literal["sklearn"] = Field(
|
|
258
|
+
..., description="+label=Type\n+usage=Type of the framework\n+value=sklearn"
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
class SpaCyFramework(BaseModel):
|
|
263
|
+
"""
|
|
264
|
+
+docs=spaCy framework for the model version
|
|
265
|
+
+label=SpaCy
|
|
266
|
+
"""
|
|
267
|
+
|
|
268
|
+
type: Literal["spacy"] = Field(
|
|
269
|
+
..., description="+label=Type\n+usage=Type of the framework\n+value=spacy"
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
class StatsModelsFramework(BaseModel):
|
|
274
|
+
"""
|
|
275
|
+
+docs=StatsModels framework for the model version
|
|
276
|
+
+label=StatsModels
|
|
277
|
+
"""
|
|
278
|
+
|
|
279
|
+
type: Literal["statsmodels"] = Field(
|
|
280
|
+
..., description="+label=Type\n+usage=Type of the framework\n+value=statsmodels"
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
|
|
151
284
|
class SystemMessage(BaseModel):
|
|
152
285
|
"""
|
|
153
286
|
+usage=System message
|
|
@@ -164,6 +297,17 @@ class SystemMessage(BaseModel):
|
|
|
164
297
|
)
|
|
165
298
|
|
|
166
299
|
|
|
300
|
+
class TensorFlowFramework(BaseModel):
|
|
301
|
+
"""
|
|
302
|
+
+docs=TensorFlow framework for the model version
|
|
303
|
+
+label=TensorFlow
|
|
304
|
+
"""
|
|
305
|
+
|
|
306
|
+
type: Literal["tensorflow"] = Field(
|
|
307
|
+
..., description="+label=Type\n+usage=Type of the framework\n+value=tensorflow"
|
|
308
|
+
)
|
|
309
|
+
|
|
310
|
+
|
|
167
311
|
class TextContentPart(BaseModel):
|
|
168
312
|
"""
|
|
169
313
|
+usage=Text content
|
|
@@ -174,6 +318,53 @@ class TextContentPart(BaseModel):
|
|
|
174
318
|
text: Union[constr(regex=r"^.[\s\S]*$"), BlobStorageReference]
|
|
175
319
|
|
|
176
320
|
|
|
321
|
+
class LibraryName(str, Enum):
|
|
322
|
+
"""
|
|
323
|
+
+label=Library Name
|
|
324
|
+
+usage=Name of the library for the framework
|
|
325
|
+
"""
|
|
326
|
+
|
|
327
|
+
transformers = "transformers"
|
|
328
|
+
sentence_transformers = "sentence-transformers"
|
|
329
|
+
diffusers = "diffusers"
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
class TransformersFramework(BaseModel):
|
|
333
|
+
"""
|
|
334
|
+
+docs=Transformers framework for the model version
|
|
335
|
+
+label=Transformers
|
|
336
|
+
+value=transformers
|
|
337
|
+
"""
|
|
338
|
+
|
|
339
|
+
type: Literal["transformers"] = Field(
|
|
340
|
+
...,
|
|
341
|
+
description="+label=Type\n+usage=Type of the framework\n+value=transformers",
|
|
342
|
+
)
|
|
343
|
+
library_name: Optional[LibraryName] = Field(
|
|
344
|
+
"transformers",
|
|
345
|
+
description="+label=Library Name\n+usage=Name of the library for the framework",
|
|
346
|
+
)
|
|
347
|
+
pipeline_tag: Optional[str] = Field(
|
|
348
|
+
None,
|
|
349
|
+
description="+label=Pipeline Tag\n+usage=Pipeline tag\n+docs=Pipeline tag for the framework",
|
|
350
|
+
)
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
class TruefoundryModelSource(BaseModel):
|
|
354
|
+
"""
|
|
355
|
+
+usage=Source for the Model
|
|
356
|
+
+label=Upload
|
|
357
|
+
"""
|
|
358
|
+
|
|
359
|
+
type: Literal["truefoundry"] = Field(
|
|
360
|
+
...,
|
|
361
|
+
description="+usage=Type of the source\n+type=Upload\n+value=truefoundry\n+label=Upload",
|
|
362
|
+
)
|
|
363
|
+
uri: str = Field(
|
|
364
|
+
..., description='+label=URI\n+uiType=UploadInput\n+uiProps={"hideClear":true}'
|
|
365
|
+
)
|
|
366
|
+
|
|
367
|
+
|
|
177
368
|
class UserMessage(BaseModel):
|
|
178
369
|
"""
|
|
179
370
|
+usage=User message
|
|
@@ -194,6 +385,17 @@ class UserMessage(BaseModel):
|
|
|
194
385
|
)
|
|
195
386
|
|
|
196
387
|
|
|
388
|
+
class XGBoostFramework(BaseModel):
|
|
389
|
+
"""
|
|
390
|
+
+docs=XGBoost framework for the model version
|
|
391
|
+
+label=XGBoost
|
|
392
|
+
"""
|
|
393
|
+
|
|
394
|
+
type: Literal["xgboost"] = Field(
|
|
395
|
+
..., description="+label=Type\n+usage=Type of the framework\n+value=xgboost"
|
|
396
|
+
)
|
|
397
|
+
|
|
398
|
+
|
|
197
399
|
class AgentOpenAPITool(BaseModel):
|
|
198
400
|
type: Literal["openapi-tool"] = Field(..., description="+value=openapi-tool")
|
|
199
401
|
name: constr(regex=r"^[a-zA-Z][a-zA-Z0-9\-]{1,30}[a-zA-Z0-9]$") = Field(
|
|
@@ -275,6 +477,36 @@ class ChatPrompt(BasePrompt):
|
|
|
275
477
|
)
|
|
276
478
|
|
|
277
479
|
|
|
480
|
+
class ModelVersion(BaseArtifactVersion):
|
|
481
|
+
type: Literal["model-version"] = Field(
|
|
482
|
+
..., description='+label=Type\n+usage=Model Version\n+value="model-version"'
|
|
483
|
+
)
|
|
484
|
+
source: Union[TruefoundryModelSource, ExternalModelSource] = Field(
|
|
485
|
+
...,
|
|
486
|
+
description="+label=Model Source\n+usage=Source for the model version\n+uiType=Group",
|
|
487
|
+
)
|
|
488
|
+
framework: Optional[
|
|
489
|
+
Union[
|
|
490
|
+
TransformersFramework,
|
|
491
|
+
TensorFlowFramework,
|
|
492
|
+
SklearnFramework,
|
|
493
|
+
PyTorchFramework,
|
|
494
|
+
KerasFramework,
|
|
495
|
+
XGBoostFramework,
|
|
496
|
+
LightGBMFramework,
|
|
497
|
+
FastAIFramework,
|
|
498
|
+
H2OFramework,
|
|
499
|
+
SpaCyFramework,
|
|
500
|
+
StatsModelsFramework,
|
|
501
|
+
GluonFramework,
|
|
502
|
+
PaddleFramework,
|
|
503
|
+
]
|
|
504
|
+
] = Field(
|
|
505
|
+
None, description="+label=Framework\n+usage=Framework for the model version"
|
|
506
|
+
)
|
|
507
|
+
step: conint(ge=0) = Field(0, description="+label=Step")
|
|
508
|
+
|
|
509
|
+
|
|
278
510
|
class AgentApp(BaseModel):
|
|
279
511
|
type: Literal["agent-app"] = Field(..., description="+value=agent-app")
|
|
280
512
|
tools: List[AgentOpenAPIToolWithFQN]
|
|
@@ -282,5 +514,5 @@ class AgentApp(BaseModel):
|
|
|
282
514
|
root_agent: constr(min_length=1)
|
|
283
515
|
|
|
284
516
|
|
|
285
|
-
class
|
|
286
|
-
__root__: Union[ChatPrompt, AgentOpenAPITool, Agent, AgentApp]
|
|
517
|
+
class ArtifactsVersion(BaseModel):
|
|
518
|
+
__root__: Union[ChatPrompt, AgentOpenAPITool, Agent, AgentApp, ModelVersion]
|
|
@@ -29,9 +29,10 @@ from truefoundry.ml.autogen.entities.artifacts import ChatPrompt
|
|
|
29
29
|
from truefoundry.ml.exceptions import MlFoundryException
|
|
30
30
|
from truefoundry.ml.log_types.artifacts.constants import INTERNAL_METADATA_PATH
|
|
31
31
|
from truefoundry.ml.log_types.artifacts.utils import (
|
|
32
|
+
_get_src_dest_pairs,
|
|
32
33
|
_validate_artifact_metadata,
|
|
33
34
|
_validate_description,
|
|
34
|
-
|
|
35
|
+
calculate_total_size,
|
|
35
36
|
)
|
|
36
37
|
from truefoundry.ml.logger import logger
|
|
37
38
|
from truefoundry.ml.session import _get_api_client
|
|
@@ -184,11 +185,6 @@ class ArtifactVersion:
|
|
|
184
185
|
_validate_artifact_metadata(value)
|
|
185
186
|
self._metadata = value
|
|
186
187
|
|
|
187
|
-
@property
|
|
188
|
-
def created_by(self) -> str:
|
|
189
|
-
"""Get the information about who created the artifact"""
|
|
190
|
-
return self._artifact_version.created_by
|
|
191
|
-
|
|
192
188
|
@property
|
|
193
189
|
def created_at(self) -> datetime.datetime:
|
|
194
190
|
"""Get the time at which artifact was created"""
|
|
@@ -402,7 +398,7 @@ class ChatPromptVersion(ArtifactVersion):
|
|
|
402
398
|
@property
|
|
403
399
|
def extra_parameters(self) -> Dict[str, Any]:
|
|
404
400
|
_extra_parameters = self._chat_prompt.model_configuration.extra_parameters
|
|
405
|
-
return _extra_parameters
|
|
401
|
+
return _extra_parameters if _extra_parameters else {}
|
|
406
402
|
|
|
407
403
|
@property
|
|
408
404
|
def variables(self) -> Dict[str, Any]:
|
|
@@ -414,6 +410,7 @@ def _log_artifact_version_helper(
|
|
|
414
410
|
name: str,
|
|
415
411
|
artifact_type: ArtifactType,
|
|
416
412
|
artifact_dir: tempfile.TemporaryDirectory,
|
|
413
|
+
dest_to_src_map: Dict[str, str],
|
|
417
414
|
mlfoundry_artifacts_api: Optional[MlfoundryArtifactsApi] = None,
|
|
418
415
|
ml_repo_id: Optional[str] = None,
|
|
419
416
|
description: Optional[str] = None,
|
|
@@ -448,15 +445,17 @@ def _log_artifact_version_helper(
|
|
|
448
445
|
),
|
|
449
446
|
api_client=mlfoundry_artifacts_api.api_client,
|
|
450
447
|
)
|
|
451
|
-
|
|
448
|
+
|
|
449
|
+
total_size = calculate_total_size(list(dest_to_src_map.values()))
|
|
452
450
|
try:
|
|
453
451
|
logger.info(
|
|
454
|
-
"Packaging and uploading files to remote with
|
|
452
|
+
"Packaging and uploading files to remote with size: %.6f MB",
|
|
455
453
|
total_size / 1000000.0,
|
|
456
454
|
)
|
|
457
|
-
|
|
458
|
-
|
|
455
|
+
src_dest_pairs = _get_src_dest_pairs(
|
|
456
|
+
root_dir=artifact_dir.name, dest_to_src_map=dest_to_src_map
|
|
459
457
|
)
|
|
458
|
+
artifacts_repo.log_artifacts(src_dest_pairs=src_dest_pairs, progress=progress)
|
|
460
459
|
except Exception as e:
|
|
461
460
|
mlfoundry_artifacts_api.notify_failure_post(
|
|
462
461
|
notify_artifact_version_failure_dto=NotifyArtifactVersionFailureDto(
|
|
@@ -19,9 +19,10 @@ from truefoundry.ml.entities import FileInfo
|
|
|
19
19
|
from truefoundry.ml.exceptions import MlFoundryException
|
|
20
20
|
from truefoundry.ml.log_types.artifacts.utils import (
|
|
21
21
|
_copy_additional_files,
|
|
22
|
+
_get_src_dest_pairs,
|
|
22
23
|
_validate_artifact_metadata,
|
|
23
24
|
_validate_description,
|
|
24
|
-
|
|
25
|
+
calculate_total_size,
|
|
25
26
|
)
|
|
26
27
|
from truefoundry.ml.logger import logger
|
|
27
28
|
from truefoundry.ml.session import _get_api_client
|
|
@@ -124,11 +125,6 @@ class DataDirectory:
|
|
|
124
125
|
_validate_artifact_metadata(value)
|
|
125
126
|
self._metadata = value
|
|
126
127
|
|
|
127
|
-
@property
|
|
128
|
-
def created_by(self) -> str:
|
|
129
|
-
"""Get the information about who created the DataDirectory"""
|
|
130
|
-
return self._dataset.created_by
|
|
131
|
-
|
|
132
128
|
@property
|
|
133
129
|
def created_at(self) -> datetime.datetime:
|
|
134
130
|
"""Get the time at which DataDirectory was created"""
|
|
@@ -144,6 +140,7 @@ class DataDirectory:
|
|
|
144
140
|
file_paths: List[
|
|
145
141
|
Union[Tuple[str], Tuple[str, Optional[str]], DataDirectoryPath]
|
|
146
142
|
],
|
|
143
|
+
progress: Optional[bool] = None,
|
|
147
144
|
) -> None:
|
|
148
145
|
"""Logs File in the `DataDirectory`.
|
|
149
146
|
|
|
@@ -212,7 +209,7 @@ class DataDirectory:
|
|
|
212
209
|
|
|
213
210
|
try:
|
|
214
211
|
logger.info("Copying the files to add")
|
|
215
|
-
_copy_additional_files(
|
|
212
|
+
temp_dest_to_src_map = _copy_additional_files(
|
|
216
213
|
root_dir=temp_dir.name,
|
|
217
214
|
files_dir="",
|
|
218
215
|
model_dir=None,
|
|
@@ -224,13 +221,19 @@ class DataDirectory:
|
|
|
224
221
|
raise MlFoundryException("Failed to Add Files to DataDirectory") from e
|
|
225
222
|
|
|
226
223
|
artifacts_repo = self._get_artifacts_repo()
|
|
227
|
-
total_size =
|
|
224
|
+
total_size = calculate_total_size(list(temp_dest_to_src_map.values()))
|
|
228
225
|
try:
|
|
229
226
|
logger.info(
|
|
230
|
-
"Packaging and uploading files to remote with
|
|
227
|
+
"Packaging and uploading files to remote with size: %.6f MB",
|
|
231
228
|
total_size / 1000000.0,
|
|
232
229
|
)
|
|
233
|
-
|
|
230
|
+
src_dest_pairs = _get_src_dest_pairs(
|
|
231
|
+
root_dir=temp_dir.name, dest_to_src_map=temp_dest_to_src_map
|
|
232
|
+
)
|
|
233
|
+
artifacts_repo.log_artifacts(
|
|
234
|
+
src_dest_pairs=src_dest_pairs,
|
|
235
|
+
progress=progress,
|
|
236
|
+
)
|
|
234
237
|
except Exception as e:
|
|
235
238
|
raise MlFoundryException("Failed to Add Files to DataDirectory") from e
|
|
236
239
|
finally:
|
|
@@ -77,7 +77,7 @@ def _log_artifact_version(
|
|
|
77
77
|
os.makedirs(local_files_dir, exist_ok=True)
|
|
78
78
|
|
|
79
79
|
logger.info("Copying the files to log")
|
|
80
|
-
_copy_additional_files(
|
|
80
|
+
temp_dest_to_src_map = _copy_additional_files(
|
|
81
81
|
root_dir=temp_dir.name,
|
|
82
82
|
files_dir=internal_metadata.files_dir,
|
|
83
83
|
model_dir=None,
|
|
@@ -94,6 +94,7 @@ def _log_artifact_version(
|
|
|
94
94
|
os.makedirs(os.path.dirname(local_internal_metadata_path), exist_ok=True)
|
|
95
95
|
with open(local_internal_metadata_path, "w") as f:
|
|
96
96
|
json.dump(internal_metadata.dict(), f)
|
|
97
|
+
temp_dest_to_src_map[local_internal_metadata_path] = local_internal_metadata_path
|
|
97
98
|
|
|
98
99
|
return _log_artifact_version_helper(
|
|
99
100
|
run=run,
|
|
@@ -101,6 +102,7 @@ def _log_artifact_version(
|
|
|
101
102
|
name=name,
|
|
102
103
|
artifact_type=ArtifactType.ARTIFACT,
|
|
103
104
|
artifact_dir=temp_dir,
|
|
105
|
+
dest_to_src_map=temp_dest_to_src_map,
|
|
104
106
|
mlfoundry_artifacts_api=mlfoundry_artifacts_api,
|
|
105
107
|
description=description,
|
|
106
108
|
internal_metadata=internal_metadata,
|
|
@@ -40,8 +40,10 @@ from truefoundry.ml.log_types.artifacts.constants import (
|
|
|
40
40
|
from truefoundry.ml.log_types.artifacts.model_extras import CustomMetric, ModelSchema
|
|
41
41
|
from truefoundry.ml.log_types.artifacts.utils import (
|
|
42
42
|
_copy_additional_files,
|
|
43
|
+
_get_src_dest_pairs,
|
|
43
44
|
_validate_artifact_metadata,
|
|
44
45
|
_validate_description,
|
|
46
|
+
calculate_total_size,
|
|
45
47
|
)
|
|
46
48
|
from truefoundry.ml.session import _get_api_client
|
|
47
49
|
from truefoundry.pydantic_v1 import BaseModel, Extra
|
|
@@ -219,11 +221,6 @@ class ModelVersion:
|
|
|
219
221
|
metrics_as_kv[metric.key] = metric.value
|
|
220
222
|
return metrics_as_kv
|
|
221
223
|
|
|
222
|
-
@property
|
|
223
|
-
def created_by(self) -> str:
|
|
224
|
-
"""Get the information about who created the model version"""
|
|
225
|
-
return self._model_version.created_by
|
|
226
|
-
|
|
227
224
|
@property
|
|
228
225
|
def created_at(self) -> datetime.datetime:
|
|
229
226
|
"""Get the time at which model version was created"""
|
|
@@ -393,24 +390,6 @@ class ModelVersion:
|
|
|
393
390
|
self._set_mutable_attrs()
|
|
394
391
|
|
|
395
392
|
|
|
396
|
-
def calculate_model_size(artifact_dir: tempfile.TemporaryDirectory):
|
|
397
|
-
"""
|
|
398
|
-
Tells about the size of the model
|
|
399
|
-
|
|
400
|
-
Args:
|
|
401
|
-
artifact_dir (str): directory in which model is present.
|
|
402
|
-
|
|
403
|
-
Returns:
|
|
404
|
-
total size of the model
|
|
405
|
-
"""
|
|
406
|
-
total_size = 0
|
|
407
|
-
for path, _dirs, files in os.walk(artifact_dir.name):
|
|
408
|
-
for f in files:
|
|
409
|
-
file_path = os.path.join(path, f)
|
|
410
|
-
total_size += os.stat(file_path).st_size
|
|
411
|
-
return total_size
|
|
412
|
-
|
|
413
|
-
|
|
414
393
|
def _log_model_version( # noqa: C901
|
|
415
394
|
run: Optional["MlFoundryRun"],
|
|
416
395
|
name: str,
|
|
@@ -489,28 +468,29 @@ def _log_model_version( # noqa: C901
|
|
|
489
468
|
os.makedirs(local_model_dir, exist_ok=True)
|
|
490
469
|
|
|
491
470
|
logger.info("Adding model file/folder to model version content")
|
|
492
|
-
|
|
493
|
-
(model_file_or_folder, MODEL_DIR_NAME.rstrip(os.sep) + os.sep)
|
|
471
|
+
_model_file_or_folder: Sequence[Tuple[str, str]] = [
|
|
472
|
+
(model_file_or_folder, MODEL_DIR_NAME.rstrip(os.sep) + os.sep),
|
|
494
473
|
]
|
|
495
|
-
|
|
474
|
+
|
|
475
|
+
temp_dest_to_src_map = _copy_additional_files(
|
|
496
476
|
root_dir=temp_dir.name,
|
|
497
477
|
files_dir=internal_metadata.files_dir,
|
|
498
478
|
model_dir=internal_metadata.model_dir,
|
|
499
|
-
additional_files=
|
|
479
|
+
additional_files=_model_file_or_folder,
|
|
500
480
|
ignore_model_dir_dest_conflict=True,
|
|
501
481
|
)
|
|
502
482
|
|
|
503
483
|
# verify additional files and paths, copy additional files
|
|
504
484
|
if additional_files:
|
|
505
485
|
logger.info("Adding `additional_files` to model version contents")
|
|
506
|
-
_copy_additional_files(
|
|
486
|
+
temp_dest_to_src_map = _copy_additional_files(
|
|
507
487
|
root_dir=temp_dir.name,
|
|
508
488
|
files_dir=internal_metadata.files_dir,
|
|
509
489
|
model_dir=internal_metadata.model_dir,
|
|
510
490
|
additional_files=additional_files,
|
|
511
491
|
ignore_model_dir_dest_conflict=False,
|
|
492
|
+
existing_dest_to_src_map=temp_dest_to_src_map,
|
|
512
493
|
)
|
|
513
|
-
|
|
514
494
|
except Exception as e:
|
|
515
495
|
temp_dir.cleanup()
|
|
516
496
|
raise MlFoundryException("Failed to log model") from e
|
|
@@ -520,6 +500,7 @@ def _log_model_version( # noqa: C901
|
|
|
520
500
|
os.makedirs(os.path.dirname(local_internal_metadata_path), exist_ok=True)
|
|
521
501
|
with open(local_internal_metadata_path, "w") as f:
|
|
522
502
|
json.dump(internal_metadata.dict(), f)
|
|
503
|
+
temp_dest_to_src_map[local_internal_metadata_path] = local_internal_metadata_path
|
|
523
504
|
|
|
524
505
|
# create entry
|
|
525
506
|
_create_artifact_version_response = (
|
|
@@ -538,15 +519,17 @@ def _log_model_version( # noqa: C901
|
|
|
538
519
|
),
|
|
539
520
|
api_client=mlfoundry_artifacts_api.api_client,
|
|
540
521
|
)
|
|
541
|
-
|
|
522
|
+
|
|
523
|
+
total_size = calculate_total_size(list(temp_dest_to_src_map.values()))
|
|
542
524
|
try:
|
|
543
525
|
logger.info(
|
|
544
|
-
"Packaging and uploading files to remote with
|
|
545
|
-
|
|
526
|
+
"Packaging and uploading files to remote with size: %.6f MB",
|
|
527
|
+
total_size / 1000000.0,
|
|
546
528
|
)
|
|
547
|
-
|
|
548
|
-
|
|
529
|
+
src_dest_pairs = _get_src_dest_pairs(
|
|
530
|
+
root_dir=temp_dir.name, dest_to_src_map=temp_dest_to_src_map
|
|
549
531
|
)
|
|
532
|
+
artifacts_repo.log_artifacts(src_dest_pairs=src_dest_pairs, progress=progress)
|
|
550
533
|
except Exception as e:
|
|
551
534
|
mlfoundry_artifacts_api.notify_failure_post(
|
|
552
535
|
notify_artifact_version_failure_dto=NotifyArtifactVersionFailureDto(
|
|
@@ -567,7 +550,7 @@ def _log_model_version( # noqa: C901
|
|
|
567
550
|
finalize_artifact_version_request_dto=FinalizeArtifactVersionRequestDto(
|
|
568
551
|
id=version_id,
|
|
569
552
|
run_uuid=run.run_id if run else None,
|
|
570
|
-
artifact_size=
|
|
553
|
+
artifact_size=total_size,
|
|
571
554
|
internal_metadata=internal_metadata_dto,
|
|
572
555
|
step=step if run else None,
|
|
573
556
|
)
|