azureml-acft-multimodal-components 0.0.71__py3-none-any.whl → 0.0.73__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.
- azureml/acft/multimodal/components/_version.py +2 -2
- azureml/acft/multimodal/components/utils/model_selector_utils.py +4 -58
- {azureml_acft_multimodal_components-0.0.71.dist-info → azureml_acft_multimodal_components-0.0.73.dist-info}/METADATA +1 -1
- {azureml_acft_multimodal_components-0.0.71.dist-info → azureml_acft_multimodal_components-0.0.73.dist-info}/RECORD +7 -7
- {azureml_acft_multimodal_components-0.0.71.dist-info → azureml_acft_multimodal_components-0.0.73.dist-info}/WHEEL +1 -1
- {azureml_acft_multimodal_components-0.0.71.dist-info → azureml_acft_multimodal_components-0.0.73.dist-info}/licenses/LICENSE.txt +0 -0
- {azureml_acft_multimodal_components-0.0.71.dist-info → azureml_acft_multimodal_components-0.0.73.dist-info}/top_level.txt +0 -0
@@ -1,2 +1,2 @@
|
|
1
|
-
ver = "0.0.
|
2
|
-
selfver = "0.0.
|
1
|
+
ver = "0.0.73"
|
2
|
+
selfver = "0.0.73"
|
@@ -11,15 +11,13 @@ from typing import Dict, Any, Union
|
|
11
11
|
import shutil
|
12
12
|
import yaml
|
13
13
|
import json
|
14
|
-
from azure.identity import DefaultAzureCredential
|
15
|
-
from azure.ai.ml import MLClient
|
16
14
|
|
17
15
|
from azureml.acft.common_components import get_logger_app
|
18
16
|
from azureml.acft.accelerator.utils.error_handling.exceptions import LLMException
|
19
|
-
from azureml.acft.accelerator.utils.error_handling.error_definitions import LLMInternalError
|
17
|
+
from azureml.acft.accelerator.utils.error_handling.error_definitions import LLMInternalError, MissingData
|
20
18
|
from azureml._common._error_definition.azureml_error import AzureMLError # type: ignore
|
21
19
|
from azureml.acft.multimodal.components.constants.constants import SaveFileConstants, MLFlowHFFlavourConstants, \
|
22
|
-
MLFlowPyfuncLiterals
|
20
|
+
MLFlowPyfuncLiterals
|
23
21
|
|
24
22
|
logger = get_logger_app(__name__)
|
25
23
|
|
@@ -221,50 +219,6 @@ def convert_pyfunc_mlflow_to_pytorch_model(mlflow_model_path: str, download_dir:
|
|
221
219
|
)
|
222
220
|
|
223
221
|
|
224
|
-
def download_model_from_registry(model_name: str, download_dir: str):
|
225
|
-
"""
|
226
|
-
downloads mlflow models from azureml-preview registry
|
227
|
-
"""
|
228
|
-
# in azure-ai-ml-1.0.0 DefaultAzureCredential handles ManagedIdentityCredential internally
|
229
|
-
client_id = os.environ.get("DEFAULT_IDENTITY_CLIENT_ID", None)
|
230
|
-
if client_id:
|
231
|
-
logger.info("Using DEFAULT_IDENTITY_CLIENT_ID")
|
232
|
-
credential = DefaultAzureCredential(managed_identity_client_id=client_id)
|
233
|
-
else:
|
234
|
-
credential = DefaultAzureCredential()
|
235
|
-
registry_mlclient = MLClient(credential=credential, registry_name=MODEL_REGISTRY_NAME)
|
236
|
-
registry_models_list = registry_mlclient.models.list(name=model_name)
|
237
|
-
registry_models_versions = [int(model.version) for model in registry_models_list]
|
238
|
-
|
239
|
-
# download the model from registry - mlflow model
|
240
|
-
model_tmp_download_path = os.path.join(download_dir, "azuremlft_download")
|
241
|
-
if len(registry_models_versions) > 0:
|
242
|
-
model_version = str(max(registry_models_versions))
|
243
|
-
registry_mlclient.models.download(
|
244
|
-
name=model_name,
|
245
|
-
version=model_version,
|
246
|
-
download_path=model_tmp_download_path,
|
247
|
-
)
|
248
|
-
logger.info(f"Model {model_name}/{model_version} is downloaded")
|
249
|
-
mlflow_model_dir = os.path.join(
|
250
|
-
model_tmp_download_path, model_name,
|
251
|
-
MLFlowHFFlavourConstants.MODEL_ROOT_DIRECTORY
|
252
|
-
)
|
253
|
-
model_save_path = os.path.join(download_dir, model_name)
|
254
|
-
# convert mlflow model to pytorch model and save it to model_save_path
|
255
|
-
if model_name == ModelTypes.MMEFT:
|
256
|
-
convert_pyfunc_mlflow_to_pytorch_model(mlflow_model_dir, model_save_path)
|
257
|
-
else:
|
258
|
-
convert_hf_mlflow_to_pytorch_model(mlflow_model_dir, model_save_path)
|
259
|
-
else:
|
260
|
-
raise LLMException._with_error(
|
261
|
-
AzureMLError.create(
|
262
|
-
LLMInternalError,
|
263
|
-
error="Model not found in registry"
|
264
|
-
)
|
265
|
-
)
|
266
|
-
|
267
|
-
|
268
222
|
def model_selector(model_selector_args: Dict[str, Any]):
|
269
223
|
"""
|
270
224
|
Downloads model from azureml-preview registry if present
|
@@ -315,16 +269,8 @@ def model_selector(model_selector_args: Dict[str, Any]):
|
|
315
269
|
else:
|
316
270
|
convert_hf_mlflow_to_pytorch_model(mlflow_model_path, download_dir)
|
317
271
|
else:
|
318
|
-
|
319
|
-
|
320
|
-
download_model_from_registry(model_selector_args["model_name"], model_selector_args["output_dir"])
|
321
|
-
except Exception as e:
|
322
|
-
# TODO Check why shutil rmtree is called
|
323
|
-
# shutil.rmtree(model_selector_args["output_dir"], ignore_errors=True)
|
324
|
-
logger.info(
|
325
|
-
f'Unable to download model, will fetch {model_selector_args["model_name"]} model while fine-tuning',
|
326
|
-
exc_info=True
|
327
|
-
)
|
272
|
+
logger.error("missing mlflow and pytorch model path")
|
273
|
+
raise LLMException._with_error(AzureMLError.create(MissingData, data_argument_name="model_path"))
|
328
274
|
|
329
275
|
# Saving model selector args
|
330
276
|
model_selector_args_save_path = os.path.join(model_selector_args["output_dir"],
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: azureml-acft-multimodal-components
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.73
|
4
4
|
Summary: Contains the acft multimodal-contrib package used in script to build azureml components.
|
5
5
|
Home-page: https://msdata.visualstudio.com/Vienna/_git/sdk-cli-v2?version=GBtraining_finetune
|
6
6
|
Author: Microsoft Corp
|
@@ -3,7 +3,7 @@ azureml/acft/__init__.py,sha256=9yEu-iBWQHMmb7eapxBKtSs5hHWMDIZeGhXEntYSp4w,267
|
|
3
3
|
azureml/acft/multimodal/__init__.py,sha256=9yEu-iBWQHMmb7eapxBKtSs5hHWMDIZeGhXEntYSp4w,267
|
4
4
|
azureml/acft/multimodal/components/NOTICE.txt,sha256=Wi77VU9zlsSpIoTfQyhQ73Nwze4miS9YDG4rcI6izo4,530804
|
5
5
|
azureml/acft/multimodal/components/__init__.py,sha256=qC5hRHbTbRwhm4xSfuFpDl0ungDu3rxgX7bfPsaTQVA,792
|
6
|
-
azureml/acft/multimodal/components/_version.py,sha256=
|
6
|
+
azureml/acft/multimodal/components/_version.py,sha256=460oVXNPkTgYSIwCfjue87z_SkQZ1QBpeU9uOw1V1jk,36
|
7
7
|
azureml/acft/multimodal/components/base_runner.py,sha256=DpEqtXoO1iwqd5EJtjXauZ_D3C2LLLoqT2wYw-84YDg,1235
|
8
8
|
azureml/acft/multimodal/components/task_factory.py,sha256=Ar4emx5xmw72NZKkDzw6tdixw9d6PiGTSa1CsleyqKY,980
|
9
9
|
azureml/acft/multimodal/components/artifacts/__init__.py,sha256=ouf2rAWSHFJAg_qtQ9B9JwI7xakZ69hDiMGqpDuzL-c,298
|
@@ -49,10 +49,10 @@ azureml/acft/multimodal/components/tasks/multimodal_classification/preprocess/au
|
|
49
49
|
azureml/acft/multimodal/components/tasks/multimodal_classification/preprocess/preprocess_for_finetune.py,sha256=1HP-HegyMJywUvEfuXxMWXdTBxkNJM3Za18ZTLtDfYs,11999
|
50
50
|
azureml/acft/multimodal/components/utils/__init__.py,sha256=9yEu-iBWQHMmb7eapxBKtSs5hHWMDIZeGhXEntYSp4w,267
|
51
51
|
azureml/acft/multimodal/components/utils/common_utils.py,sha256=CDqbSGlQHedatUXOnjPV8cAcW1-BKap48R4g-D-4Va8,2105
|
52
|
-
azureml/acft/multimodal/components/utils/model_selector_utils.py,sha256=
|
52
|
+
azureml/acft/multimodal/components/utils/model_selector_utils.py,sha256=GuckKzNcOmjc2hFqVEGZiEElhJGzqNR2borBE7k6xmE,10318
|
53
53
|
azureml/acft/multimodal/components/utils/trainer_callbacks.py,sha256=3ElNRjxp8Ipt2xC-NQUEy676FLd26K0URB7aPRK2p2c,5795
|
54
|
-
azureml_acft_multimodal_components-0.0.
|
55
|
-
azureml_acft_multimodal_components-0.0.
|
56
|
-
azureml_acft_multimodal_components-0.0.
|
57
|
-
azureml_acft_multimodal_components-0.0.
|
58
|
-
azureml_acft_multimodal_components-0.0.
|
54
|
+
azureml_acft_multimodal_components-0.0.73.dist-info/licenses/LICENSE.txt,sha256=GBoIyZ-6vJ4xjRc8U3wTw4EfkuaEdVTm_gbr1Nm8uDI,859
|
55
|
+
azureml_acft_multimodal_components-0.0.73.dist-info/METADATA,sha256=vt01PxC4S8hAlaDExQRfIMLebb36uE02iEQo8QFjMt4,2074
|
56
|
+
azureml_acft_multimodal_components-0.0.73.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
57
|
+
azureml_acft_multimodal_components-0.0.73.dist-info/top_level.txt,sha256=ZOeEa0TAXo6i5wOjwBoqfIGEuxOcKuscGgNSpizqREY,8
|
58
|
+
azureml_acft_multimodal_components-0.0.73.dist-info/RECORD,,
|
File without changes
|