oracle-ads 2.13.9rc0__py3-none-any.whl → 2.13.9rc1__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.
- ads/aqua/__init__.py +40 -0
- ads/aqua/app.py +506 -0
- ads/aqua/cli.py +96 -0
- ads/aqua/client/__init__.py +3 -0
- ads/aqua/client/client.py +836 -0
- ads/aqua/client/openai_client.py +305 -0
- ads/aqua/common/__init__.py +5 -0
- ads/aqua/common/decorator.py +125 -0
- ads/aqua/common/entities.py +269 -0
- ads/aqua/common/enums.py +122 -0
- ads/aqua/common/errors.py +109 -0
- ads/aqua/common/utils.py +1285 -0
- ads/aqua/config/__init__.py +4 -0
- ads/aqua/config/container_config.py +248 -0
- ads/aqua/config/evaluation/__init__.py +4 -0
- ads/aqua/config/evaluation/evaluation_service_config.py +147 -0
- ads/aqua/config/utils/__init__.py +4 -0
- ads/aqua/config/utils/serializer.py +339 -0
- ads/aqua/constants.py +116 -0
- ads/aqua/data.py +14 -0
- ads/aqua/dummy_data/icon.txt +1 -0
- ads/aqua/dummy_data/oci_model_deployments.json +56 -0
- ads/aqua/dummy_data/oci_models.json +1 -0
- ads/aqua/dummy_data/readme.md +26 -0
- ads/aqua/evaluation/__init__.py +8 -0
- ads/aqua/evaluation/constants.py +53 -0
- ads/aqua/evaluation/entities.py +186 -0
- ads/aqua/evaluation/errors.py +70 -0
- ads/aqua/evaluation/evaluation.py +1814 -0
- ads/aqua/extension/__init__.py +42 -0
- ads/aqua/extension/aqua_ws_msg_handler.py +76 -0
- ads/aqua/extension/base_handler.py +90 -0
- ads/aqua/extension/common_handler.py +121 -0
- ads/aqua/extension/common_ws_msg_handler.py +36 -0
- ads/aqua/extension/deployment_handler.py +298 -0
- ads/aqua/extension/deployment_ws_msg_handler.py +54 -0
- ads/aqua/extension/errors.py +30 -0
- ads/aqua/extension/evaluation_handler.py +129 -0
- ads/aqua/extension/evaluation_ws_msg_handler.py +61 -0
- ads/aqua/extension/finetune_handler.py +96 -0
- ads/aqua/extension/model_handler.py +390 -0
- ads/aqua/extension/models/__init__.py +0 -0
- ads/aqua/extension/models/ws_models.py +145 -0
- ads/aqua/extension/models_ws_msg_handler.py +50 -0
- ads/aqua/extension/ui_handler.py +282 -0
- ads/aqua/extension/ui_websocket_handler.py +130 -0
- ads/aqua/extension/utils.py +133 -0
- ads/aqua/finetuning/__init__.py +7 -0
- ads/aqua/finetuning/constants.py +23 -0
- ads/aqua/finetuning/entities.py +181 -0
- ads/aqua/finetuning/finetuning.py +749 -0
- ads/aqua/model/__init__.py +8 -0
- ads/aqua/model/constants.py +60 -0
- ads/aqua/model/entities.py +385 -0
- ads/aqua/model/enums.py +32 -0
- ads/aqua/model/model.py +2114 -0
- ads/aqua/modeldeployment/__init__.py +8 -0
- ads/aqua/modeldeployment/constants.py +10 -0
- ads/aqua/modeldeployment/deployment.py +1326 -0
- ads/aqua/modeldeployment/entities.py +653 -0
- ads/aqua/modeldeployment/inference.py +74 -0
- ads/aqua/modeldeployment/utils.py +543 -0
- ads/aqua/resources/gpu_shapes_index.json +94 -0
- ads/aqua/server/__init__.py +4 -0
- ads/aqua/server/__main__.py +24 -0
- ads/aqua/server/app.py +47 -0
- ads/aqua/server/aqua_spec.yml +1291 -0
- ads/aqua/training/__init__.py +4 -0
- ads/aqua/training/exceptions.py +476 -0
- ads/aqua/ui.py +499 -0
- ads/automl/__init__.py +9 -0
- ads/automl/driver.py +330 -0
- ads/automl/provider.py +975 -0
- ads/bds/__init__.py +5 -0
- ads/bds/auth.py +127 -0
- ads/bds/big_data_service.py +255 -0
- ads/catalog/__init__.py +19 -0
- ads/catalog/model.py +1576 -0
- ads/catalog/notebook.py +461 -0
- ads/catalog/project.py +468 -0
- ads/catalog/summary.py +178 -0
- ads/common/__init__.py +11 -0
- ads/common/analyzer.py +65 -0
- ads/common/artifact/.model-ignore +63 -0
- ads/common/artifact/__init__.py +10 -0
- ads/common/auth.py +1122 -0
- ads/common/card_identifier.py +83 -0
- ads/common/config.py +647 -0
- ads/common/data.py +165 -0
- ads/common/decorator/__init__.py +9 -0
- ads/common/decorator/argument_to_case.py +88 -0
- ads/common/decorator/deprecate.py +69 -0
- ads/common/decorator/require_nonempty_arg.py +65 -0
- ads/common/decorator/runtime_dependency.py +178 -0
- ads/common/decorator/threaded.py +97 -0
- ads/common/decorator/utils.py +35 -0
- ads/common/dsc_file_system.py +303 -0
- ads/common/error.py +14 -0
- ads/common/extended_enum.py +81 -0
- ads/common/function/__init__.py +5 -0
- ads/common/function/fn_util.py +142 -0
- ads/common/function/func_conf.yaml +25 -0
- ads/common/ipython.py +76 -0
- ads/common/model.py +679 -0
- ads/common/model_artifact.py +1759 -0
- ads/common/model_artifact_schema.json +107 -0
- ads/common/model_export_util.py +664 -0
- ads/common/model_metadata.py +24 -0
- ads/common/object_storage_details.py +296 -0
- ads/common/oci_client.py +175 -0
- ads/common/oci_datascience.py +46 -0
- ads/common/oci_logging.py +1144 -0
- ads/common/oci_mixin.py +957 -0
- ads/common/oci_resource.py +136 -0
- ads/common/serializer.py +559 -0
- ads/common/utils.py +1852 -0
- ads/common/word_lists.py +1491 -0
- ads/common/work_request.py +189 -0
- ads/data_labeling/__init__.py +13 -0
- ads/data_labeling/boundingbox.py +253 -0
- ads/data_labeling/constants.py +47 -0
- ads/data_labeling/data_labeling_service.py +244 -0
- ads/data_labeling/interface/__init__.py +5 -0
- ads/data_labeling/interface/loader.py +16 -0
- ads/data_labeling/interface/parser.py +16 -0
- ads/data_labeling/interface/reader.py +23 -0
- ads/data_labeling/loader/__init__.py +5 -0
- ads/data_labeling/loader/file_loader.py +241 -0
- ads/data_labeling/metadata.py +110 -0
- ads/data_labeling/mixin/__init__.py +5 -0
- ads/data_labeling/mixin/data_labeling.py +232 -0
- ads/data_labeling/ner.py +129 -0
- ads/data_labeling/parser/__init__.py +5 -0
- ads/data_labeling/parser/dls_record_parser.py +388 -0
- ads/data_labeling/parser/export_metadata_parser.py +94 -0
- ads/data_labeling/parser/export_record_parser.py +473 -0
- ads/data_labeling/reader/__init__.py +5 -0
- ads/data_labeling/reader/dataset_reader.py +574 -0
- ads/data_labeling/reader/dls_record_reader.py +121 -0
- ads/data_labeling/reader/export_record_reader.py +62 -0
- ads/data_labeling/reader/jsonl_reader.py +75 -0
- ads/data_labeling/reader/metadata_reader.py +203 -0
- ads/data_labeling/reader/record_reader.py +263 -0
- ads/data_labeling/record.py +52 -0
- ads/data_labeling/visualizer/__init__.py +5 -0
- ads/data_labeling/visualizer/image_visualizer.py +525 -0
- ads/data_labeling/visualizer/text_visualizer.py +357 -0
- ads/database/__init__.py +5 -0
- ads/database/connection.py +338 -0
- ads/dataset/__init__.py +10 -0
- ads/dataset/capabilities.md +51 -0
- ads/dataset/classification_dataset.py +339 -0
- ads/dataset/correlation.py +226 -0
- ads/dataset/correlation_plot.py +563 -0
- ads/dataset/dask_series.py +173 -0
- ads/dataset/dataframe_transformer.py +110 -0
- ads/dataset/dataset.py +1979 -0
- ads/dataset/dataset_browser.py +360 -0
- ads/dataset/dataset_with_target.py +995 -0
- ads/dataset/exception.py +25 -0
- ads/dataset/factory.py +987 -0
- ads/dataset/feature_engineering_transformer.py +35 -0
- ads/dataset/feature_selection.py +107 -0
- ads/dataset/forecasting_dataset.py +26 -0
- ads/dataset/helper.py +1450 -0
- ads/dataset/label_encoder.py +99 -0
- ads/dataset/mixin/__init__.py +5 -0
- ads/dataset/mixin/dataset_accessor.py +134 -0
- ads/dataset/pipeline.py +58 -0
- ads/dataset/plot.py +710 -0
- ads/dataset/progress.py +86 -0
- ads/dataset/recommendation.py +297 -0
- ads/dataset/recommendation_transformer.py +502 -0
- ads/dataset/regression_dataset.py +14 -0
- ads/dataset/sampled_dataset.py +1050 -0
- ads/dataset/target.py +98 -0
- ads/dataset/timeseries.py +18 -0
- ads/dbmixin/__init__.py +5 -0
- ads/dbmixin/db_pandas_accessor.py +153 -0
- ads/environment/__init__.py +9 -0
- ads/environment/ml_runtime.py +66 -0
- ads/evaluations/README.md +14 -0
- ads/evaluations/__init__.py +109 -0
- ads/evaluations/evaluation_plot.py +983 -0
- ads/evaluations/evaluator.py +1334 -0
- ads/evaluations/statistical_metrics.py +543 -0
- ads/experiments/__init__.py +9 -0
- ads/experiments/capabilities.md +0 -0
- ads/explanations/__init__.py +21 -0
- ads/explanations/base_explainer.py +142 -0
- ads/explanations/capabilities.md +83 -0
- ads/explanations/explainer.py +190 -0
- ads/explanations/mlx_global_explainer.py +1050 -0
- ads/explanations/mlx_interface.py +386 -0
- ads/explanations/mlx_local_explainer.py +287 -0
- ads/explanations/mlx_whatif_explainer.py +201 -0
- ads/feature_engineering/__init__.py +20 -0
- ads/feature_engineering/accessor/__init__.py +5 -0
- ads/feature_engineering/accessor/dataframe_accessor.py +535 -0
- ads/feature_engineering/accessor/mixin/__init__.py +5 -0
- ads/feature_engineering/accessor/mixin/correlation.py +166 -0
- ads/feature_engineering/accessor/mixin/eda_mixin.py +266 -0
- ads/feature_engineering/accessor/mixin/eda_mixin_series.py +85 -0
- ads/feature_engineering/accessor/mixin/feature_types_mixin.py +211 -0
- ads/feature_engineering/accessor/mixin/utils.py +65 -0
- ads/feature_engineering/accessor/series_accessor.py +431 -0
- ads/feature_engineering/adsimage/__init__.py +5 -0
- ads/feature_engineering/adsimage/image.py +192 -0
- ads/feature_engineering/adsimage/image_reader.py +170 -0
- ads/feature_engineering/adsimage/interface/__init__.py +5 -0
- ads/feature_engineering/adsimage/interface/reader.py +19 -0
- ads/feature_engineering/adsstring/__init__.py +7 -0
- ads/feature_engineering/adsstring/oci_language/__init__.py +8 -0
- ads/feature_engineering/adsstring/string/__init__.py +8 -0
- ads/feature_engineering/data_schema.json +57 -0
- ads/feature_engineering/dataset/__init__.py +5 -0
- ads/feature_engineering/dataset/zip_code_data.py +42062 -0
- ads/feature_engineering/exceptions.py +40 -0
- ads/feature_engineering/feature_type/__init__.py +133 -0
- ads/feature_engineering/feature_type/address.py +184 -0
- ads/feature_engineering/feature_type/adsstring/__init__.py +5 -0
- ads/feature_engineering/feature_type/adsstring/common_regex_mixin.py +164 -0
- ads/feature_engineering/feature_type/adsstring/oci_language.py +93 -0
- ads/feature_engineering/feature_type/adsstring/parsers/__init__.py +5 -0
- ads/feature_engineering/feature_type/adsstring/parsers/base.py +47 -0
- ads/feature_engineering/feature_type/adsstring/parsers/nltk_parser.py +96 -0
- ads/feature_engineering/feature_type/adsstring/parsers/spacy_parser.py +221 -0
- ads/feature_engineering/feature_type/adsstring/string.py +258 -0
- ads/feature_engineering/feature_type/base.py +58 -0
- ads/feature_engineering/feature_type/boolean.py +183 -0
- ads/feature_engineering/feature_type/category.py +146 -0
- ads/feature_engineering/feature_type/constant.py +137 -0
- ads/feature_engineering/feature_type/continuous.py +151 -0
- ads/feature_engineering/feature_type/creditcard.py +314 -0
- ads/feature_engineering/feature_type/datetime.py +190 -0
- ads/feature_engineering/feature_type/discrete.py +134 -0
- ads/feature_engineering/feature_type/document.py +43 -0
- ads/feature_engineering/feature_type/gis.py +251 -0
- ads/feature_engineering/feature_type/handler/__init__.py +5 -0
- ads/feature_engineering/feature_type/handler/feature_validator.py +524 -0
- ads/feature_engineering/feature_type/handler/feature_warning.py +319 -0
- ads/feature_engineering/feature_type/handler/warnings.py +128 -0
- ads/feature_engineering/feature_type/integer.py +142 -0
- ads/feature_engineering/feature_type/ip_address.py +144 -0
- ads/feature_engineering/feature_type/ip_address_v4.py +138 -0
- ads/feature_engineering/feature_type/ip_address_v6.py +138 -0
- ads/feature_engineering/feature_type/lat_long.py +256 -0
- ads/feature_engineering/feature_type/object.py +43 -0
- ads/feature_engineering/feature_type/ordinal.py +132 -0
- ads/feature_engineering/feature_type/phone_number.py +135 -0
- ads/feature_engineering/feature_type/string.py +171 -0
- ads/feature_engineering/feature_type/text.py +93 -0
- ads/feature_engineering/feature_type/unknown.py +43 -0
- ads/feature_engineering/feature_type/zip_code.py +164 -0
- ads/feature_engineering/feature_type_manager.py +406 -0
- ads/feature_engineering/schema.py +795 -0
- ads/feature_engineering/utils.py +245 -0
- ads/feature_store/.readthedocs.yaml +19 -0
- ads/feature_store/README.md +65 -0
- ads/feature_store/__init__.py +9 -0
- ads/feature_store/common/__init__.py +0 -0
- ads/feature_store/common/enums.py +339 -0
- ads/feature_store/common/exceptions.py +18 -0
- ads/feature_store/common/spark_session_singleton.py +125 -0
- ads/feature_store/common/utils/__init__.py +0 -0
- ads/feature_store/common/utils/base64_encoder_decoder.py +72 -0
- ads/feature_store/common/utils/feature_schema_mapper.py +283 -0
- ads/feature_store/common/utils/transformation_utils.py +82 -0
- ads/feature_store/common/utils/utility.py +403 -0
- ads/feature_store/data_validation/__init__.py +0 -0
- ads/feature_store/data_validation/great_expectation.py +129 -0
- ads/feature_store/dataset.py +1230 -0
- ads/feature_store/dataset_job.py +530 -0
- ads/feature_store/docs/Dockerfile +7 -0
- ads/feature_store/docs/Makefile +44 -0
- ads/feature_store/docs/conf.py +28 -0
- ads/feature_store/docs/requirements.txt +14 -0
- ads/feature_store/docs/source/ads.feature_store.query.rst +20 -0
- ads/feature_store/docs/source/cicd.rst +137 -0
- ads/feature_store/docs/source/conf.py +86 -0
- ads/feature_store/docs/source/data_versioning.rst +33 -0
- ads/feature_store/docs/source/dataset.rst +388 -0
- ads/feature_store/docs/source/dataset_job.rst +27 -0
- ads/feature_store/docs/source/demo.rst +70 -0
- ads/feature_store/docs/source/entity.rst +78 -0
- ads/feature_store/docs/source/feature_group.rst +624 -0
- ads/feature_store/docs/source/feature_group_job.rst +29 -0
- ads/feature_store/docs/source/feature_store.rst +122 -0
- ads/feature_store/docs/source/feature_store_class.rst +123 -0
- ads/feature_store/docs/source/feature_validation.rst +66 -0
- ads/feature_store/docs/source/figures/cicd.png +0 -0
- ads/feature_store/docs/source/figures/data_validation.png +0 -0
- ads/feature_store/docs/source/figures/data_versioning.png +0 -0
- ads/feature_store/docs/source/figures/dataset.gif +0 -0
- ads/feature_store/docs/source/figures/dataset.png +0 -0
- ads/feature_store/docs/source/figures/dataset_lineage.png +0 -0
- ads/feature_store/docs/source/figures/dataset_statistics.png +0 -0
- ads/feature_store/docs/source/figures/dataset_statistics_viz.png +0 -0
- ads/feature_store/docs/source/figures/dataset_validation_results.png +0 -0
- ads/feature_store/docs/source/figures/dataset_validation_summary.png +0 -0
- ads/feature_store/docs/source/figures/drift_monitoring.png +0 -0
- ads/feature_store/docs/source/figures/entity.png +0 -0
- ads/feature_store/docs/source/figures/feature_group.png +0 -0
- ads/feature_store/docs/source/figures/feature_group_lineage.png +0 -0
- ads/feature_store/docs/source/figures/feature_group_statistics_viz.png +0 -0
- ads/feature_store/docs/source/figures/feature_store_deployment.png +0 -0
- ads/feature_store/docs/source/figures/feature_store_overview.png +0 -0
- ads/feature_store/docs/source/figures/featuregroup.gif +0 -0
- ads/feature_store/docs/source/figures/lineage_d1.png +0 -0
- ads/feature_store/docs/source/figures/lineage_d2.png +0 -0
- ads/feature_store/docs/source/figures/lineage_fg.png +0 -0
- ads/feature_store/docs/source/figures/logo-dark-mode.png +0 -0
- ads/feature_store/docs/source/figures/logo-light-mode.png +0 -0
- ads/feature_store/docs/source/figures/overview.png +0 -0
- ads/feature_store/docs/source/figures/resource_manager.png +0 -0
- ads/feature_store/docs/source/figures/resource_manager_feature_store_stack.png +0 -0
- ads/feature_store/docs/source/figures/resource_manager_home.png +0 -0
- ads/feature_store/docs/source/figures/stats_1.png +0 -0
- ads/feature_store/docs/source/figures/stats_2.png +0 -0
- ads/feature_store/docs/source/figures/stats_d.png +0 -0
- ads/feature_store/docs/source/figures/stats_fg.png +0 -0
- ads/feature_store/docs/source/figures/transformation.png +0 -0
- ads/feature_store/docs/source/figures/transformations.gif +0 -0
- ads/feature_store/docs/source/figures/validation.png +0 -0
- ads/feature_store/docs/source/figures/validation_fg.png +0 -0
- ads/feature_store/docs/source/figures/validation_results.png +0 -0
- ads/feature_store/docs/source/figures/validation_summary.png +0 -0
- ads/feature_store/docs/source/index.rst +81 -0
- ads/feature_store/docs/source/module.rst +8 -0
- ads/feature_store/docs/source/notebook.rst +94 -0
- ads/feature_store/docs/source/overview.rst +47 -0
- ads/feature_store/docs/source/quickstart.rst +176 -0
- ads/feature_store/docs/source/release_notes.rst +194 -0
- ads/feature_store/docs/source/setup_feature_store.rst +81 -0
- ads/feature_store/docs/source/statistics.rst +58 -0
- ads/feature_store/docs/source/transformation.rst +199 -0
- ads/feature_store/docs/source/ui.rst +65 -0
- ads/feature_store/docs/source/user_guides.setup.feature_store_operator.rst +66 -0
- ads/feature_store/docs/source/user_guides.setup.helm_chart.rst +192 -0
- ads/feature_store/docs/source/user_guides.setup.terraform.rst +338 -0
- ads/feature_store/entity.py +718 -0
- ads/feature_store/execution_strategy/__init__.py +0 -0
- ads/feature_store/execution_strategy/delta_lake/__init__.py +0 -0
- ads/feature_store/execution_strategy/delta_lake/delta_lake_service.py +375 -0
- ads/feature_store/execution_strategy/engine/__init__.py +0 -0
- ads/feature_store/execution_strategy/engine/spark_engine.py +316 -0
- ads/feature_store/execution_strategy/execution_strategy.py +113 -0
- ads/feature_store/execution_strategy/execution_strategy_provider.py +47 -0
- ads/feature_store/execution_strategy/spark/__init__.py +0 -0
- ads/feature_store/execution_strategy/spark/spark_execution.py +618 -0
- ads/feature_store/feature.py +192 -0
- ads/feature_store/feature_group.py +1494 -0
- ads/feature_store/feature_group_expectation.py +346 -0
- ads/feature_store/feature_group_job.py +602 -0
- ads/feature_store/feature_lineage/__init__.py +0 -0
- ads/feature_store/feature_lineage/graphviz_service.py +180 -0
- ads/feature_store/feature_option_details.py +50 -0
- ads/feature_store/feature_statistics/__init__.py +0 -0
- ads/feature_store/feature_statistics/statistics_service.py +99 -0
- ads/feature_store/feature_store.py +699 -0
- ads/feature_store/feature_store_registrar.py +518 -0
- ads/feature_store/input_feature_detail.py +149 -0
- ads/feature_store/mixin/__init__.py +4 -0
- ads/feature_store/mixin/oci_feature_store.py +145 -0
- ads/feature_store/model_details.py +73 -0
- ads/feature_store/query/__init__.py +0 -0
- ads/feature_store/query/filter.py +266 -0
- ads/feature_store/query/generator/__init__.py +0 -0
- ads/feature_store/query/generator/query_generator.py +298 -0
- ads/feature_store/query/join.py +161 -0
- ads/feature_store/query/query.py +403 -0
- ads/feature_store/query/validator/__init__.py +0 -0
- ads/feature_store/query/validator/query_validator.py +57 -0
- ads/feature_store/response/__init__.py +0 -0
- ads/feature_store/response/response_builder.py +68 -0
- ads/feature_store/service/__init__.py +0 -0
- ads/feature_store/service/oci_dataset.py +139 -0
- ads/feature_store/service/oci_dataset_job.py +199 -0
- ads/feature_store/service/oci_entity.py +125 -0
- ads/feature_store/service/oci_feature_group.py +164 -0
- ads/feature_store/service/oci_feature_group_job.py +214 -0
- ads/feature_store/service/oci_feature_store.py +182 -0
- ads/feature_store/service/oci_lineage.py +87 -0
- ads/feature_store/service/oci_transformation.py +104 -0
- ads/feature_store/statistics/__init__.py +0 -0
- ads/feature_store/statistics/abs_feature_value.py +49 -0
- ads/feature_store/statistics/charts/__init__.py +0 -0
- ads/feature_store/statistics/charts/abstract_feature_plot.py +37 -0
- ads/feature_store/statistics/charts/box_plot.py +148 -0
- ads/feature_store/statistics/charts/frequency_distribution.py +65 -0
- ads/feature_store/statistics/charts/probability_distribution.py +68 -0
- ads/feature_store/statistics/charts/top_k_frequent_elements.py +98 -0
- ads/feature_store/statistics/feature_stat.py +126 -0
- ads/feature_store/statistics/generic_feature_value.py +33 -0
- ads/feature_store/statistics/statistics.py +41 -0
- ads/feature_store/statistics_config.py +101 -0
- ads/feature_store/templates/feature_store_template.yaml +45 -0
- ads/feature_store/transformation.py +499 -0
- ads/feature_store/validation_output.py +57 -0
- ads/hpo/__init__.py +9 -0
- ads/hpo/_imports.py +91 -0
- ads/hpo/ads_search_space.py +439 -0
- ads/hpo/distributions.py +325 -0
- ads/hpo/objective.py +280 -0
- ads/hpo/search_cv.py +1657 -0
- ads/hpo/stopping_criterion.py +75 -0
- ads/hpo/tuner_artifact.py +413 -0
- ads/hpo/utils.py +91 -0
- ads/hpo/validation.py +140 -0
- ads/hpo/visualization/__init__.py +5 -0
- ads/hpo/visualization/_contour.py +23 -0
- ads/hpo/visualization/_edf.py +20 -0
- ads/hpo/visualization/_intermediate_values.py +21 -0
- ads/hpo/visualization/_optimization_history.py +25 -0
- ads/hpo/visualization/_parallel_coordinate.py +169 -0
- ads/hpo/visualization/_param_importances.py +26 -0
- ads/jobs/__init__.py +53 -0
- ads/jobs/ads_job.py +663 -0
- ads/jobs/builders/__init__.py +5 -0
- ads/jobs/builders/base.py +156 -0
- ads/jobs/builders/infrastructure/__init__.py +6 -0
- ads/jobs/builders/infrastructure/base.py +165 -0
- ads/jobs/builders/infrastructure/dataflow.py +1252 -0
- ads/jobs/builders/infrastructure/dsc_job.py +1894 -0
- ads/jobs/builders/infrastructure/dsc_job_runtime.py +1233 -0
- ads/jobs/builders/infrastructure/utils.py +65 -0
- ads/jobs/builders/runtimes/__init__.py +5 -0
- ads/jobs/builders/runtimes/artifact.py +338 -0
- ads/jobs/builders/runtimes/base.py +325 -0
- ads/jobs/builders/runtimes/container_runtime.py +242 -0
- ads/jobs/builders/runtimes/python_runtime.py +1016 -0
- ads/jobs/builders/runtimes/pytorch_runtime.py +204 -0
- ads/jobs/cli.py +104 -0
- ads/jobs/env_var_parser.py +131 -0
- ads/jobs/extension.py +160 -0
- ads/jobs/schema/__init__.py +5 -0
- ads/jobs/schema/infrastructure_schema.json +116 -0
- ads/jobs/schema/job_schema.json +42 -0
- ads/jobs/schema/runtime_schema.json +183 -0
- ads/jobs/schema/validator.py +141 -0
- ads/jobs/serializer.py +296 -0
- ads/jobs/templates/__init__.py +5 -0
- ads/jobs/templates/container.py +6 -0
- ads/jobs/templates/driver_notebook.py +177 -0
- ads/jobs/templates/driver_oci.py +500 -0
- ads/jobs/templates/driver_python.py +48 -0
- ads/jobs/templates/driver_pytorch.py +852 -0
- ads/jobs/templates/driver_utils.py +615 -0
- ads/jobs/templates/hostname_from_env.c +55 -0
- ads/jobs/templates/oci_metrics.py +181 -0
- ads/jobs/utils.py +104 -0
- ads/llm/__init__.py +28 -0
- ads/llm/autogen/__init__.py +2 -0
- ads/llm/autogen/constants.py +15 -0
- ads/llm/autogen/reports/__init__.py +2 -0
- ads/llm/autogen/reports/base.py +67 -0
- ads/llm/autogen/reports/data.py +103 -0
- ads/llm/autogen/reports/session.py +526 -0
- ads/llm/autogen/reports/templates/chat_box.html +13 -0
- ads/llm/autogen/reports/templates/chat_box_lt.html +5 -0
- ads/llm/autogen/reports/templates/chat_box_rt.html +6 -0
- ads/llm/autogen/reports/utils.py +56 -0
- ads/llm/autogen/v02/__init__.py +4 -0
- ads/llm/autogen/v02/client.py +295 -0
- ads/llm/autogen/v02/log_handlers/__init__.py +2 -0
- ads/llm/autogen/v02/log_handlers/oci_file_handler.py +83 -0
- ads/llm/autogen/v02/loggers/__init__.py +6 -0
- ads/llm/autogen/v02/loggers/metric_logger.py +320 -0
- ads/llm/autogen/v02/loggers/session_logger.py +580 -0
- ads/llm/autogen/v02/loggers/utils.py +86 -0
- ads/llm/autogen/v02/runtime_logging.py +163 -0
- ads/llm/chain.py +268 -0
- ads/llm/chat_template.py +31 -0
- ads/llm/deploy.py +63 -0
- ads/llm/guardrails/__init__.py +5 -0
- ads/llm/guardrails/base.py +442 -0
- ads/llm/guardrails/huggingface.py +44 -0
- ads/llm/langchain/__init__.py +5 -0
- ads/llm/langchain/plugins/__init__.py +5 -0
- ads/llm/langchain/plugins/chat_models/__init__.py +5 -0
- ads/llm/langchain/plugins/chat_models/oci_data_science.py +1027 -0
- ads/llm/langchain/plugins/embeddings/__init__.py +4 -0
- ads/llm/langchain/plugins/embeddings/oci_data_science_model_deployment_endpoint.py +184 -0
- ads/llm/langchain/plugins/llms/__init__.py +5 -0
- ads/llm/langchain/plugins/llms/oci_data_science_model_deployment_endpoint.py +979 -0
- ads/llm/requirements.txt +3 -0
- ads/llm/serialize.py +219 -0
- ads/llm/serializers/__init__.py +0 -0
- ads/llm/serializers/retrieval_qa.py +153 -0
- ads/llm/serializers/runnable_parallel.py +27 -0
- ads/llm/templates/score_chain.jinja2 +155 -0
- ads/llm/templates/tool_chat_template_hermes.jinja +130 -0
- ads/llm/templates/tool_chat_template_mistral_parallel.jinja +94 -0
- ads/model/__init__.py +52 -0
- ads/model/artifact.py +573 -0
- ads/model/artifact_downloader.py +254 -0
- ads/model/artifact_uploader.py +267 -0
- ads/model/base_properties.py +238 -0
- ads/model/common/.model-ignore +66 -0
- ads/model/common/__init__.py +5 -0
- ads/model/common/utils.py +142 -0
- ads/model/datascience_model.py +2635 -0
- ads/model/deployment/__init__.py +20 -0
- ads/model/deployment/common/__init__.py +5 -0
- ads/model/deployment/common/utils.py +308 -0
- ads/model/deployment/model_deployer.py +466 -0
- ads/model/deployment/model_deployment.py +1846 -0
- ads/model/deployment/model_deployment_infrastructure.py +671 -0
- ads/model/deployment/model_deployment_properties.py +493 -0
- ads/model/deployment/model_deployment_runtime.py +838 -0
- ads/model/extractor/__init__.py +5 -0
- ads/model/extractor/automl_extractor.py +74 -0
- ads/model/extractor/embedding_onnx_extractor.py +80 -0
- ads/model/extractor/huggingface_extractor.py +88 -0
- ads/model/extractor/keras_extractor.py +84 -0
- ads/model/extractor/lightgbm_extractor.py +93 -0
- ads/model/extractor/model_info_extractor.py +114 -0
- ads/model/extractor/model_info_extractor_factory.py +105 -0
- ads/model/extractor/pytorch_extractor.py +87 -0
- ads/model/extractor/sklearn_extractor.py +112 -0
- ads/model/extractor/spark_extractor.py +89 -0
- ads/model/extractor/tensorflow_extractor.py +85 -0
- ads/model/extractor/xgboost_extractor.py +94 -0
- ads/model/framework/__init__.py +5 -0
- ads/model/framework/automl_model.py +178 -0
- ads/model/framework/embedding_onnx_model.py +438 -0
- ads/model/framework/huggingface_model.py +399 -0
- ads/model/framework/lightgbm_model.py +266 -0
- ads/model/framework/pytorch_model.py +266 -0
- ads/model/framework/sklearn_model.py +250 -0
- ads/model/framework/spark_model.py +326 -0
- ads/model/framework/tensorflow_model.py +254 -0
- ads/model/framework/xgboost_model.py +258 -0
- ads/model/generic_model.py +3518 -0
- ads/model/model_artifact_boilerplate/README.md +381 -0
- ads/model/model_artifact_boilerplate/__init__.py +5 -0
- ads/model/model_artifact_boilerplate/artifact_introspection_test/__init__.py +5 -0
- ads/model/model_artifact_boilerplate/artifact_introspection_test/model_artifact_validate.py +427 -0
- ads/model/model_artifact_boilerplate/artifact_introspection_test/requirements.txt +2 -0
- ads/model/model_artifact_boilerplate/runtime.yaml +7 -0
- ads/model/model_artifact_boilerplate/score.py +61 -0
- ads/model/model_file_description_schema.json +68 -0
- ads/model/model_introspect.py +331 -0
- ads/model/model_metadata.py +1810 -0
- ads/model/model_metadata_mixin.py +460 -0
- ads/model/model_properties.py +63 -0
- ads/model/model_version_set.py +739 -0
- ads/model/runtime/__init__.py +5 -0
- ads/model/runtime/env_info.py +306 -0
- ads/model/runtime/model_deployment_details.py +37 -0
- ads/model/runtime/model_provenance_details.py +58 -0
- ads/model/runtime/runtime_info.py +81 -0
- ads/model/runtime/schemas/inference_env_info_schema.yaml +16 -0
- ads/model/runtime/schemas/model_provenance_schema.yaml +36 -0
- ads/model/runtime/schemas/training_env_info_schema.yaml +16 -0
- ads/model/runtime/utils.py +201 -0
- ads/model/serde/__init__.py +5 -0
- ads/model/serde/common.py +40 -0
- ads/model/serde/model_input.py +547 -0
- ads/model/serde/model_serializer.py +1184 -0
- ads/model/service/__init__.py +5 -0
- ads/model/service/oci_datascience_model.py +1076 -0
- ads/model/service/oci_datascience_model_deployment.py +500 -0
- ads/model/service/oci_datascience_model_version_set.py +176 -0
- ads/model/transformer/__init__.py +5 -0
- ads/model/transformer/onnx_transformer.py +324 -0
- ads/mysqldb/__init__.py +5 -0
- ads/mysqldb/mysql_db.py +227 -0
- ads/opctl/__init__.py +18 -0
- ads/opctl/anomaly_detection.py +11 -0
- ads/opctl/backend/__init__.py +5 -0
- ads/opctl/backend/ads_dataflow.py +353 -0
- ads/opctl/backend/ads_ml_job.py +710 -0
- ads/opctl/backend/ads_ml_pipeline.py +164 -0
- ads/opctl/backend/ads_model_deployment.py +209 -0
- ads/opctl/backend/base.py +146 -0
- ads/opctl/backend/local.py +1053 -0
- ads/opctl/backend/marketplace/__init__.py +9 -0
- ads/opctl/backend/marketplace/helm_helper.py +173 -0
- ads/opctl/backend/marketplace/local_marketplace.py +271 -0
- ads/opctl/backend/marketplace/marketplace_backend_runner.py +71 -0
- ads/opctl/backend/marketplace/marketplace_operator_interface.py +44 -0
- ads/opctl/backend/marketplace/marketplace_operator_runner.py +24 -0
- ads/opctl/backend/marketplace/marketplace_utils.py +212 -0
- ads/opctl/backend/marketplace/models/__init__.py +5 -0
- ads/opctl/backend/marketplace/models/bearer_token.py +94 -0
- ads/opctl/backend/marketplace/models/marketplace_type.py +70 -0
- ads/opctl/backend/marketplace/models/ocir_details.py +56 -0
- ads/opctl/backend/marketplace/prerequisite_checker.py +238 -0
- ads/opctl/cli.py +707 -0
- ads/opctl/cmds.py +869 -0
- ads/opctl/conda/__init__.py +5 -0
- ads/opctl/conda/cli.py +193 -0
- ads/opctl/conda/cmds.py +749 -0
- ads/opctl/conda/config.yaml +34 -0
- ads/opctl/conda/manifest_template.yaml +13 -0
- ads/opctl/conda/multipart_uploader.py +188 -0
- ads/opctl/conda/pack.py +89 -0
- ads/opctl/config/__init__.py +5 -0
- ads/opctl/config/base.py +57 -0
- ads/opctl/config/diagnostics/__init__.py +5 -0
- ads/opctl/config/diagnostics/distributed/default_requirements_config.yaml +62 -0
- ads/opctl/config/merger.py +255 -0
- ads/opctl/config/resolver.py +297 -0
- ads/opctl/config/utils.py +79 -0
- ads/opctl/config/validator.py +17 -0
- ads/opctl/config/versioner.py +68 -0
- ads/opctl/config/yaml_parsers/__init__.py +7 -0
- ads/opctl/config/yaml_parsers/base.py +58 -0
- ads/opctl/config/yaml_parsers/distributed/__init__.py +7 -0
- ads/opctl/config/yaml_parsers/distributed/yaml_parser.py +201 -0
- ads/opctl/constants.py +66 -0
- ads/opctl/decorator/__init__.py +5 -0
- ads/opctl/decorator/common.py +129 -0
- ads/opctl/diagnostics/__init__.py +5 -0
- ads/opctl/diagnostics/__main__.py +25 -0
- ads/opctl/diagnostics/check_distributed_job_requirements.py +212 -0
- ads/opctl/diagnostics/check_requirements.py +144 -0
- ads/opctl/diagnostics/requirement_exception.py +9 -0
- ads/opctl/distributed/README.md +109 -0
- ads/opctl/distributed/__init__.py +5 -0
- ads/opctl/distributed/certificates.py +32 -0
- ads/opctl/distributed/cli.py +207 -0
- ads/opctl/distributed/cmds.py +731 -0
- ads/opctl/distributed/common/__init__.py +5 -0
- ads/opctl/distributed/common/abstract_cluster_provider.py +449 -0
- ads/opctl/distributed/common/abstract_framework_spec_builder.py +88 -0
- ads/opctl/distributed/common/cluster_config_helper.py +103 -0
- ads/opctl/distributed/common/cluster_provider_factory.py +21 -0
- ads/opctl/distributed/common/cluster_runner.py +54 -0
- ads/opctl/distributed/common/framework_factory.py +29 -0
- ads/opctl/docker/Dockerfile.job +103 -0
- ads/opctl/docker/Dockerfile.job.arm +107 -0
- ads/opctl/docker/Dockerfile.job.gpu +175 -0
- ads/opctl/docker/base-env.yaml +13 -0
- ads/opctl/docker/cuda.repo +6 -0
- ads/opctl/docker/operator/.dockerignore +0 -0
- ads/opctl/docker/operator/Dockerfile +41 -0
- ads/opctl/docker/operator/Dockerfile.gpu +85 -0
- ads/opctl/docker/operator/cuda.repo +6 -0
- ads/opctl/docker/operator/environment.yaml +8 -0
- ads/opctl/forecast.py +11 -0
- ads/opctl/index.yaml +3 -0
- ads/opctl/model/__init__.py +5 -0
- ads/opctl/model/cli.py +65 -0
- ads/opctl/model/cmds.py +73 -0
- ads/opctl/operator/README.md +4 -0
- ads/opctl/operator/__init__.py +31 -0
- ads/opctl/operator/cli.py +344 -0
- ads/opctl/operator/cmd.py +596 -0
- ads/opctl/operator/common/__init__.py +5 -0
- ads/opctl/operator/common/backend_factory.py +460 -0
- ads/opctl/operator/common/const.py +27 -0
- ads/opctl/operator/common/data/synthetic.csv +16001 -0
- ads/opctl/operator/common/dictionary_merger.py +148 -0
- ads/opctl/operator/common/errors.py +42 -0
- ads/opctl/operator/common/operator_config.py +99 -0
- ads/opctl/operator/common/operator_loader.py +811 -0
- ads/opctl/operator/common/operator_schema.yaml +130 -0
- ads/opctl/operator/common/operator_yaml_generator.py +152 -0
- ads/opctl/operator/common/utils.py +208 -0
- ads/opctl/operator/lowcode/__init__.py +5 -0
- ads/opctl/operator/lowcode/anomaly/MLoperator +16 -0
- ads/opctl/operator/lowcode/anomaly/README.md +207 -0
- ads/opctl/operator/lowcode/anomaly/__init__.py +5 -0
- ads/opctl/operator/lowcode/anomaly/__main__.py +103 -0
- ads/opctl/operator/lowcode/anomaly/cmd.py +35 -0
- ads/opctl/operator/lowcode/anomaly/const.py +167 -0
- ads/opctl/operator/lowcode/anomaly/environment.yaml +10 -0
- ads/opctl/operator/lowcode/anomaly/model/__init__.py +5 -0
- ads/opctl/operator/lowcode/anomaly/model/anomaly_dataset.py +146 -0
- ads/opctl/operator/lowcode/anomaly/model/anomaly_merlion.py +162 -0
- ads/opctl/operator/lowcode/anomaly/model/automlx.py +99 -0
- ads/opctl/operator/lowcode/anomaly/model/autots.py +115 -0
- ads/opctl/operator/lowcode/anomaly/model/base_model.py +404 -0
- ads/opctl/operator/lowcode/anomaly/model/factory.py +110 -0
- ads/opctl/operator/lowcode/anomaly/model/isolationforest.py +78 -0
- ads/opctl/operator/lowcode/anomaly/model/oneclasssvm.py +78 -0
- ads/opctl/operator/lowcode/anomaly/model/randomcutforest.py +120 -0
- ads/opctl/operator/lowcode/anomaly/model/tods.py +119 -0
- ads/opctl/operator/lowcode/anomaly/operator_config.py +127 -0
- ads/opctl/operator/lowcode/anomaly/schema.yaml +401 -0
- ads/opctl/operator/lowcode/anomaly/utils.py +88 -0
- ads/opctl/operator/lowcode/common/__init__.py +5 -0
- ads/opctl/operator/lowcode/common/const.py +10 -0
- ads/opctl/operator/lowcode/common/data.py +116 -0
- ads/opctl/operator/lowcode/common/errors.py +47 -0
- ads/opctl/operator/lowcode/common/transformations.py +296 -0
- ads/opctl/operator/lowcode/common/utils.py +384 -0
- ads/opctl/operator/lowcode/feature_store_marketplace/MLoperator +13 -0
- ads/opctl/operator/lowcode/feature_store_marketplace/README.md +30 -0
- ads/opctl/operator/lowcode/feature_store_marketplace/__init__.py +5 -0
- ads/opctl/operator/lowcode/feature_store_marketplace/__main__.py +116 -0
- ads/opctl/operator/lowcode/feature_store_marketplace/cmd.py +85 -0
- ads/opctl/operator/lowcode/feature_store_marketplace/const.py +15 -0
- ads/opctl/operator/lowcode/feature_store_marketplace/environment.yaml +0 -0
- ads/opctl/operator/lowcode/feature_store_marketplace/models/__init__.py +4 -0
- ads/opctl/operator/lowcode/feature_store_marketplace/models/apigw_config.py +32 -0
- ads/opctl/operator/lowcode/feature_store_marketplace/models/db_config.py +43 -0
- ads/opctl/operator/lowcode/feature_store_marketplace/models/mysql_config.py +120 -0
- ads/opctl/operator/lowcode/feature_store_marketplace/models/serializable_yaml_model.py +34 -0
- ads/opctl/operator/lowcode/feature_store_marketplace/operator_utils.py +386 -0
- ads/opctl/operator/lowcode/feature_store_marketplace/schema.yaml +160 -0
- ads/opctl/operator/lowcode/forecast/MLoperator +25 -0
- ads/opctl/operator/lowcode/forecast/README.md +209 -0
- ads/opctl/operator/lowcode/forecast/__init__.py +5 -0
- ads/opctl/operator/lowcode/forecast/__main__.py +89 -0
- ads/opctl/operator/lowcode/forecast/cmd.py +40 -0
- ads/opctl/operator/lowcode/forecast/const.py +92 -0
- ads/opctl/operator/lowcode/forecast/environment.yaml +20 -0
- ads/opctl/operator/lowcode/forecast/errors.py +26 -0
- ads/opctl/operator/lowcode/forecast/model/__init__.py +5 -0
- ads/opctl/operator/lowcode/forecast/model/arima.py +279 -0
- ads/opctl/operator/lowcode/forecast/model/automlx.py +553 -0
- ads/opctl/operator/lowcode/forecast/model/autots.py +312 -0
- ads/opctl/operator/lowcode/forecast/model/base_model.py +875 -0
- ads/opctl/operator/lowcode/forecast/model/factory.py +106 -0
- ads/opctl/operator/lowcode/forecast/model/forecast_datasets.py +492 -0
- ads/opctl/operator/lowcode/forecast/model/ml_forecast.py +243 -0
- ads/opctl/operator/lowcode/forecast/model/neuralprophet.py +482 -0
- ads/opctl/operator/lowcode/forecast/model/prophet.py +445 -0
- ads/opctl/operator/lowcode/forecast/model_evaluator.py +244 -0
- ads/opctl/operator/lowcode/forecast/operator_config.py +234 -0
- ads/opctl/operator/lowcode/forecast/schema.yaml +506 -0
- ads/opctl/operator/lowcode/forecast/utils.py +397 -0
- ads/opctl/operator/lowcode/forecast/whatifserve/__init__.py +7 -0
- ads/opctl/operator/lowcode/forecast/whatifserve/deployment_manager.py +285 -0
- ads/opctl/operator/lowcode/forecast/whatifserve/score.py +246 -0
- ads/opctl/operator/lowcode/pii/MLoperator +17 -0
- ads/opctl/operator/lowcode/pii/README.md +208 -0
- ads/opctl/operator/lowcode/pii/__init__.py +5 -0
- ads/opctl/operator/lowcode/pii/__main__.py +78 -0
- ads/opctl/operator/lowcode/pii/cmd.py +39 -0
- ads/opctl/operator/lowcode/pii/constant.py +84 -0
- ads/opctl/operator/lowcode/pii/environment.yaml +17 -0
- ads/opctl/operator/lowcode/pii/errors.py +27 -0
- ads/opctl/operator/lowcode/pii/model/__init__.py +5 -0
- ads/opctl/operator/lowcode/pii/model/factory.py +82 -0
- ads/opctl/operator/lowcode/pii/model/guardrails.py +167 -0
- ads/opctl/operator/lowcode/pii/model/pii.py +145 -0
- ads/opctl/operator/lowcode/pii/model/processor/__init__.py +34 -0
- ads/opctl/operator/lowcode/pii/model/processor/email_replacer.py +34 -0
- ads/opctl/operator/lowcode/pii/model/processor/mbi_replacer.py +35 -0
- ads/opctl/operator/lowcode/pii/model/processor/name_replacer.py +225 -0
- ads/opctl/operator/lowcode/pii/model/processor/number_replacer.py +73 -0
- ads/opctl/operator/lowcode/pii/model/processor/remover.py +26 -0
- ads/opctl/operator/lowcode/pii/model/report.py +487 -0
- ads/opctl/operator/lowcode/pii/operator_config.py +95 -0
- ads/opctl/operator/lowcode/pii/schema.yaml +108 -0
- ads/opctl/operator/lowcode/pii/utils.py +43 -0
- ads/opctl/operator/lowcode/recommender/MLoperator +16 -0
- ads/opctl/operator/lowcode/recommender/README.md +206 -0
- ads/opctl/operator/lowcode/recommender/__init__.py +5 -0
- ads/opctl/operator/lowcode/recommender/__main__.py +82 -0
- ads/opctl/operator/lowcode/recommender/cmd.py +33 -0
- ads/opctl/operator/lowcode/recommender/constant.py +30 -0
- ads/opctl/operator/lowcode/recommender/environment.yaml +11 -0
- ads/opctl/operator/lowcode/recommender/model/base_model.py +212 -0
- ads/opctl/operator/lowcode/recommender/model/factory.py +56 -0
- ads/opctl/operator/lowcode/recommender/model/recommender_dataset.py +25 -0
- ads/opctl/operator/lowcode/recommender/model/svd.py +106 -0
- ads/opctl/operator/lowcode/recommender/operator_config.py +81 -0
- ads/opctl/operator/lowcode/recommender/schema.yaml +265 -0
- ads/opctl/operator/lowcode/recommender/utils.py +13 -0
- ads/opctl/operator/runtime/__init__.py +5 -0
- ads/opctl/operator/runtime/const.py +17 -0
- ads/opctl/operator/runtime/container_runtime_schema.yaml +50 -0
- ads/opctl/operator/runtime/marketplace_runtime.py +50 -0
- ads/opctl/operator/runtime/python_marketplace_runtime_schema.yaml +21 -0
- ads/opctl/operator/runtime/python_runtime_schema.yaml +21 -0
- ads/opctl/operator/runtime/runtime.py +115 -0
- ads/opctl/schema.yaml.yml +36 -0
- ads/opctl/script.py +40 -0
- ads/opctl/spark/__init__.py +5 -0
- ads/opctl/spark/cli.py +43 -0
- ads/opctl/spark/cmds.py +147 -0
- ads/opctl/templates/diagnostic_report_template.jinja2 +102 -0
- ads/opctl/utils.py +344 -0
- ads/oracledb/__init__.py +5 -0
- ads/oracledb/oracle_db.py +346 -0
- ads/pipeline/__init__.py +39 -0
- ads/pipeline/ads_pipeline.py +2279 -0
- ads/pipeline/ads_pipeline_run.py +772 -0
- ads/pipeline/ads_pipeline_step.py +605 -0
- ads/pipeline/builders/__init__.py +5 -0
- ads/pipeline/builders/infrastructure/__init__.py +5 -0
- ads/pipeline/builders/infrastructure/custom_script.py +32 -0
- ads/pipeline/cli.py +119 -0
- ads/pipeline/extension.py +291 -0
- ads/pipeline/schema/__init__.py +5 -0
- ads/pipeline/schema/cs_step_schema.json +35 -0
- ads/pipeline/schema/ml_step_schema.json +31 -0
- ads/pipeline/schema/pipeline_schema.json +71 -0
- ads/pipeline/visualizer/__init__.py +5 -0
- ads/pipeline/visualizer/base.py +570 -0
- ads/pipeline/visualizer/graph_renderer.py +272 -0
- ads/pipeline/visualizer/text_renderer.py +84 -0
- ads/secrets/__init__.py +11 -0
- ads/secrets/adb.py +386 -0
- ads/secrets/auth_token.py +86 -0
- ads/secrets/big_data_service.py +365 -0
- ads/secrets/mysqldb.py +149 -0
- ads/secrets/oracledb.py +160 -0
- ads/secrets/secrets.py +407 -0
- ads/telemetry/__init__.py +7 -0
- ads/telemetry/base.py +69 -0
- ads/telemetry/client.py +125 -0
- ads/telemetry/telemetry.py +257 -0
- ads/templates/dataflow_pyspark.jinja2 +13 -0
- ads/templates/dataflow_sparksql.jinja2 +22 -0
- ads/templates/func.jinja2 +20 -0
- ads/templates/schemas/openapi.json +1740 -0
- ads/templates/score-pkl.jinja2 +173 -0
- ads/templates/score.jinja2 +322 -0
- ads/templates/score_embedding_onnx.jinja2 +202 -0
- ads/templates/score_generic.jinja2 +165 -0
- ads/templates/score_huggingface_pipeline.jinja2 +217 -0
- ads/templates/score_lightgbm.jinja2 +185 -0
- ads/templates/score_onnx.jinja2 +407 -0
- ads/templates/score_onnx_new.jinja2 +473 -0
- ads/templates/score_oracle_automl.jinja2 +185 -0
- ads/templates/score_pyspark.jinja2 +154 -0
- ads/templates/score_pytorch.jinja2 +219 -0
- ads/templates/score_scikit-learn.jinja2 +184 -0
- ads/templates/score_tensorflow.jinja2 +184 -0
- ads/templates/score_xgboost.jinja2 +178 -0
- ads/text_dataset/__init__.py +5 -0
- ads/text_dataset/backends.py +211 -0
- ads/text_dataset/dataset.py +445 -0
- ads/text_dataset/extractor.py +207 -0
- ads/text_dataset/options.py +53 -0
- ads/text_dataset/udfs.py +22 -0
- ads/text_dataset/utils.py +49 -0
- ads/type_discovery/__init__.py +9 -0
- ads/type_discovery/abstract_detector.py +21 -0
- ads/type_discovery/constant_detector.py +41 -0
- ads/type_discovery/continuous_detector.py +54 -0
- ads/type_discovery/credit_card_detector.py +99 -0
- ads/type_discovery/datetime_detector.py +92 -0
- ads/type_discovery/discrete_detector.py +118 -0
- ads/type_discovery/document_detector.py +146 -0
- ads/type_discovery/ip_detector.py +68 -0
- ads/type_discovery/latlon_detector.py +90 -0
- ads/type_discovery/phone_number_detector.py +63 -0
- ads/type_discovery/type_discovery_driver.py +87 -0
- ads/type_discovery/typed_feature.py +594 -0
- ads/type_discovery/unknown_detector.py +41 -0
- ads/type_discovery/zipcode_detector.py +48 -0
- ads/vault/__init__.py +7 -0
- ads/vault/vault.py +237 -0
- {oracle_ads-2.13.9rc0.dist-info → oracle_ads-2.13.9rc1.dist-info}/METADATA +150 -150
- oracle_ads-2.13.9rc1.dist-info/RECORD +858 -0
- {oracle_ads-2.13.9rc0.dist-info → oracle_ads-2.13.9rc1.dist-info}/WHEEL +1 -2
- {oracle_ads-2.13.9rc0.dist-info → oracle_ads-2.13.9rc1.dist-info}/entry_points.txt +2 -1
- oracle_ads-2.13.9rc0.dist-info/RECORD +0 -9
- oracle_ads-2.13.9rc0.dist-info/top_level.txt +0 -1
- {oracle_ads-2.13.9rc0.dist-info → oracle_ads-2.13.9rc1.dist-info}/licenses/LICENSE.txt +0 -0
@@ -0,0 +1,749 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# Copyright (c) 2024, 2025 Oracle and/or its affiliates.
|
3
|
+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
|
4
|
+
|
5
|
+
import json
|
6
|
+
import os
|
7
|
+
import time
|
8
|
+
import traceback
|
9
|
+
from typing import Dict
|
10
|
+
|
11
|
+
from oci.data_science.models import (
|
12
|
+
Metadata,
|
13
|
+
UpdateModelDetails,
|
14
|
+
UpdateModelProvenanceDetails,
|
15
|
+
)
|
16
|
+
from pydantic import ValidationError
|
17
|
+
|
18
|
+
from ads.aqua import logger
|
19
|
+
from ads.aqua.app import AquaApp
|
20
|
+
from ads.aqua.common.enums import Resource, Tags
|
21
|
+
from ads.aqua.common.errors import AquaFileExistsError, AquaValueError
|
22
|
+
from ads.aqua.common.utils import (
|
23
|
+
DEFINED_METADATA_TO_FILE_MAP,
|
24
|
+
build_pydantic_error_message,
|
25
|
+
upload_local_to_os,
|
26
|
+
)
|
27
|
+
from ads.aqua.constants import (
|
28
|
+
DEFAULT_FT_BATCH_SIZE,
|
29
|
+
DEFAULT_FT_BLOCK_STORAGE_SIZE,
|
30
|
+
DEFAULT_FT_REPLICA,
|
31
|
+
DEFAULT_FT_VALIDATION_SET_SIZE,
|
32
|
+
JOB_INFRASTRUCTURE_TYPE_DEFAULT_NETWORKING,
|
33
|
+
UNKNOWN_DICT,
|
34
|
+
)
|
35
|
+
from ads.aqua.data import AquaResourceIdentifier
|
36
|
+
from ads.aqua.finetuning.constants import (
|
37
|
+
ENV_AQUA_FINE_TUNING_CONTAINER,
|
38
|
+
FineTuneCustomMetadata,
|
39
|
+
)
|
40
|
+
from ads.aqua.finetuning.entities import (
|
41
|
+
AquaFineTuningConfig,
|
42
|
+
AquaFineTuningParams,
|
43
|
+
AquaFineTuningSummary,
|
44
|
+
CreateFineTuningDetails,
|
45
|
+
)
|
46
|
+
from ads.aqua.model.constants import AquaModelMetadataKeys
|
47
|
+
from ads.common.auth import default_signer
|
48
|
+
from ads.common.object_storage_details import ObjectStorageDetails
|
49
|
+
from ads.common.utils import UNKNOWN, get_console_link
|
50
|
+
from ads.config import (
|
51
|
+
AQUA_FINETUNING_CONTAINER_OVERRIDE_FLAG_METADATA_NAME,
|
52
|
+
AQUA_JOB_SUBNET_ID,
|
53
|
+
COMPARTMENT_OCID,
|
54
|
+
CONDA_BUCKET_NS,
|
55
|
+
PROJECT_OCID,
|
56
|
+
)
|
57
|
+
from ads.jobs.ads_job import Job
|
58
|
+
from ads.jobs.builders.infrastructure.dsc_job import DataScienceJob
|
59
|
+
from ads.jobs.builders.runtimes.base import Runtime
|
60
|
+
from ads.jobs.builders.runtimes.container_runtime import ContainerRuntime
|
61
|
+
from ads.model.common.utils import MetadataArtifactPathType
|
62
|
+
from ads.model.model_metadata import (
|
63
|
+
MetadataTaxonomyKeys,
|
64
|
+
ModelCustomMetadata,
|
65
|
+
ModelTaxonomyMetadata,
|
66
|
+
)
|
67
|
+
from ads.telemetry import telemetry
|
68
|
+
|
69
|
+
|
70
|
+
class AquaFineTuningApp(AquaApp):
|
71
|
+
"""Provides a suite of APIs to interact with Aqua fine-tuned models within the Oracle
|
72
|
+
Cloud Infrastructure Data Science service, serving as an interface for creating fine-tuned models.
|
73
|
+
|
74
|
+
Methods
|
75
|
+
-------
|
76
|
+
create(...) -> AquaFineTuningSummary
|
77
|
+
Creates a fine-tuned Aqua model.
|
78
|
+
get_finetuning_config(self, model_id: str) -> Dict:
|
79
|
+
Gets the finetuning config for given Aqua model.
|
80
|
+
|
81
|
+
Note:
|
82
|
+
Use `ads aqua finetuning <method_name> --help` to get more details on the parameters available.
|
83
|
+
This class is designed to work within the Oracle Cloud Infrastructure
|
84
|
+
and requires proper configuration and authentication set up to interact
|
85
|
+
with OCI services.
|
86
|
+
"""
|
87
|
+
|
88
|
+
@telemetry(entry_point="plugin=finetuning&action=create", name="aqua")
|
89
|
+
def create(
|
90
|
+
self, create_fine_tuning_details: CreateFineTuningDetails = None, **kwargs
|
91
|
+
) -> "AquaFineTuningSummary":
|
92
|
+
"""Creates Aqua fine tuning for model.\n
|
93
|
+
For detailed information about CLI flags see: https://github.com/oracle-samples/oci-data-science-ai-samples/blob/f271ca63d12e3c256718f23a14d93da4b4fc086b/ai-quick-actions/cli-tips.md#create-fine-tuned-model
|
94
|
+
|
95
|
+
Parameters
|
96
|
+
----------
|
97
|
+
create_fine_tuning_details: CreateFineTuningDetails
|
98
|
+
The CreateFineTuningDetails data class which contains all
|
99
|
+
required and optional fields to create the aqua fine tuning.
|
100
|
+
kwargs:
|
101
|
+
ft_source_id: str The fine tuning source id. Must be model OCID.
|
102
|
+
ft_name: str
|
103
|
+
The name for fine tuning.
|
104
|
+
dataset_path: str
|
105
|
+
The dataset path for fine tuning. Could be either a local path from notebook session
|
106
|
+
or an object storage path.
|
107
|
+
report_path: str
|
108
|
+
The report path for fine tuning. Must be an object storage path.
|
109
|
+
ft_parameters: dict
|
110
|
+
The parameters for fine tuning.
|
111
|
+
shape_name: str
|
112
|
+
The shape name for fine tuning job infrastructure.
|
113
|
+
replica: int
|
114
|
+
The replica for fine tuning job runtime.
|
115
|
+
validation_set_size: float
|
116
|
+
The validation set size for fine tuning job. Must be a float in between [0,1).
|
117
|
+
ft_description: (str, optional). Defaults to `None`.
|
118
|
+
The description for fine tuning.
|
119
|
+
compartment_id: (str, optional). Defaults to `None`.
|
120
|
+
The compartment id for fine tuning.
|
121
|
+
project_id: (str, optional). Defaults to `None`.
|
122
|
+
The project id for fine tuning.
|
123
|
+
experiment_id: (str, optional). Defaults to `None`.
|
124
|
+
The fine tuning model version set id. If provided,
|
125
|
+
fine tuning model will be associated with it.
|
126
|
+
experiment_name: (str, optional). Defaults to `None`.
|
127
|
+
The fine tuning model version set name. If provided,
|
128
|
+
the fine tuning version set with the same name will be used if exists,
|
129
|
+
otherwise a new model version set will be created with the name.
|
130
|
+
experiment_description: (str, optional). Defaults to `None`.
|
131
|
+
The description for fine tuning model version set.
|
132
|
+
block_storage_size: (int, optional). Defaults to 256.
|
133
|
+
The storage for fine tuning job infrastructure.
|
134
|
+
subnet_id: (str, optional). Defaults to `None`.
|
135
|
+
The custom egress for fine tuning job.
|
136
|
+
log_group_id: (str, optional). Defaults to `None`.
|
137
|
+
The log group id for fine tuning job infrastructure.
|
138
|
+
log_id: (str, optional). Defaults to `None`.
|
139
|
+
The log id for fine tuning job infrastructure.
|
140
|
+
watch_logs: (bool, optional). Defaults to `False`.
|
141
|
+
The flag to watch the job run logs when a fine-tuning job is created.
|
142
|
+
force_overwrite: (bool, optional). Defaults to `False`.
|
143
|
+
Whether to force overwrite the existing file in object storage.
|
144
|
+
freeform_tags: (dict, optional)
|
145
|
+
Freeform tags for the fine-tuning model
|
146
|
+
defined_tags: (dict, optional)
|
147
|
+
Defined tags for the fine-tuning model
|
148
|
+
kwargs:
|
149
|
+
The kwargs for creating CreateFineTuningDetails instance if
|
150
|
+
no create_fine_tuning_details provided.
|
151
|
+
|
152
|
+
Returns
|
153
|
+
-------
|
154
|
+
AquaFineTuningSummary:
|
155
|
+
The instance of AquaFineTuningSummary.
|
156
|
+
"""
|
157
|
+
if not create_fine_tuning_details:
|
158
|
+
try:
|
159
|
+
create_fine_tuning_details = CreateFineTuningDetails(**kwargs)
|
160
|
+
except ValidationError as ex:
|
161
|
+
custom_errors = build_pydantic_error_message(ex)
|
162
|
+
raise AquaValueError(
|
163
|
+
f"Invalid parameters for creating a fine-tuned model. Error details: {custom_errors}."
|
164
|
+
) from ex
|
165
|
+
|
166
|
+
target_compartment = (
|
167
|
+
create_fine_tuning_details.compartment_id or COMPARTMENT_OCID
|
168
|
+
)
|
169
|
+
target_project = create_fine_tuning_details.project_id or PROJECT_OCID
|
170
|
+
|
171
|
+
if not ObjectStorageDetails.is_oci_path(create_fine_tuning_details.report_path):
|
172
|
+
raise AquaValueError(
|
173
|
+
"Fine tuning report path must be an object storage path."
|
174
|
+
)
|
175
|
+
|
176
|
+
if (
|
177
|
+
create_fine_tuning_details.validation_set_size < 0
|
178
|
+
or create_fine_tuning_details.validation_set_size >= 1
|
179
|
+
):
|
180
|
+
raise AquaValueError(
|
181
|
+
"Fine tuning validation set size should be a float number in between [0, 1)."
|
182
|
+
)
|
183
|
+
|
184
|
+
if create_fine_tuning_details.replica < DEFAULT_FT_REPLICA:
|
185
|
+
raise AquaValueError(
|
186
|
+
f"Fine tuning replica must be equal to or larger than {DEFAULT_FT_REPLICA}."
|
187
|
+
)
|
188
|
+
|
189
|
+
subnet_id = create_fine_tuning_details.subnet_id or AQUA_JOB_SUBNET_ID
|
190
|
+
if not subnet_id and create_fine_tuning_details.replica > DEFAULT_FT_REPLICA:
|
191
|
+
raise AquaValueError(
|
192
|
+
f"Custom egress must be provided if replica is larger than {DEFAULT_FT_REPLICA}. "
|
193
|
+
"Specify the subnet id via API or environment variable AQUA_JOB_SUBNET_ID."
|
194
|
+
)
|
195
|
+
|
196
|
+
if create_fine_tuning_details.replica > DEFAULT_FT_REPLICA and not (
|
197
|
+
create_fine_tuning_details.log_id
|
198
|
+
and create_fine_tuning_details.log_group_id
|
199
|
+
):
|
200
|
+
raise AquaValueError(
|
201
|
+
f"Logging is required for fine tuning if replica is larger than {DEFAULT_FT_REPLICA}."
|
202
|
+
)
|
203
|
+
|
204
|
+
if create_fine_tuning_details.watch_logs and not (
|
205
|
+
create_fine_tuning_details.log_id
|
206
|
+
and create_fine_tuning_details.log_group_id
|
207
|
+
):
|
208
|
+
raise AquaValueError(
|
209
|
+
"Logging is required for fine tuning if watch_logs is set to True. "
|
210
|
+
"Please provide log_id and log_group_id with the request parameters."
|
211
|
+
)
|
212
|
+
|
213
|
+
ft_parameters = self._get_finetuning_params(
|
214
|
+
create_fine_tuning_details.ft_parameters
|
215
|
+
)
|
216
|
+
|
217
|
+
experiment_model_version_set_id = create_fine_tuning_details.experiment_id
|
218
|
+
experiment_model_version_set_name = create_fine_tuning_details.experiment_name
|
219
|
+
|
220
|
+
if (
|
221
|
+
not experiment_model_version_set_id
|
222
|
+
and not experiment_model_version_set_name
|
223
|
+
):
|
224
|
+
raise AquaValueError(
|
225
|
+
"Either experiment id or experiment name must be provided for fine tuning."
|
226
|
+
)
|
227
|
+
|
228
|
+
# upload dataset if it's local path
|
229
|
+
ft_dataset_path = create_fine_tuning_details.dataset_path
|
230
|
+
if not ObjectStorageDetails.is_oci_path(ft_dataset_path):
|
231
|
+
# format: oci://<bucket>@<namespace>/<dataset_file_name>
|
232
|
+
dataset_file = os.path.basename(ft_dataset_path)
|
233
|
+
dst_uri = (
|
234
|
+
f"{create_fine_tuning_details.report_path.rstrip('/')}/{dataset_file}"
|
235
|
+
)
|
236
|
+
try:
|
237
|
+
upload_local_to_os(
|
238
|
+
src_uri=ft_dataset_path,
|
239
|
+
dst_uri=dst_uri,
|
240
|
+
auth=default_signer(),
|
241
|
+
force_overwrite=create_fine_tuning_details.force_overwrite,
|
242
|
+
)
|
243
|
+
except FileExistsError as fe:
|
244
|
+
raise AquaFileExistsError(
|
245
|
+
f"Dataset {dataset_file} already exists in {create_fine_tuning_details.report_path}. "
|
246
|
+
"Please use a new dataset file name, report path or set `force_overwrite` as True."
|
247
|
+
) from fe
|
248
|
+
logger.debug(
|
249
|
+
f"Uploaded local file {ft_dataset_path} to object storage {dst_uri}."
|
250
|
+
)
|
251
|
+
# tracks the size of dataset uploaded by user to the destination.
|
252
|
+
self.telemetry.record_event_async(
|
253
|
+
category="aqua/finetune/upload",
|
254
|
+
action="size",
|
255
|
+
detail=os.path.getsize(os.path.expanduser(ft_dataset_path)),
|
256
|
+
)
|
257
|
+
ft_dataset_path = dst_uri
|
258
|
+
|
259
|
+
(
|
260
|
+
experiment_model_version_set_id,
|
261
|
+
experiment_model_version_set_name,
|
262
|
+
) = self.create_model_version_set(
|
263
|
+
model_version_set_id=experiment_model_version_set_id,
|
264
|
+
model_version_set_name=experiment_model_version_set_name,
|
265
|
+
description=create_fine_tuning_details.experiment_description,
|
266
|
+
compartment_id=target_compartment,
|
267
|
+
project_id=target_project,
|
268
|
+
freeform_tags=create_fine_tuning_details.freeform_tags,
|
269
|
+
defined_tags=create_fine_tuning_details.defined_tags,
|
270
|
+
)
|
271
|
+
|
272
|
+
source = self.get_source(create_fine_tuning_details.ft_source_id)
|
273
|
+
|
274
|
+
ft_model_custom_metadata = ModelCustomMetadata()
|
275
|
+
ft_model_custom_metadata.add(
|
276
|
+
key=FineTuneCustomMetadata.FINE_TUNE_SOURCE,
|
277
|
+
value=create_fine_tuning_details.ft_source_id,
|
278
|
+
)
|
279
|
+
ft_model_custom_metadata.add(
|
280
|
+
key=FineTuneCustomMetadata.FINE_TUNE_SOURCE_NAME,
|
281
|
+
value=source.display_name,
|
282
|
+
)
|
283
|
+
service_model_artifact_location = source.custom_metadata_list.get(
|
284
|
+
FineTuneCustomMetadata.SERVICE_MODEL_ARTIFACT_LOCATION
|
285
|
+
)
|
286
|
+
service_model_deployment_container = source.custom_metadata_list.get(
|
287
|
+
FineTuneCustomMetadata.SERVICE_MODEL_DEPLOYMENT_CONTAINER
|
288
|
+
)
|
289
|
+
|
290
|
+
ft_model_custom_metadata.add(
|
291
|
+
key=service_model_artifact_location.key,
|
292
|
+
value=service_model_artifact_location.value,
|
293
|
+
description=service_model_artifact_location.description,
|
294
|
+
)
|
295
|
+
ft_model_custom_metadata.add(
|
296
|
+
key=service_model_deployment_container.key,
|
297
|
+
value=service_model_deployment_container.value,
|
298
|
+
description=service_model_deployment_container.description,
|
299
|
+
)
|
300
|
+
|
301
|
+
ft_model_taxonomy_metadata = ModelTaxonomyMetadata()
|
302
|
+
ft_model_taxonomy_metadata[MetadataTaxonomyKeys.HYPERPARAMETERS].value = {
|
303
|
+
**create_fine_tuning_details.ft_parameters,
|
304
|
+
"val_set_size": create_fine_tuning_details.validation_set_size,
|
305
|
+
"training_data": ft_dataset_path,
|
306
|
+
}
|
307
|
+
|
308
|
+
ft_model = self.create_model_catalog(
|
309
|
+
display_name=create_fine_tuning_details.ft_name,
|
310
|
+
description=create_fine_tuning_details.ft_description,
|
311
|
+
model_version_set_id=experiment_model_version_set_id,
|
312
|
+
model_custom_metadata=ft_model_custom_metadata,
|
313
|
+
model_taxonomy_metadata=ft_model_taxonomy_metadata,
|
314
|
+
compartment_id=target_compartment,
|
315
|
+
project_id=target_project,
|
316
|
+
model_by_reference=True,
|
317
|
+
defined_tags=create_fine_tuning_details.defined_tags,
|
318
|
+
)
|
319
|
+
defined_metadata_dict = {}
|
320
|
+
defined_metadata_list_source = source.defined_metadata_list._to_oci_metadata()
|
321
|
+
for defined_metadata in defined_metadata_list_source:
|
322
|
+
if (
|
323
|
+
defined_metadata.has_artifact
|
324
|
+
and defined_metadata.key.lower()
|
325
|
+
!= AquaModelMetadataKeys.FINE_TUNING_CONFIGURATION.lower()
|
326
|
+
):
|
327
|
+
content = self.ds_client.get_model_defined_metadatum_artifact_content(
|
328
|
+
source.id, defined_metadata.key
|
329
|
+
).data.content
|
330
|
+
defined_metadata_dict[defined_metadata.key] = content
|
331
|
+
|
332
|
+
for key, value in defined_metadata_dict.items():
|
333
|
+
ft_model.create_defined_metadata_artifact(
|
334
|
+
key, value, MetadataArtifactPathType.CONTENT
|
335
|
+
)
|
336
|
+
|
337
|
+
ft_job_freeform_tags = {
|
338
|
+
Tags.AQUA_TAG: UNKNOWN,
|
339
|
+
Tags.AQUA_FINE_TUNED_MODEL_TAG: f"{source.id}#{source.display_name}",
|
340
|
+
**(create_fine_tuning_details.freeform_tags or {}),
|
341
|
+
}
|
342
|
+
|
343
|
+
ft_job = Job(name=ft_model.display_name).with_infrastructure(
|
344
|
+
DataScienceJob()
|
345
|
+
.with_log_group_id(create_fine_tuning_details.log_group_id)
|
346
|
+
.with_log_id(create_fine_tuning_details.log_id)
|
347
|
+
.with_compartment_id(target_compartment)
|
348
|
+
.with_project_id(target_project)
|
349
|
+
.with_shape_name(create_fine_tuning_details.shape_name)
|
350
|
+
.with_block_storage_size(
|
351
|
+
create_fine_tuning_details.block_storage_size
|
352
|
+
or DEFAULT_FT_BLOCK_STORAGE_SIZE
|
353
|
+
)
|
354
|
+
.with_freeform_tag(**ft_job_freeform_tags)
|
355
|
+
.with_defined_tag(**(create_fine_tuning_details.defined_tags or {}))
|
356
|
+
)
|
357
|
+
|
358
|
+
if not subnet_id:
|
359
|
+
# apply default subnet id for job by setting ME_STANDALONE
|
360
|
+
# so as to avoid using the notebook session's networking when running on it
|
361
|
+
# https://accelerated-data-science.readthedocs.io/en/latest/user_guide/jobs/infra_and_runtime.html#networking
|
362
|
+
ft_job.infrastructure.with_job_infrastructure_type(
|
363
|
+
JOB_INFRASTRUCTURE_TYPE_DEFAULT_NETWORKING
|
364
|
+
)
|
365
|
+
else:
|
366
|
+
ft_job.infrastructure.with_subnet_id(subnet_id)
|
367
|
+
|
368
|
+
ft_config = self.get_finetuning_config(source.id)
|
369
|
+
|
370
|
+
ft_container = source.custom_metadata_list.get(
|
371
|
+
FineTuneCustomMetadata.SERVICE_MODEL_FINE_TUNE_CONTAINER
|
372
|
+
).value
|
373
|
+
is_custom_container = False
|
374
|
+
try:
|
375
|
+
# Check if the container override flag is set. If set, then the user has chosen custom image
|
376
|
+
if source.custom_metadata_list.get(
|
377
|
+
AQUA_FINETUNING_CONTAINER_OVERRIDE_FLAG_METADATA_NAME
|
378
|
+
).value:
|
379
|
+
is_custom_container = True
|
380
|
+
except Exception:
|
381
|
+
pass
|
382
|
+
|
383
|
+
if not is_custom_container and ENV_AQUA_FINE_TUNING_CONTAINER in os.environ:
|
384
|
+
ft_container = os.environ[ENV_AQUA_FINE_TUNING_CONTAINER]
|
385
|
+
logger.info(
|
386
|
+
"Using container set by environment variable %s=%s",
|
387
|
+
ENV_AQUA_FINE_TUNING_CONTAINER,
|
388
|
+
ft_container,
|
389
|
+
)
|
390
|
+
is_custom_container = True
|
391
|
+
|
392
|
+
ft_parameters.batch_size = ft_parameters.batch_size or (
|
393
|
+
(ft_config.shape if ft_config else UNKNOWN_DICT)
|
394
|
+
.get(create_fine_tuning_details.shape_name, UNKNOWN_DICT)
|
395
|
+
.get("batch_size", DEFAULT_FT_BATCH_SIZE)
|
396
|
+
)
|
397
|
+
finetuning_params = ft_config.finetuning_params if ft_config else UNKNOWN
|
398
|
+
|
399
|
+
ft_job.with_runtime(
|
400
|
+
self._build_fine_tuning_runtime(
|
401
|
+
source_id=source.id,
|
402
|
+
ft_model_id=ft_model.id,
|
403
|
+
dataset_path=ft_dataset_path,
|
404
|
+
report_path=create_fine_tuning_details.report_path,
|
405
|
+
replica=create_fine_tuning_details.replica,
|
406
|
+
finetuning_params=finetuning_params,
|
407
|
+
val_set_size=(
|
408
|
+
create_fine_tuning_details.validation_set_size
|
409
|
+
or DEFAULT_FT_VALIDATION_SET_SIZE
|
410
|
+
),
|
411
|
+
parameters=ft_parameters,
|
412
|
+
ft_container=ft_container,
|
413
|
+
is_custom_container=is_custom_container,
|
414
|
+
)
|
415
|
+
).create()
|
416
|
+
logger.debug(
|
417
|
+
f"Successfully created fine tuning job {ft_job.id} for {create_fine_tuning_details.ft_source_id}."
|
418
|
+
)
|
419
|
+
|
420
|
+
ft_job_run = ft_job.run(
|
421
|
+
name=ft_model.display_name,
|
422
|
+
freeform_tags=ft_job_freeform_tags,
|
423
|
+
defined_tags=create_fine_tuning_details.defined_tags or {},
|
424
|
+
wait=False,
|
425
|
+
)
|
426
|
+
logger.debug(
|
427
|
+
f"Successfully created fine tuning job run {ft_job_run.id} for {create_fine_tuning_details.ft_source_id}."
|
428
|
+
)
|
429
|
+
|
430
|
+
ft_model_custom_metadata.add(
|
431
|
+
key=FineTuneCustomMetadata.FINE_TUNE_JOB_ID,
|
432
|
+
value=ft_job.id,
|
433
|
+
)
|
434
|
+
ft_model_custom_metadata.add(
|
435
|
+
key=FineTuneCustomMetadata.FINE_TUNE_JOB_RUN_ID,
|
436
|
+
value=ft_job_run.id,
|
437
|
+
)
|
438
|
+
updated_custom_metadata_list = [
|
439
|
+
Metadata(**metadata)
|
440
|
+
for metadata in ft_model_custom_metadata.to_dict()["data"]
|
441
|
+
]
|
442
|
+
|
443
|
+
model_freeform_tags = source.freeform_tags or {}
|
444
|
+
model_freeform_tags.pop(Tags.LICENSE, None)
|
445
|
+
model_freeform_tags.pop(Tags.BASE_MODEL_CUSTOM, None)
|
446
|
+
|
447
|
+
model_freeform_tags = {
|
448
|
+
**model_freeform_tags,
|
449
|
+
Tags.READY_TO_FINE_TUNE: "false",
|
450
|
+
Tags.AQUA_TAG: UNKNOWN,
|
451
|
+
Tags.AQUA_FINE_TUNED_MODEL_TAG: f"{source.id}#{source.display_name}",
|
452
|
+
**(create_fine_tuning_details.freeform_tags or {}),
|
453
|
+
}
|
454
|
+
|
455
|
+
self.update_model(
|
456
|
+
model_id=ft_model.id,
|
457
|
+
update_model_details=UpdateModelDetails(
|
458
|
+
custom_metadata_list=updated_custom_metadata_list,
|
459
|
+
freeform_tags=model_freeform_tags,
|
460
|
+
),
|
461
|
+
)
|
462
|
+
logger.debug(
|
463
|
+
f"Successfully updated model custom metadata list and freeform tags for the model {ft_model.id}."
|
464
|
+
)
|
465
|
+
|
466
|
+
self.update_model_provenance(
|
467
|
+
model_id=ft_model.id,
|
468
|
+
update_model_provenance_details=UpdateModelProvenanceDetails(
|
469
|
+
training_id=ft_job_run.id
|
470
|
+
),
|
471
|
+
)
|
472
|
+
logger.debug(
|
473
|
+
f"Successfully updated model provenance for the model {ft_model.id}."
|
474
|
+
)
|
475
|
+
|
476
|
+
# tracks the shape and replica used for fine-tuning the service models
|
477
|
+
telemetry_kwargs = (
|
478
|
+
{"ocid": ft_job.id[-6:]} if ft_job and len(ft_job.id) > 6 else {}
|
479
|
+
)
|
480
|
+
# track shapes that were used for fine-tune creation
|
481
|
+
self.telemetry.record_event_async(
|
482
|
+
category="aqua/service/finetune/create/shape/",
|
483
|
+
action=f"{create_fine_tuning_details.shape_name}x{create_fine_tuning_details.replica}",
|
484
|
+
**telemetry_kwargs,
|
485
|
+
)
|
486
|
+
# tracks unique fine-tuned models that were created in the user compartment
|
487
|
+
# TODO: retrieve the service model name for FT custom models.
|
488
|
+
self.telemetry.record_event_async(
|
489
|
+
category="aqua/service/finetune",
|
490
|
+
action="create",
|
491
|
+
detail=source.display_name,
|
492
|
+
**telemetry_kwargs,
|
493
|
+
)
|
494
|
+
# track combination of model and shape used for fine-tune creation
|
495
|
+
self.telemetry.record_event_async(
|
496
|
+
category="aqua/service/finetune/create",
|
497
|
+
action="shape",
|
498
|
+
detail=f"{create_fine_tuning_details.shape_name}x{create_fine_tuning_details.replica}",
|
499
|
+
value=source.display_name,
|
500
|
+
)
|
501
|
+
|
502
|
+
if create_fine_tuning_details.watch_logs:
|
503
|
+
logger.info(
|
504
|
+
f"Watching fine-tuning job run logs for {ft_job_run.id}. Press Ctrl+C to stop watching logs.\n"
|
505
|
+
)
|
506
|
+
try:
|
507
|
+
ft_job_run.watch()
|
508
|
+
except KeyboardInterrupt:
|
509
|
+
logger.info(f"\nStopped watching logs for {ft_job_run.id}.\n")
|
510
|
+
time.sleep(1)
|
511
|
+
except Exception:
|
512
|
+
logger.debug(
|
513
|
+
f"Something unexpected occurred while watching logs.\n{traceback.format_exc()}"
|
514
|
+
)
|
515
|
+
|
516
|
+
return AquaFineTuningSummary(
|
517
|
+
id=ft_model.id,
|
518
|
+
name=ft_model.display_name,
|
519
|
+
console_url=get_console_link(
|
520
|
+
resource=Resource.MODEL,
|
521
|
+
ocid=ft_model.id,
|
522
|
+
region=self.region,
|
523
|
+
),
|
524
|
+
time_created=str(ft_model.time_created),
|
525
|
+
lifecycle_state=ft_job_run.lifecycle_state or UNKNOWN,
|
526
|
+
lifecycle_details=ft_job_run.lifecycle_details or UNKNOWN,
|
527
|
+
experiment=AquaResourceIdentifier(
|
528
|
+
id=experiment_model_version_set_id,
|
529
|
+
name=experiment_model_version_set_name,
|
530
|
+
url=get_console_link(
|
531
|
+
resource=Resource.MODEL_VERSION_SET,
|
532
|
+
ocid=experiment_model_version_set_id,
|
533
|
+
region=self.region,
|
534
|
+
),
|
535
|
+
),
|
536
|
+
source=AquaResourceIdentifier(
|
537
|
+
id=source.id,
|
538
|
+
name=source.display_name,
|
539
|
+
url=get_console_link(
|
540
|
+
resource=Resource.MODEL,
|
541
|
+
ocid=source.id,
|
542
|
+
region=self.region,
|
543
|
+
),
|
544
|
+
),
|
545
|
+
job=AquaResourceIdentifier(
|
546
|
+
id=ft_job.id,
|
547
|
+
name=ft_job.name,
|
548
|
+
url=get_console_link(
|
549
|
+
resource=Resource.JOB,
|
550
|
+
ocid=ft_job.id,
|
551
|
+
region=self.region,
|
552
|
+
),
|
553
|
+
),
|
554
|
+
tags={
|
555
|
+
"aqua_finetuning": Tags.AQUA_FINE_TUNING,
|
556
|
+
"finetuning_job_id": ft_job.id,
|
557
|
+
"finetuning_source": source.id,
|
558
|
+
"finetuning_experiment_id": experiment_model_version_set_id,
|
559
|
+
**model_freeform_tags,
|
560
|
+
**(create_fine_tuning_details.defined_tags or {}),
|
561
|
+
},
|
562
|
+
parameters=ft_parameters,
|
563
|
+
)
|
564
|
+
|
565
|
+
def _build_fine_tuning_runtime(
|
566
|
+
self,
|
567
|
+
source_id: str,
|
568
|
+
ft_model_id: str,
|
569
|
+
dataset_path: str,
|
570
|
+
report_path: str,
|
571
|
+
replica: int,
|
572
|
+
val_set_size: float,
|
573
|
+
parameters: AquaFineTuningParams,
|
574
|
+
ft_container: str = None,
|
575
|
+
finetuning_params: str = None,
|
576
|
+
is_custom_container: bool = False,
|
577
|
+
) -> Runtime:
|
578
|
+
"""Builds fine tuning runtime for Job."""
|
579
|
+
container = (
|
580
|
+
self.get_container_image(
|
581
|
+
container_type=ft_container,
|
582
|
+
)
|
583
|
+
if not is_custom_container
|
584
|
+
else ft_container
|
585
|
+
)
|
586
|
+
runtime = (
|
587
|
+
ContainerRuntime()
|
588
|
+
.with_environment_variable(
|
589
|
+
**{
|
590
|
+
"AIP_SMC_FT_ARGUMENTS": json.dumps(
|
591
|
+
{
|
592
|
+
"baseModel": {"type": "modelCatalog", "modelId": source_id},
|
593
|
+
"outputModel": {
|
594
|
+
"type": "modelCatalog",
|
595
|
+
"modelId": ft_model_id,
|
596
|
+
},
|
597
|
+
}
|
598
|
+
),
|
599
|
+
"OCI__LAUNCH_CMD": self._build_oci_launch_cmd(
|
600
|
+
dataset_path=dataset_path,
|
601
|
+
report_path=report_path,
|
602
|
+
val_set_size=val_set_size,
|
603
|
+
parameters=parameters,
|
604
|
+
finetuning_params=finetuning_params,
|
605
|
+
),
|
606
|
+
"CONDA_BUCKET_NS": CONDA_BUCKET_NS,
|
607
|
+
}
|
608
|
+
)
|
609
|
+
.with_image(image=container)
|
610
|
+
.with_replica(replica)
|
611
|
+
)
|
612
|
+
|
613
|
+
return runtime
|
614
|
+
|
615
|
+
@staticmethod
|
616
|
+
def _build_oci_launch_cmd(
|
617
|
+
dataset_path: str,
|
618
|
+
report_path: str,
|
619
|
+
val_set_size: float,
|
620
|
+
parameters: AquaFineTuningParams,
|
621
|
+
finetuning_params: str = None,
|
622
|
+
) -> str:
|
623
|
+
"""Builds the oci launch cmd for fine tuning container runtime."""
|
624
|
+
oci_launch_cmd = f"--training_data {dataset_path} --output_dir {report_path} --val_set_size {val_set_size} "
|
625
|
+
for key, value in parameters.to_dict().items():
|
626
|
+
if value is not None:
|
627
|
+
if key == "batch_size":
|
628
|
+
oci_launch_cmd += f"--micro_{key} {value} "
|
629
|
+
elif key == "epochs":
|
630
|
+
oci_launch_cmd += f"--num_{key} {value} "
|
631
|
+
elif key == "lora_target_modules":
|
632
|
+
oci_launch_cmd += f"--{key} {','.join(str(k) for k in value)} "
|
633
|
+
elif key == "early_stopping_patience":
|
634
|
+
if value != 0:
|
635
|
+
oci_launch_cmd += f"--{key} {value} "
|
636
|
+
elif key == "early_stopping_threshold":
|
637
|
+
if "early_stopping_patience" in oci_launch_cmd:
|
638
|
+
oci_launch_cmd += f"--{key} {value} "
|
639
|
+
else:
|
640
|
+
oci_launch_cmd += f"--{key} {value} "
|
641
|
+
|
642
|
+
oci_launch_cmd += f"{finetuning_params}" if finetuning_params else ""
|
643
|
+
return oci_launch_cmd.rstrip()
|
644
|
+
|
645
|
+
@telemetry(
|
646
|
+
entry_point="plugin=finetuning&action=get_finetuning_config", name="aqua"
|
647
|
+
)
|
648
|
+
def get_finetuning_config(self, model_id: str) -> AquaFineTuningConfig:
|
649
|
+
"""Gets the finetuning config for given Aqua model.
|
650
|
+
|
651
|
+
Parameters
|
652
|
+
----------
|
653
|
+
model_id: str
|
654
|
+
The OCID of the Aqua model.
|
655
|
+
|
656
|
+
Returns
|
657
|
+
-------
|
658
|
+
Dict:
|
659
|
+
A dict of allowed finetuning configs.
|
660
|
+
"""
|
661
|
+
config = self.get_config_from_metadata(
|
662
|
+
model_id, AquaModelMetadataKeys.FINE_TUNING_CONFIGURATION
|
663
|
+
).config
|
664
|
+
if config:
|
665
|
+
logger.info(
|
666
|
+
f"Fetched {AquaModelMetadataKeys.FINE_TUNING_CONFIGURATION} from defined metadata for model: {model_id}."
|
667
|
+
)
|
668
|
+
return AquaFineTuningConfig(**(config or UNKNOWN_DICT))
|
669
|
+
config = self.get_config(
|
670
|
+
model_id,
|
671
|
+
DEFINED_METADATA_TO_FILE_MAP.get(
|
672
|
+
AquaModelMetadataKeys.FINE_TUNING_CONFIGURATION.lower()
|
673
|
+
),
|
674
|
+
).config
|
675
|
+
if not config:
|
676
|
+
logger.debug(
|
677
|
+
f"Fine-tuning config for custom model: {model_id} is not available. Use defaults."
|
678
|
+
)
|
679
|
+
return AquaFineTuningConfig(**(config or UNKNOWN_DICT))
|
680
|
+
|
681
|
+
@telemetry(
|
682
|
+
entry_point="plugin=finetuning&action=get_finetuning_default_params",
|
683
|
+
name="aqua",
|
684
|
+
)
|
685
|
+
def get_finetuning_default_params(self, model_id: str) -> Dict:
|
686
|
+
"""Gets the default params set in the finetuning configs for the given model. Only the fields that are
|
687
|
+
available in AquaFineTuningParams will be accessible for user overrides.
|
688
|
+
|
689
|
+
Parameters
|
690
|
+
----------
|
691
|
+
model_id: str
|
692
|
+
The OCID of the Aqua model.
|
693
|
+
|
694
|
+
Returns
|
695
|
+
-------
|
696
|
+
Dict:
|
697
|
+
Dict of parameters from the loaded from finetuning config json file. If config information is not available,
|
698
|
+
then an empty dict is returned.
|
699
|
+
"""
|
700
|
+
default_params = {"params": {}}
|
701
|
+
finetuning_config = self.get_finetuning_config(model_id)
|
702
|
+
config_parameters = (
|
703
|
+
finetuning_config.configuration if finetuning_config else UNKNOWN_DICT
|
704
|
+
)
|
705
|
+
dataclass_fields = self._get_finetuning_params(
|
706
|
+
config_parameters, validate=False
|
707
|
+
).to_dict()
|
708
|
+
for name, value in config_parameters.items():
|
709
|
+
if name in dataclass_fields:
|
710
|
+
if name == "micro_batch_size":
|
711
|
+
name = "batch_size"
|
712
|
+
default_params["params"][name] = value
|
713
|
+
|
714
|
+
return default_params
|
715
|
+
|
716
|
+
@staticmethod
|
717
|
+
def _get_finetuning_params(
|
718
|
+
params: Dict = None, validate: bool = True
|
719
|
+
) -> AquaFineTuningParams:
|
720
|
+
"""
|
721
|
+
Get and validate the fine-tuning params, and return an error message if validation fails. In order to skip
|
722
|
+
@model_validator decorator's validation, pass validate=False.
|
723
|
+
"""
|
724
|
+
try:
|
725
|
+
finetuning_params = AquaFineTuningParams(
|
726
|
+
**{**params, **{"_validate": validate}}
|
727
|
+
)
|
728
|
+
except ValidationError as ex:
|
729
|
+
custom_errors = build_pydantic_error_message(ex)
|
730
|
+
raise AquaValueError(
|
731
|
+
f"Invalid finetuning parameters. Error details: {custom_errors}."
|
732
|
+
) from ex
|
733
|
+
return finetuning_params
|
734
|
+
|
735
|
+
def validate_finetuning_params(self, params: Dict = None) -> Dict:
|
736
|
+
"""Validate if the fine-tuning parameters passed by the user can be overridden. Parameter values are not
|
737
|
+
validated, only param keys are validated.
|
738
|
+
|
739
|
+
Parameters
|
740
|
+
----------
|
741
|
+
params :Dict, optional
|
742
|
+
Params passed by the user.
|
743
|
+
|
744
|
+
Returns
|
745
|
+
-------
|
746
|
+
Return a list of restricted params.
|
747
|
+
"""
|
748
|
+
self._get_finetuning_params(params or {})
|
749
|
+
return {"valid": True}
|