zenml-nightly 0.68.1.dev20241103__py3-none-any.whl → 0.70.0.dev20241115__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.
- README.md +1 -1
- RELEASE_NOTES.md +77 -0
- zenml/VERSION +1 -1
- zenml/__init__.py +2 -0
- zenml/artifacts/external_artifact.py +2 -1
- zenml/artifacts/{load_directory_materializer.py → preexisting_data_materializer.py} +8 -9
- zenml/artifacts/utils.py +139 -80
- zenml/cli/base.py +4 -4
- zenml/cli/model.py +1 -6
- zenml/cli/stack.py +1 -0
- zenml/client.py +29 -74
- zenml/config/server_config.py +17 -1
- zenml/constants.py +2 -7
- zenml/data_validators/base_data_validator.py +2 -2
- zenml/enums.py +20 -4
- zenml/exceptions.py +4 -0
- zenml/integrations/__init__.py +3 -1
- zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py +20 -18
- zenml/integrations/azure/orchestrators/azureml_orchestrator.py +1 -1
- zenml/integrations/bentoml/materializers/bentoml_bento_materializer.py +19 -31
- zenml/integrations/constants.py +1 -0
- zenml/integrations/deepchecks/data_validators/deepchecks_data_validator.py +1 -1
- zenml/integrations/evidently/__init__.py +1 -1
- zenml/integrations/gcp/orchestrators/vertex_orchestrator.py +1 -1
- zenml/integrations/huggingface/materializers/huggingface_datasets_materializer.py +8 -12
- zenml/integrations/huggingface/materializers/huggingface_pt_model_materializer.py +17 -18
- zenml/integrations/huggingface/materializers/huggingface_t5_materializer.py +2 -5
- zenml/integrations/huggingface/materializers/huggingface_tf_model_materializer.py +17 -18
- zenml/integrations/huggingface/materializers/huggingface_tokenizer_materializer.py +2 -3
- zenml/integrations/langchain/__init__.py +2 -1
- zenml/integrations/langchain/materializers/openai_embedding_materializer.py +28 -2
- zenml/integrations/lightgbm/materializers/lightgbm_booster_materializer.py +8 -15
- zenml/integrations/lightgbm/materializers/lightgbm_dataset_materializer.py +11 -16
- zenml/integrations/lightning/orchestrators/lightning_orchestrator.py +29 -9
- zenml/integrations/openai/__init__.py +1 -1
- zenml/integrations/openai/hooks/open_ai_failure_hook.py +39 -14
- zenml/integrations/pillow/materializers/pillow_image_materializer.py +17 -20
- zenml/integrations/polars/materializers/dataframe_materializer.py +26 -39
- zenml/integrations/pycaret/materializers/model_materializer.py +7 -22
- zenml/integrations/tensorboard/visualizers/tensorboard_visualizer.py +60 -54
- zenml/integrations/tensorflow/materializers/keras_materializer.py +11 -22
- zenml/integrations/tensorflow/materializers/tf_dataset_materializer.py +8 -15
- zenml/integrations/vllm/__init__.py +50 -0
- zenml/integrations/vllm/flavors/__init__.py +21 -0
- zenml/integrations/vllm/flavors/vllm_model_deployer_flavor.py +91 -0
- zenml/integrations/vllm/model_deployers/__init__.py +19 -0
- zenml/integrations/vllm/model_deployers/vllm_model_deployer.py +263 -0
- zenml/integrations/vllm/services/__init__.py +19 -0
- zenml/integrations/vllm/services/vllm_deployment.py +206 -0
- zenml/integrations/whylogs/materializers/whylogs_materializer.py +11 -18
- zenml/integrations/xgboost/materializers/xgboost_booster_materializer.py +11 -22
- zenml/integrations/xgboost/materializers/xgboost_dmatrix_materializer.py +10 -19
- zenml/materializers/base_materializer.py +68 -1
- zenml/metadata/lazy_load.py +20 -7
- zenml/model/model.py +17 -64
- zenml/model/utils.py +5 -0
- zenml/models/__init__.py +0 -12
- zenml/models/v2/base/filter.py +121 -8
- zenml/models/v2/core/artifact_version.py +42 -7
- zenml/models/v2/core/model_version.py +26 -5
- zenml/models/v2/core/pipeline_run.py +25 -6
- zenml/models/v2/core/run_metadata.py +2 -217
- zenml/models/v2/core/step_run.py +62 -24
- zenml/orchestrators/base_orchestrator.py +12 -1
- zenml/orchestrators/input_utils.py +44 -19
- zenml/orchestrators/step_launcher.py +4 -3
- zenml/orchestrators/step_run_utils.py +19 -15
- zenml/orchestrators/step_runner.py +25 -14
- zenml/orchestrators/utils.py +45 -26
- zenml/stack/flavor.py +9 -5
- zenml/stack_deployments/aws_stack_deployment.py +23 -6
- zenml/stack_deployments/azure_stack_deployment.py +28 -5
- zenml/stack_deployments/gcp_stack_deployment.py +25 -8
- zenml/stack_deployments/stack_deployment.py +3 -5
- zenml/steps/base_step.py +1 -1
- zenml/steps/entrypoint_function_utils.py +3 -5
- zenml/steps/step_context.py +5 -2
- zenml/steps/utils.py +13 -2
- zenml/utils/callback_registry.py +71 -0
- zenml/utils/metadata_utils.py +335 -0
- zenml/zen_server/auth.py +221 -3
- zenml/zen_server/cache.py +208 -0
- zenml/zen_server/dashboard/assets/{404-DT4QRUqN.js → 404-NVXKFp-x.js} +1 -1
- zenml/zen_server/dashboard/assets/{@radix-DP6vWzyx.js → @radix-DeK6qiuw.js} +1 -1
- zenml/zen_server/dashboard/assets/{@react-router-BMhZulnd.js → @react-router-B3Z5rLr2.js} +1 -1
- zenml/zen_server/dashboard/assets/{@reactflow-8U9qNlMR.js → @reactflow-CK0KJUen.js} +2 -2
- zenml/zen_server/dashboard/assets/{@tanstack-BUCbhJyH.js → @tanstack-DT5WLu9C.js} +1 -1
- zenml/zen_server/dashboard/assets/AlertDialogDropdownItem-DezXKmDf.js +1 -0
- zenml/zen_server/dashboard/assets/{CodeSnippet-CqybNv0k.js → CodeSnippet-JzR8CEtw.js} +2 -2
- zenml/zen_server/dashboard/assets/{CollapsibleCard-0r_8G2Lj.js → CollapsibleCard-DQW_ktMO.js} +1 -1
- zenml/zen_server/dashboard/assets/{Commands-BDjgBQKi.js → Commands-DL2kwkRd.js} +1 -1
- zenml/zen_server/dashboard/assets/ComponentBadge-D_g62Wv8.js +1 -0
- zenml/zen_server/dashboard/assets/{CopyButton-C745BrKi.js → CopyButton-LNcWaa14.js} +1 -1
- zenml/zen_server/dashboard/assets/{CsvVizualization-PpAq0CeZ.js → CsvVizualization-DknpE5ej.js} +5 -5
- zenml/zen_server/dashboard/assets/{DialogItem-DcVCZEew.js → DialogItem-Bxf8FuAT.js} +1 -1
- zenml/zen_server/dashboard/assets/{DisplayDate-BeXgUG_C.js → DisplayDate-CDMUcQHS.js} +1 -1
- zenml/zen_server/dashboard/assets/{EmptyState-DeK7H4pr.js → EmptyState-BzdlCwp3.js} +1 -1
- zenml/zen_server/dashboard/assets/{Error-BMlzibXj.js → Error-DYflYyps.js} +1 -1
- zenml/zen_server/dashboard/assets/ExecutionStatus-C7zyIQKZ.js +1 -0
- zenml/zen_server/dashboard/assets/{Helpbox-BLf40fLV.js → Helpbox-oYSGpLqd.js} +1 -1
- zenml/zen_server/dashboard/assets/{Infobox-BwisKifi.js → Infobox-Cx4xGoXR.js} +1 -1
- zenml/zen_server/dashboard/assets/{InlineAvatar-jEgodSgX.js → InlineAvatar-DiGOWNKF.js} +1 -1
- zenml/zen_server/dashboard/assets/{Lock-3lLt1ih0.js → Lock-CYYy18Mm.js} +1 -1
- zenml/zen_server/dashboard/assets/{MarkdownVisualization-8O9kTr-2.js → MarkdownVisualization-ylXaAxev.js} +1 -1
- zenml/zen_server/dashboard/assets/NestedCollapsible-DYbgyKxK.js +1 -0
- zenml/zen_server/dashboard/assets/{NumberBox-T9eELfLZ.js → NumberBox-Dtp3J6g5.js} +1 -1
- zenml/zen_server/dashboard/assets/Partials-03iZf8-N.js +1 -0
- zenml/zen_server/dashboard/assets/{PasswordChecker-CW0kqY0W.js → PasswordChecker-B0nadgh6.js} +1 -1
- zenml/zen_server/dashboard/assets/ProBadge-D_EB8HNo.js +1 -0
- zenml/zen_server/dashboard/assets/ProCta-DqNS4v3x.js +1 -0
- zenml/zen_server/dashboard/assets/ProviderIcon-Bki2aw8w.js +1 -0
- zenml/zen_server/dashboard/assets/{ProviderRadio-BROY1700.js → ProviderRadio-8f43sPD4.js} +1 -1
- zenml/zen_server/dashboard/assets/RunSelector-DkPiIiNr.js +1 -0
- zenml/zen_server/dashboard/assets/RunsBody-07YEO7qI.js +1 -0
- zenml/zen_server/dashboard/assets/SearchField-lp1KgU4e.js +1 -0
- zenml/zen_server/dashboard/assets/{SecretTooltip-C_qByGWB.js → SecretTooltip-CgnbyeOx.js} +1 -1
- zenml/zen_server/dashboard/assets/{SetPassword-7pRB00El.js → SetPassword-CpP418A2.js} +1 -1
- zenml/zen_server/dashboard/assets/StackList-WvuKQusZ.js +1 -0
- zenml/zen_server/dashboard/assets/Tabs-BktHkCJJ.js +1 -0
- zenml/zen_server/dashboard/assets/Tick-BlMoIlJT.js +1 -0
- zenml/zen_server/dashboard/assets/{UpdatePasswordSchemas-DckMEkFf.js → UpdatePasswordSchemas-Sc0A0pP-.js} +1 -1
- zenml/zen_server/dashboard/assets/{UsageReason-DVceN14P.js → UsageReason-YYduL4fj.js} +1 -1
- zenml/zen_server/dashboard/assets/{WizardFooter-CW0Cvd70.js → WizardFooter-dgmizSJC.js} +1 -1
- zenml/zen_server/dashboard/assets/all-pipeline-runs-query-D-c2G6lV.js +1 -0
- zenml/zen_server/dashboard/assets/check-DloQpStc.js +1 -0
- zenml/zen_server/dashboard/assets/{check-circle-Dwxliy1Z.js → check-circle-jNbX5-sR.js} +1 -1
- zenml/zen_server/dashboard/assets/{chevron-down-8wLBS5pQ.js → chevron-down-6JyMkfjR.js} +1 -1
- zenml/zen_server/dashboard/assets/{chevron-right-double-DoD8iXWM.js → chevron-right-double-D7ojK9Co.js} +1 -1
- zenml/zen_server/dashboard/assets/{code-browser-CZUQs3Wa.js → code-browser-CUFUIHfp.js} +1 -1
- zenml/zen_server/dashboard/assets/{copy-CaSMXwiU.js → copy-C8XQA2Ug.js} +1 -1
- zenml/zen_server/dashboard/assets/create-stack-DM_JPgef.js +1 -0
- zenml/zen_server/dashboard/assets/delete-run-CJdh1P_h.js +1 -0
- zenml/zen_server/dashboard/assets/{docker-BFNgg-z3.js → docker-BdA9vrnW.js} +1 -1
- zenml/zen_server/dashboard/assets/{dots-horizontal-DK5Duzx4.js → dots-horizontal-otGBOSDJ.js} +1 -1
- zenml/zen_server/dashboard/assets/{form-schemas-1AyOCx90.js → form-schemas-K6FYKjwa.js} +1 -1
- zenml/zen_server/dashboard/assets/{gcp-7M2Yf3ZK.js → gcp-CFtm4BA7.js} +1 -1
- zenml/zen_server/dashboard/assets/{help-Dam461dC.js → help-Cc9bBIJH.js} +1 -1
- zenml/zen_server/dashboard/assets/index-B1mVPYxf.js +1 -0
- zenml/zen_server/dashboard/assets/index-BAkC7FXi.js +1 -0
- zenml/zen_server/dashboard/assets/{index-QQb7wQEC.js → index-CCOPpudF.js} +8 -8
- zenml/zen_server/dashboard/assets/index-CEV4Cvaf.js +1 -0
- zenml/zen_server/dashboard/assets/index-DlGvJQPn.css +1 -0
- zenml/zen_server/dashboard/assets/{index-BVJ8n2-j.js → index-Uu49AX48.js} +1 -1
- zenml/zen_server/dashboard/assets/{index.esm-cuVep_NJ.js → index.esm-Dy6Z9Ung.js} +1 -1
- zenml/zen_server/dashboard/assets/{kubernetes--g7r02Zu.js → kubernetes-B2wmAJ1d.js} +1 -1
- zenml/zen_server/dashboard/assets/{layout-DCSYN7-C.js → layout-BtHBmE4w.js} +1 -1
- zenml/zen_server/dashboard/assets/{link-external-CBEk6kEG.js → link-external-b9AXw_sW.js} +1 -1
- zenml/zen_server/dashboard/assets/{login-mutation-DTcAFP1l.js → login-mutation-hf-lK87O.js} +1 -1
- zenml/zen_server/dashboard/assets/{logs-D5bdJGur.js → logs-WMSM52RF.js} +1 -1
- zenml/zen_server/dashboard/assets/{not-found-Cc-JkRH2.js → not-found-BGirLjU-.js} +1 -1
- zenml/zen_server/dashboard/assets/{package-Cs35Szwh.js → package-C6uypY4h.js} +1 -1
- zenml/zen_server/dashboard/assets/page-0JE_-Ec1.js +1 -0
- zenml/zen_server/dashboard/assets/{page-DH_Z7iW1.js → page-6m6yHHlE.js} +1 -1
- zenml/zen_server/dashboard/assets/page-BDigxVpo.js +1 -0
- zenml/zen_server/dashboard/assets/page-BR68V0V1.js +1 -0
- zenml/zen_server/dashboard/assets/page-BRLpxOt0.js +1 -0
- zenml/zen_server/dashboard/assets/{page-BQQKaabe.js → page-BU7huvKw.js} +3 -3
- zenml/zen_server/dashboard/assets/page-BvqLv2Ky.js +1 -0
- zenml/zen_server/dashboard/assets/page-C00YAkaB.js +1 -0
- zenml/zen_server/dashboard/assets/{page-N4qoPHKb.js → page-CD-DcWoy.js} +1 -1
- zenml/zen_server/dashboard/assets/page-COXXJj1k.js +1 -0
- zenml/zen_server/dashboard/assets/page-CbpvrsDL.js +1 -0
- zenml/zen_server/dashboard/assets/page-CdMWnQak.js +1 -0
- zenml/zen_server/dashboard/assets/{page-ClUVkl-O.js → page-CjGdWY13.js} +1 -1
- zenml/zen_server/dashboard/assets/page-CwxrFarU.js +1 -0
- zenml/zen_server/dashboard/assets/{page-DLixvR-7.js → page-D01JhjQB.js} +1 -1
- zenml/zen_server/dashboard/assets/page-D6uU2ax4.js +1 -0
- zenml/zen_server/dashboard/assets/page-D7S3aCbF.js +1 -0
- zenml/zen_server/dashboard/assets/{page-9yplj5JT.js → page-DLC-bNBP.js} +1 -1
- zenml/zen_server/dashboard/assets/page-DXSTpqRD.js +1 -0
- zenml/zen_server/dashboard/assets/{page-DzpVUZ8f.js → page-DakHVWXF.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-DIOXwhiD.js → page-Df-Fw0aq.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-B-y2XKIc.js → page-DfbXf_8s.js} +1 -1
- zenml/zen_server/dashboard/assets/page-DjRJCGb3.js +1 -0
- zenml/zen_server/dashboard/assets/{page-C0N5q3l7.js → page-Djikxq_S.js} +1 -1
- zenml/zen_server/dashboard/assets/page-Dnovpa0i.js +3 -0
- zenml/zen_server/dashboard/assets/page-Dot3LPmL.js +1 -0
- zenml/zen_server/dashboard/assets/page-Vcxara9U.js +1 -0
- zenml/zen_server/dashboard/assets/page-Xynx4btY.js +14 -0
- zenml/zen_server/dashboard/assets/page-YpKAqVSa.js +1 -0
- zenml/zen_server/dashboard/assets/page-yYC9OI-E.js +1 -0
- zenml/zen_server/dashboard/assets/{persist-DNb5cdrU.js → persist-Coz7ZWvz.js} +1 -1
- zenml/zen_server/dashboard/assets/{persist-CP0JmYZ4.js → persist-GjC8PZoC.js} +1 -1
- zenml/zen_server/dashboard/assets/{plus-C9IxgN2M.js → plus-tf1V2hTJ.js} +1 -1
- zenml/zen_server/dashboard/assets/{refresh-BVu22P_C.js → refresh-BjOeWlEq.js} +1 -1
- zenml/zen_server/dashboard/assets/{rocket-CONEmRmB.js → rocket-DjT2cDvG.js} +1 -1
- zenml/zen_server/dashboard/assets/sharedSchema-CQb14VSr.js +14 -0
- zenml/zen_server/dashboard/assets/stack-detail-query-OPEW-cDJ.js +1 -0
- zenml/zen_server/dashboard/assets/{tick-circle-CM1ZScbQ.js → tick-circle-BEX_Tp4v.js} +1 -1
- zenml/zen_server/dashboard/assets/{trash-DkJHMOg7.js → trash-arLUMWMS.js} +1 -1
- zenml/zen_server/dashboard/assets/{update-server-settings-mutation-DsU8cNVl.js → update-server-settings-mutation-LwuQfHYn.js} +1 -1
- zenml/zen_server/dashboard/assets/upgrade-form-CwRHBuXB.webp +0 -0
- zenml/zen_server/dashboard/assets/url-CkvKAnwF.js +1 -0
- zenml/zen_server/dashboard/assets/{zod-D89GC_vc.js → zod-BwEbpOxH.js} +1 -1
- zenml/zen_server/dashboard/index.html +7 -7
- zenml/zen_server/deploy/helm/Chart.yaml +1 -1
- zenml/zen_server/deploy/helm/README.md +2 -2
- zenml/zen_server/exceptions.py +2 -0
- zenml/zen_server/jwt.py +30 -13
- zenml/zen_server/rbac/endpoint_utils.py +43 -1
- zenml/zen_server/rbac/utils.py +0 -2
- zenml/zen_server/routers/artifact_version_endpoints.py +27 -1
- zenml/zen_server/routers/auth_endpoints.py +134 -102
- zenml/zen_server/routers/logs_endpoints.py +66 -0
- zenml/zen_server/routers/workspaces_endpoints.py +3 -4
- zenml/zen_server/template_execution/utils.py +14 -16
- zenml/zen_server/utils.py +27 -0
- zenml/zen_server/zen_server_api.py +6 -3
- zenml/zen_stores/migrations/versions/0.70.0_release.py +23 -0
- zenml/zen_stores/migrations/versions/1cb6477f72d6_move_artifact_save_type.py +99 -0
- zenml/zen_stores/migrations/versions/904464ea4041_add_pipeline_model_run_unique_constraints.py +192 -0
- zenml/zen_stores/migrations/versions/b557b2871693_update_step_run_input_types.py +33 -0
- zenml/zen_stores/rest_zen_store.py +68 -64
- zenml/zen_stores/schemas/artifact_schemas.py +8 -1
- zenml/zen_stores/schemas/model_schemas.py +27 -3
- zenml/zen_stores/schemas/pipeline_run_schemas.py +6 -1
- zenml/zen_stores/schemas/pipeline_schemas.py +8 -2
- zenml/zen_stores/schemas/run_metadata_schemas.py +1 -48
- zenml/zen_stores/schemas/step_run_schemas.py +18 -10
- zenml/zen_stores/sql_zen_store.py +283 -219
- zenml/zen_stores/zen_store_interface.py +15 -42
- {zenml_nightly-0.68.1.dev20241103.dist-info → zenml_nightly-0.70.0.dev20241115.dist-info}/METADATA +2 -2
- {zenml_nightly-0.68.1.dev20241103.dist-info → zenml_nightly-0.70.0.dev20241115.dist-info}/RECORD +226 -203
- zenml/zen_server/dashboard/assets/AlertDialogDropdownItem-C6N2rGrB.js +0 -1
- zenml/zen_server/dashboard/assets/ComponentBadge-DUiEYJHu.js +0 -1
- zenml/zen_server/dashboard/assets/ComponentFallbackDialog-BFoH5K4V.js +0 -1
- zenml/zen_server/dashboard/assets/ComponentIcon-CAIoUis2.js +0 -1
- zenml/zen_server/dashboard/assets/Partials-YPBB3V4q.js +0 -1
- zenml/zen_server/dashboard/assets/ProviderIcon-Bb3Xha5A.js +0 -1
- zenml/zen_server/dashboard/assets/RunSelector-DCiL3M1c.js +0 -1
- zenml/zen_server/dashboard/assets/SearchField-DfUiGFVd.js +0 -1
- zenml/zen_server/dashboard/assets/Tick-CykQFPj2.js +0 -1
- zenml/zen_server/dashboard/assets/cloud-only-B-s_HMDm.js +0 -1
- zenml/zen_server/dashboard/assets/codespaces-BitYDX9d.gif +0 -0
- zenml/zen_server/dashboard/assets/create-stack-CEmaPZ4c.js +0 -1
- zenml/zen_server/dashboard/assets/delete-run-D-LKbGyz.js +0 -1
- zenml/zen_server/dashboard/assets/index-Bpmj40BI.js +0 -1
- zenml/zen_server/dashboard/assets/index-CbU4Ln_E.css +0 -1
- zenml/zen_server/dashboard/assets/index-DKPhqP2B.js +0 -1
- zenml/zen_server/dashboard/assets/page-BBpOxVcY.js +0 -1
- zenml/zen_server/dashboard/assets/page-BRInM1Lg.js +0 -1
- zenml/zen_server/dashboard/assets/page-BjjlMk7s.js +0 -1
- zenml/zen_server/dashboard/assets/page-Bvd7YH2A.js +0 -1
- zenml/zen_server/dashboard/assets/page-CT3Nep8W.js +0 -1
- zenml/zen_server/dashboard/assets/page-C_f47pBf.js +0 -1
- zenml/zen_server/dashboard/assets/page-Cmv8C_yM.js +0 -3
- zenml/zen_server/dashboard/assets/page-CyN2bdWG.js +0 -1
- zenml/zen_server/dashboard/assets/page-CzzXH4fs.js +0 -1
- zenml/zen_server/dashboard/assets/page-DTlGjgnG.js +0 -1
- zenml/zen_server/dashboard/assets/page-Dbpl86h0.js +0 -1
- zenml/zen_server/dashboard/assets/page-Ddgy6kDS.js +0 -1
- zenml/zen_server/dashboard/assets/page-DtCAfBLy.js +0 -9
- zenml/zen_server/dashboard/assets/page-Dx16z7nA.js +0 -1
- zenml/zen_server/dashboard/assets/page-McUyYbo1.js +0 -1
- zenml/zen_server/dashboard/assets/page-T1P3RyAR.js +0 -1
- zenml/zen_server/dashboard/assets/page-bKaULTGG.js +0 -1
- zenml/zen_server/dashboard/assets/page-sbXUJy9t.js +0 -1
- zenml/zen_server/dashboard/assets/sharedSchema-TMLu-nYQ.js +0 -14
- zenml/zen_server/dashboard/assets/stack-detail-query-xmYxSsUY.js +0 -1
- zenml/zen_server/dashboard/assets/url-D5le3J4q.js +0 -1
- zenml/zen_server/routers/run_metadata_endpoints.py +0 -96
- {zenml_nightly-0.68.1.dev20241103.dist-info → zenml_nightly-0.70.0.dev20241115.dist-info}/LICENSE +0 -0
- {zenml_nightly-0.68.1.dev20241103.dist-info → zenml_nightly-0.70.0.dev20241115.dist-info}/WHEEL +0 -0
- {zenml_nightly-0.68.1.dev20241103.dist-info → zenml_nightly-0.70.0.dev20241115.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,263 @@
|
|
1
|
+
# Copyright (c) ZenML GmbH 2024. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at:
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
12
|
+
# or implied. See the License for the specific language governing
|
13
|
+
# permissions and limitations under the License.
|
14
|
+
"""Implementation of the vLLM Model Deployer."""
|
15
|
+
|
16
|
+
import os
|
17
|
+
import shutil
|
18
|
+
from typing import ClassVar, Dict, Optional, Type, cast
|
19
|
+
from uuid import UUID
|
20
|
+
|
21
|
+
from zenml.config.global_config import GlobalConfiguration
|
22
|
+
from zenml.constants import DEFAULT_SERVICE_START_STOP_TIMEOUT
|
23
|
+
from zenml.integrations.vllm.flavors.vllm_model_deployer_flavor import (
|
24
|
+
VLLMModelDeployerConfig,
|
25
|
+
VLLMModelDeployerFlavor,
|
26
|
+
)
|
27
|
+
from zenml.integrations.vllm.services.vllm_deployment import (
|
28
|
+
VLLMDeploymentService,
|
29
|
+
VLLMServiceConfig,
|
30
|
+
)
|
31
|
+
from zenml.logger import get_logger
|
32
|
+
from zenml.model_deployers import BaseModelDeployer, BaseModelDeployerFlavor
|
33
|
+
from zenml.services.service import BaseService, ServiceConfig
|
34
|
+
from zenml.utils.io_utils import create_dir_recursive_if_not_exists
|
35
|
+
|
36
|
+
logger = get_logger(__name__)
|
37
|
+
|
38
|
+
|
39
|
+
class VLLMModelDeployer(BaseModelDeployer):
|
40
|
+
"""vLLM Inference Server."""
|
41
|
+
|
42
|
+
NAME: ClassVar[str] = "VLLM"
|
43
|
+
FLAVOR: ClassVar[Type[BaseModelDeployerFlavor]] = VLLMModelDeployerFlavor
|
44
|
+
|
45
|
+
_service_path: Optional[str] = None
|
46
|
+
|
47
|
+
@property
|
48
|
+
def config(self) -> VLLMModelDeployerConfig:
|
49
|
+
"""Returns the `VLLMModelDeployerConfig` config.
|
50
|
+
|
51
|
+
Returns:
|
52
|
+
The configuration.
|
53
|
+
"""
|
54
|
+
return cast(VLLMModelDeployerConfig, self._config)
|
55
|
+
|
56
|
+
@staticmethod
|
57
|
+
def get_service_path(id_: UUID) -> str:
|
58
|
+
"""Get the path where local vLLM service information is stored.
|
59
|
+
|
60
|
+
This includes the deployment service configuration, PID and log files
|
61
|
+
are stored.
|
62
|
+
|
63
|
+
Args:
|
64
|
+
id_: The ID of the vLLM model deployer.
|
65
|
+
|
66
|
+
Returns:
|
67
|
+
The service path.
|
68
|
+
"""
|
69
|
+
service_path = os.path.join(
|
70
|
+
GlobalConfiguration().local_stores_path,
|
71
|
+
str(id_),
|
72
|
+
)
|
73
|
+
create_dir_recursive_if_not_exists(service_path)
|
74
|
+
return service_path
|
75
|
+
|
76
|
+
@property
|
77
|
+
def local_path(self) -> str:
|
78
|
+
"""Returns the path to the root directory.
|
79
|
+
|
80
|
+
This is where all configurations for vLLM deployment daemon processes
|
81
|
+
are stored.
|
82
|
+
|
83
|
+
If the service path is not set in the config by the user, the path is
|
84
|
+
set to a local default path according to the component ID.
|
85
|
+
|
86
|
+
Returns:
|
87
|
+
The path to the local service root directory.
|
88
|
+
"""
|
89
|
+
if self._service_path is not None:
|
90
|
+
return self._service_path
|
91
|
+
|
92
|
+
if self.config.service_path:
|
93
|
+
self._service_path = self.config.service_path
|
94
|
+
else:
|
95
|
+
self._service_path = self.get_service_path(self.id)
|
96
|
+
|
97
|
+
create_dir_recursive_if_not_exists(self._service_path)
|
98
|
+
return self._service_path
|
99
|
+
|
100
|
+
@staticmethod
|
101
|
+
def get_model_server_info( # type: ignore[override]
|
102
|
+
service_instance: "VLLMDeploymentService",
|
103
|
+
) -> Dict[str, Optional[str]]:
|
104
|
+
"""Return implementation specific information on the model server.
|
105
|
+
|
106
|
+
Args:
|
107
|
+
service_instance: vLLM deployment service object
|
108
|
+
|
109
|
+
Returns:
|
110
|
+
A dictionary containing the model server information.
|
111
|
+
"""
|
112
|
+
return {
|
113
|
+
"HEALTH_CHECK_URL": service_instance.get_healthcheck_url(),
|
114
|
+
"PREDICTION_URL": service_instance.get_prediction_url(),
|
115
|
+
"SERVICE_PATH": service_instance.status.runtime_path,
|
116
|
+
"DAEMON_PID": str(service_instance.status.pid),
|
117
|
+
}
|
118
|
+
|
119
|
+
def perform_deploy_model(
|
120
|
+
self,
|
121
|
+
id: UUID,
|
122
|
+
config: ServiceConfig,
|
123
|
+
timeout: int = DEFAULT_SERVICE_START_STOP_TIMEOUT,
|
124
|
+
) -> BaseService:
|
125
|
+
"""Create a new vLLM deployment service or update an existing one.
|
126
|
+
|
127
|
+
This should serve the supplied model and deployment configuration.
|
128
|
+
|
129
|
+
This method has two modes of operation, depending on the `replace`
|
130
|
+
argument value:
|
131
|
+
|
132
|
+
* if `replace` is False, calling this method will create a new vLLM
|
133
|
+
deployment server to reflect the model and other configuration
|
134
|
+
parameters specified in the supplied vLLM service `config`.
|
135
|
+
|
136
|
+
* if `replace` is True, this method will first attempt to find an
|
137
|
+
existing vLLM deployment service that is *equivalent* to the
|
138
|
+
supplied configuration parameters. Two or more vLLM deployment
|
139
|
+
services are considered equivalent if they have the same
|
140
|
+
`pipeline_name`, `pipeline_step_name` and `model_name` configuration
|
141
|
+
parameters. To put it differently, two vLLM deployment services
|
142
|
+
are equivalent if they serve versions of the same model deployed by
|
143
|
+
the same pipeline step. If an equivalent vLLM deployment is found,
|
144
|
+
it will be updated in place to reflect the new configuration
|
145
|
+
parameters.
|
146
|
+
|
147
|
+
Callers should set `replace` to True if they want a continuous model
|
148
|
+
deployment workflow that doesn't spin up a new vLLM deployment
|
149
|
+
server for each new model version. If multiple equivalent vLLM
|
150
|
+
deployment servers are found, one is selected at random to be updated
|
151
|
+
and the others are deleted.
|
152
|
+
|
153
|
+
Args:
|
154
|
+
id: the UUID of the vLLM model deployer.
|
155
|
+
config: the configuration of the model to be deployed with vLLM.
|
156
|
+
timeout: the timeout in seconds to wait for the vLLM server
|
157
|
+
to be provisioned and successfully started or updated. If set
|
158
|
+
to 0, the method will return immediately after the vLLM
|
159
|
+
server is provisioned, without waiting for it to fully start.
|
160
|
+
|
161
|
+
Returns:
|
162
|
+
The ZenML vLLM deployment service object that can be used to
|
163
|
+
interact with the vLLM model http server.
|
164
|
+
"""
|
165
|
+
config = cast(VLLMServiceConfig, config)
|
166
|
+
service = self._create_new_service(
|
167
|
+
id=id, timeout=timeout, config=config
|
168
|
+
)
|
169
|
+
logger.info(f"Created a new vLLM deployment service: {service}")
|
170
|
+
return service
|
171
|
+
|
172
|
+
def _clean_up_existing_service(
|
173
|
+
self,
|
174
|
+
timeout: int,
|
175
|
+
force: bool,
|
176
|
+
existing_service: VLLMDeploymentService,
|
177
|
+
) -> None:
|
178
|
+
# stop the older service
|
179
|
+
existing_service.stop(timeout=timeout, force=force)
|
180
|
+
|
181
|
+
# delete the old configuration file
|
182
|
+
if existing_service.status.runtime_path:
|
183
|
+
shutil.rmtree(existing_service.status.runtime_path)
|
184
|
+
|
185
|
+
# the step will receive a config from the user that mentions the number
|
186
|
+
# of workers etc.the step implementation will create a new config using
|
187
|
+
# all values from the user and add values like pipeline name, model_uri
|
188
|
+
def _create_new_service(
|
189
|
+
self, id: UUID, timeout: int, config: VLLMServiceConfig
|
190
|
+
) -> VLLMDeploymentService:
|
191
|
+
"""Creates a new VLLMDeploymentService.
|
192
|
+
|
193
|
+
Args:
|
194
|
+
id: the ID of the vLLM deployment service to be created or updated.
|
195
|
+
timeout: the timeout in seconds to wait for the vLLM server
|
196
|
+
to be provisioned and successfully started or updated.
|
197
|
+
config: the configuration of the model to be deployed with vLLM.
|
198
|
+
|
199
|
+
Returns:
|
200
|
+
The VLLMDeploymentService object that can be used to interact
|
201
|
+
with the vLLM model server.
|
202
|
+
"""
|
203
|
+
# set the root runtime path with the stack component's UUID
|
204
|
+
config.root_runtime_path = self.local_path
|
205
|
+
# create a new service for the new model
|
206
|
+
service = VLLMDeploymentService(uuid=id, config=config)
|
207
|
+
service.start(timeout=timeout)
|
208
|
+
|
209
|
+
return service
|
210
|
+
|
211
|
+
def perform_stop_model(
|
212
|
+
self,
|
213
|
+
service: BaseService,
|
214
|
+
timeout: int = DEFAULT_SERVICE_START_STOP_TIMEOUT,
|
215
|
+
force: bool = False,
|
216
|
+
) -> BaseService:
|
217
|
+
"""Method to stop a model server.
|
218
|
+
|
219
|
+
Args:
|
220
|
+
service: The service to stop.
|
221
|
+
timeout: Timeout in seconds to wait for the service to stop.
|
222
|
+
force: If True, force the service to stop.
|
223
|
+
|
224
|
+
Returns:
|
225
|
+
The stopped service.
|
226
|
+
"""
|
227
|
+
service.stop(timeout=timeout, force=force)
|
228
|
+
return service
|
229
|
+
|
230
|
+
def perform_start_model(
|
231
|
+
self,
|
232
|
+
service: BaseService,
|
233
|
+
timeout: int = DEFAULT_SERVICE_START_STOP_TIMEOUT,
|
234
|
+
) -> BaseService:
|
235
|
+
"""Method to start a model server.
|
236
|
+
|
237
|
+
Args:
|
238
|
+
service: The service to start.
|
239
|
+
timeout: Timeout in seconds to wait for the service to start.
|
240
|
+
|
241
|
+
Returns:
|
242
|
+
The started service.
|
243
|
+
"""
|
244
|
+
service.start(timeout=timeout)
|
245
|
+
return service
|
246
|
+
|
247
|
+
def perform_delete_model(
|
248
|
+
self,
|
249
|
+
service: BaseService,
|
250
|
+
timeout: int = DEFAULT_SERVICE_START_STOP_TIMEOUT,
|
251
|
+
force: bool = False,
|
252
|
+
) -> None:
|
253
|
+
"""Method to delete all configuration of a model server.
|
254
|
+
|
255
|
+
Args:
|
256
|
+
service: The service to delete.
|
257
|
+
timeout: Timeout in seconds to wait for the service to stop.
|
258
|
+
force: If True, force the service to stop.
|
259
|
+
"""
|
260
|
+
service = cast(VLLMDeploymentService, service)
|
261
|
+
self._clean_up_existing_service(
|
262
|
+
existing_service=service, timeout=timeout, force=force
|
263
|
+
)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Copyright (c) ZenML GmbH 2024. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at:
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
12
|
+
# or implied. See the License for the specific language governing
|
13
|
+
# permissions and limitations under the License.
|
14
|
+
"""Initialization of the vLLM Inference Server."""
|
15
|
+
|
16
|
+
from zenml.integrations.vllm.services.vllm_deployment import ( # noqa
|
17
|
+
VLLMDeploymentService,
|
18
|
+
VLLMServiceConfig,
|
19
|
+
)
|
@@ -0,0 +1,206 @@
|
|
1
|
+
# Copyright (c) ZenML GmbH 2024. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at:
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
12
|
+
# or implied. See the License for the specific language governing
|
13
|
+
# permissions and limitations under the License.
|
14
|
+
"""Implementation of the vLLM Inference Server Service."""
|
15
|
+
|
16
|
+
import argparse
|
17
|
+
import os
|
18
|
+
from typing import Any, List, Optional, Union
|
19
|
+
|
20
|
+
from zenml.constants import DEFAULT_LOCAL_SERVICE_IP_ADDRESS
|
21
|
+
from zenml.logger import get_logger
|
22
|
+
from zenml.services import (
|
23
|
+
HTTPEndpointHealthMonitor,
|
24
|
+
HTTPEndpointHealthMonitorConfig,
|
25
|
+
LocalDaemonService,
|
26
|
+
LocalDaemonServiceConfig,
|
27
|
+
LocalDaemonServiceEndpoint,
|
28
|
+
LocalDaemonServiceEndpointConfig,
|
29
|
+
ServiceEndpointProtocol,
|
30
|
+
ServiceType,
|
31
|
+
)
|
32
|
+
from zenml.services.service import BaseDeploymentService
|
33
|
+
|
34
|
+
logger = get_logger(__name__)
|
35
|
+
|
36
|
+
|
37
|
+
VLLM_PREDICTION_URL_PATH = "v1"
|
38
|
+
VLLM_HEALTHCHECK_URL_PATH = "health"
|
39
|
+
|
40
|
+
|
41
|
+
class VLLMDeploymentEndpointConfig(LocalDaemonServiceEndpointConfig):
|
42
|
+
"""vLLM deployment service configuration.
|
43
|
+
|
44
|
+
Attributes:
|
45
|
+
prediction_url_path: URI subpath for prediction requests
|
46
|
+
"""
|
47
|
+
|
48
|
+
prediction_url_path: str
|
49
|
+
|
50
|
+
|
51
|
+
class VLLMDeploymentEndpoint(LocalDaemonServiceEndpoint):
|
52
|
+
"""A service endpoint exposed by the vLLM deployment daemon.
|
53
|
+
|
54
|
+
Attributes:
|
55
|
+
config: service endpoint configuration
|
56
|
+
"""
|
57
|
+
|
58
|
+
config: VLLMDeploymentEndpointConfig
|
59
|
+
monitor: HTTPEndpointHealthMonitor
|
60
|
+
|
61
|
+
@property
|
62
|
+
def prediction_url(self) -> Optional[str]:
|
63
|
+
"""Gets the prediction URL for the endpoint.
|
64
|
+
|
65
|
+
Returns:
|
66
|
+
the prediction URL for the endpoint
|
67
|
+
"""
|
68
|
+
uri = self.status.uri
|
69
|
+
if not uri:
|
70
|
+
return None
|
71
|
+
return os.path.join(uri, self.config.prediction_url_path)
|
72
|
+
|
73
|
+
|
74
|
+
class VLLMServiceConfig(LocalDaemonServiceConfig):
|
75
|
+
"""vLLM service configurations."""
|
76
|
+
|
77
|
+
model: str
|
78
|
+
port: int
|
79
|
+
host: Optional[str] = None
|
80
|
+
blocking: bool = True
|
81
|
+
# If unspecified, model name or path will be used.
|
82
|
+
tokenizer: Optional[str] = None
|
83
|
+
served_model_name: Optional[Union[str, List[str]]] = None
|
84
|
+
# Trust remote code from huggingface.
|
85
|
+
trust_remote_code: Optional[bool] = False
|
86
|
+
# ['auto', 'slow', 'mistral']
|
87
|
+
tokenizer_mode: Optional[str] = "auto"
|
88
|
+
# ['auto', 'half', 'float16', 'bfloat16', 'float', 'float32']
|
89
|
+
dtype: Optional[str] = "auto"
|
90
|
+
# The specific model version to use. It can be a branch name, a tag name, or a commit id.
|
91
|
+
# If unspecified, will use the default version.
|
92
|
+
revision: Optional[str] = None
|
93
|
+
|
94
|
+
|
95
|
+
class VLLMDeploymentService(LocalDaemonService, BaseDeploymentService):
|
96
|
+
"""vLLM Inference Server Deployment Service."""
|
97
|
+
|
98
|
+
SERVICE_TYPE = ServiceType(
|
99
|
+
name="vllm-deployment",
|
100
|
+
type="model-serving",
|
101
|
+
flavor="vllm",
|
102
|
+
description="vLLM Inference prediction service",
|
103
|
+
)
|
104
|
+
config: VLLMServiceConfig
|
105
|
+
endpoint: VLLMDeploymentEndpoint
|
106
|
+
|
107
|
+
def __init__(self, config: VLLMServiceConfig, **attrs: Any):
|
108
|
+
"""Initialize the vLLM deployment service.
|
109
|
+
|
110
|
+
Args:
|
111
|
+
config: service configuration
|
112
|
+
attrs: additional attributes to set on the service
|
113
|
+
"""
|
114
|
+
if isinstance(config, VLLMServiceConfig) and "endpoint" not in attrs:
|
115
|
+
endpoint = VLLMDeploymentEndpoint(
|
116
|
+
config=VLLMDeploymentEndpointConfig(
|
117
|
+
protocol=ServiceEndpointProtocol.HTTP,
|
118
|
+
port=config.port,
|
119
|
+
ip_address=config.host or DEFAULT_LOCAL_SERVICE_IP_ADDRESS,
|
120
|
+
prediction_url_path=VLLM_PREDICTION_URL_PATH,
|
121
|
+
),
|
122
|
+
monitor=HTTPEndpointHealthMonitor(
|
123
|
+
config=HTTPEndpointHealthMonitorConfig(
|
124
|
+
healthcheck_uri_path=VLLM_HEALTHCHECK_URL_PATH,
|
125
|
+
)
|
126
|
+
),
|
127
|
+
)
|
128
|
+
attrs["endpoint"] = endpoint
|
129
|
+
super().__init__(config=config, **attrs)
|
130
|
+
|
131
|
+
def run(self) -> None:
|
132
|
+
"""Start the service."""
|
133
|
+
logger.info(
|
134
|
+
"Starting vLLM inference server service as blocking "
|
135
|
+
"process... press CTRL+C once to stop it."
|
136
|
+
)
|
137
|
+
|
138
|
+
self.endpoint.prepare_for_start()
|
139
|
+
|
140
|
+
import uvloop
|
141
|
+
from vllm.entrypoints.openai.api_server import (
|
142
|
+
run_server,
|
143
|
+
)
|
144
|
+
from vllm.entrypoints.openai.cli_args import (
|
145
|
+
make_arg_parser,
|
146
|
+
)
|
147
|
+
from vllm.utils import (
|
148
|
+
FlexibleArgumentParser,
|
149
|
+
)
|
150
|
+
|
151
|
+
try:
|
152
|
+
parser: argparse.ArgumentParser = make_arg_parser(
|
153
|
+
FlexibleArgumentParser()
|
154
|
+
)
|
155
|
+
args: argparse.Namespace = parser.parse_args()
|
156
|
+
# Override port with the available port
|
157
|
+
self.config.port = self.endpoint.status.port or self.config.port
|
158
|
+
# Update the arguments in place
|
159
|
+
args.__dict__.update(self.config.model_dump())
|
160
|
+
uvloop.run(run_server(args=args))
|
161
|
+
except KeyboardInterrupt:
|
162
|
+
logger.info("Stopping vLLM prediction service...")
|
163
|
+
|
164
|
+
@property
|
165
|
+
def prediction_url(self) -> Optional[str]:
|
166
|
+
"""Gets the prediction URL for the endpoint.
|
167
|
+
|
168
|
+
Returns:
|
169
|
+
the prediction URL for the endpoint
|
170
|
+
"""
|
171
|
+
if not self.is_running:
|
172
|
+
return None
|
173
|
+
return self.endpoint.prediction_url
|
174
|
+
|
175
|
+
def predict(self, data: "Any") -> "Any":
|
176
|
+
"""Make a prediction using the service.
|
177
|
+
|
178
|
+
Args:
|
179
|
+
data: data to make a prediction on
|
180
|
+
|
181
|
+
Returns:
|
182
|
+
The prediction result.
|
183
|
+
|
184
|
+
Raises:
|
185
|
+
Exception: if the service is not running
|
186
|
+
ValueError: if the prediction endpoint is unknown.
|
187
|
+
"""
|
188
|
+
if not self.is_running:
|
189
|
+
raise Exception(
|
190
|
+
"vLLM Inference service is not running. "
|
191
|
+
"Please start the service before making predictions."
|
192
|
+
)
|
193
|
+
if self.endpoint.prediction_url is not None:
|
194
|
+
from openai import OpenAI
|
195
|
+
|
196
|
+
client = OpenAI(
|
197
|
+
api_key="EMPTY",
|
198
|
+
base_url=self.endpoint.prediction_url,
|
199
|
+
)
|
200
|
+
models = client.models.list()
|
201
|
+
model = models.data[0].id
|
202
|
+
result = client.completions.create(model=model, prompt=data)
|
203
|
+
# TODO: We can add support for client.chat.completions.create
|
204
|
+
else:
|
205
|
+
raise ValueError("No endpoint known for prediction.")
|
206
|
+
return result
|
@@ -14,7 +14,6 @@
|
|
14
14
|
"""Implementation of the whylogs materializer."""
|
15
15
|
|
16
16
|
import os
|
17
|
-
import tempfile
|
18
17
|
from typing import Any, ClassVar, Dict, Tuple, Type, cast
|
19
18
|
|
20
19
|
from whylogs.core import DatasetProfileView # type: ignore
|
@@ -51,18 +50,14 @@ class WhylogsMaterializer(BaseMaterializer):
|
|
51
50
|
"""
|
52
51
|
filepath = os.path.join(self.uri, PROFILE_FILENAME)
|
53
52
|
|
54
|
-
|
55
|
-
|
56
|
-
temp_file = os.path.join(str(temp_dir), PROFILE_FILENAME)
|
53
|
+
with self.get_temporary_directory(delete_at_exit=True) as temp_dir:
|
54
|
+
temp_file = os.path.join(str(temp_dir), PROFILE_FILENAME)
|
57
55
|
|
58
|
-
|
59
|
-
|
60
|
-
|
56
|
+
# Copy from artifact store to temporary file
|
57
|
+
fileio.copy(filepath, temp_file)
|
58
|
+
profile_view = DatasetProfileView.read(temp_file)
|
61
59
|
|
62
|
-
|
63
|
-
fileio.rmtree(temp_dir)
|
64
|
-
|
65
|
-
return profile_view
|
60
|
+
return profile_view
|
66
61
|
|
67
62
|
def save(self, profile_view: DatasetProfileView) -> None:
|
68
63
|
"""Writes a whylogs dataset profile view.
|
@@ -72,15 +67,13 @@ class WhylogsMaterializer(BaseMaterializer):
|
|
72
67
|
"""
|
73
68
|
filepath = os.path.join(self.uri, PROFILE_FILENAME)
|
74
69
|
|
75
|
-
|
76
|
-
|
77
|
-
temp_file = os.path.join(str(temp_dir), PROFILE_FILENAME)
|
70
|
+
with self.get_temporary_directory(delete_at_exit=True) as temp_dir:
|
71
|
+
temp_file = os.path.join(str(temp_dir), PROFILE_FILENAME)
|
78
72
|
|
79
|
-
|
73
|
+
profile_view.write(temp_file)
|
80
74
|
|
81
|
-
|
82
|
-
|
83
|
-
fileio.rmtree(temp_dir)
|
75
|
+
# Copy it into artifact store
|
76
|
+
fileio.copy(temp_file, filepath)
|
84
77
|
|
85
78
|
try:
|
86
79
|
self._upload_to_whylabs(profile_view)
|
@@ -14,7 +14,6 @@
|
|
14
14
|
"""Implementation of an XGBoost booster materializer."""
|
15
15
|
|
16
16
|
import os
|
17
|
-
import tempfile
|
18
17
|
from typing import Any, ClassVar, Tuple, Type
|
19
18
|
|
20
19
|
import xgboost as xgb
|
@@ -43,18 +42,15 @@ class XgboostBoosterMaterializer(BaseMaterializer):
|
|
43
42
|
"""
|
44
43
|
filepath = os.path.join(self.uri, DEFAULT_FILENAME)
|
45
44
|
|
46
|
-
|
47
|
-
|
48
|
-
temp_file = os.path.join(str(temp_dir), DEFAULT_FILENAME)
|
45
|
+
with self.get_temporary_directory(delete_at_exit=True) as temp_dir:
|
46
|
+
temp_file = os.path.join(str(temp_dir), DEFAULT_FILENAME)
|
49
47
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
48
|
+
# Copy from artifact store to temporary file
|
49
|
+
fileio.copy(filepath, temp_file)
|
50
|
+
booster = xgb.Booster()
|
51
|
+
booster.load_model(temp_file)
|
54
52
|
|
55
|
-
|
56
|
-
fileio.rmtree(temp_dir)
|
57
|
-
return booster
|
53
|
+
return booster
|
58
54
|
|
59
55
|
def save(self, booster: xgb.Booster) -> None:
|
60
56
|
"""Creates a JSON serialization for a xgboost Booster model.
|
@@ -64,14 +60,7 @@ class XgboostBoosterMaterializer(BaseMaterializer):
|
|
64
60
|
"""
|
65
61
|
filepath = os.path.join(self.uri, DEFAULT_FILENAME)
|
66
62
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
booster.save_model(f.name)
|
72
|
-
# Copy it into artifact store
|
73
|
-
fileio.copy(f.name, filepath)
|
74
|
-
|
75
|
-
# Close and remove the temporary file
|
76
|
-
f.close()
|
77
|
-
fileio.remove(f.name)
|
63
|
+
with self.get_temporary_directory(delete_at_exit=True) as temp_dir:
|
64
|
+
temp_file = os.path.join(str(temp_dir), DEFAULT_FILENAME)
|
65
|
+
booster.save_model(temp_file)
|
66
|
+
fileio.copy(temp_file, filepath)
|
@@ -14,7 +14,6 @@
|
|
14
14
|
"""Implementation of the XGBoost dmatrix materializer."""
|
15
15
|
|
16
16
|
import os
|
17
|
-
import tempfile
|
18
17
|
from typing import TYPE_CHECKING, Any, ClassVar, Dict, Tuple, Type
|
19
18
|
|
20
19
|
import xgboost as xgb
|
@@ -46,17 +45,14 @@ class XgboostDMatrixMaterializer(BaseMaterializer):
|
|
46
45
|
"""
|
47
46
|
filepath = os.path.join(self.uri, DEFAULT_FILENAME)
|
48
47
|
|
49
|
-
|
50
|
-
|
51
|
-
temp_file = os.path.join(str(temp_dir), DEFAULT_FILENAME)
|
48
|
+
with self.get_temporary_directory(delete_at_exit=True) as temp_dir:
|
49
|
+
temp_file = os.path.join(str(temp_dir), DEFAULT_FILENAME)
|
52
50
|
|
53
|
-
|
54
|
-
|
55
|
-
|
51
|
+
# Copy from artifact store to temporary file
|
52
|
+
fileio.copy(filepath, temp_file)
|
53
|
+
matrix = xgb.DMatrix(temp_file)
|
56
54
|
|
57
|
-
|
58
|
-
fileio.rmtree(temp_dir)
|
59
|
-
return matrix
|
55
|
+
return matrix
|
60
56
|
|
61
57
|
def save(self, matrix: xgb.DMatrix) -> None:
|
62
58
|
"""Creates a binary serialization for a xgboost.DMatrix object.
|
@@ -66,15 +62,10 @@ class XgboostDMatrixMaterializer(BaseMaterializer):
|
|
66
62
|
"""
|
67
63
|
filepath = os.path.join(self.uri, DEFAULT_FILENAME)
|
68
64
|
|
69
|
-
|
70
|
-
|
71
|
-
matrix.save_binary(
|
72
|
-
|
73
|
-
fileio.copy(f.name, filepath)
|
74
|
-
|
75
|
-
# Close and remove the temporary file
|
76
|
-
f.close()
|
77
|
-
fileio.remove(f.name)
|
65
|
+
with self.get_temporary_directory(delete_at_exit=True) as temp_dir:
|
66
|
+
temp_file = os.path.join(str(temp_dir), DEFAULT_FILENAME)
|
67
|
+
matrix.save_binary(temp_file)
|
68
|
+
fileio.copy(temp_file, filepath)
|
78
69
|
|
79
70
|
def extract_metadata(
|
80
71
|
self, dataset: xgb.DMatrix
|