diff --git a/.github/workflows/assets-docs.yaml b/.github/workflows/assets-docs.yaml index 4ed96fdb60..770fd48ee5 100644 --- a/.github/workflows/assets-docs.yaml +++ b/.github/workflows/assets-docs.yaml @@ -59,7 +59,7 @@ jobs: - name: Use Python 3.10 or newer uses: actions/setup-python@v4 with: - python-version: '>=3.10,<3.13' + python-version: '3.12' - name: Install dependencies run: pip install -e $main_dir/$scripts_azureml_assets_dir -r $main_dir/$scripts_docs_dir/requirements.txt diff --git a/.github/workflows/assets-release.yaml b/.github/workflows/assets-release.yaml index 42816f049a..9fb2b40e51 100644 --- a/.github/workflows/assets-release.yaml +++ b/.github/workflows/assets-release.yaml @@ -60,7 +60,7 @@ jobs: - name: Use Python 3.10 or newer uses: actions/setup-python@v4 with: - python-version: '>=3.10' + python-version: '3.12' - name: Install dependencies run: pip install -e $main_dir/$scripts_azureml_assets_dir @@ -225,7 +225,7 @@ jobs: - name: Use Python 3.10 or newer uses: actions/setup-python@v4 with: - python-version: '>=3.10' + python-version: '3.12' - name: Install dependencies run: pip install -e $main_dir/$scripts_azureml_assets_dir diff --git a/.github/workflows/assets-test.yaml b/.github/workflows/assets-test.yaml index e51f1563fc..81003ab68b 100644 --- a/.github/workflows/assets-test.yaml +++ b/.github/workflows/assets-test.yaml @@ -118,7 +118,7 @@ jobs: - name: Use Python 3.10 or newer uses: actions/setup-python@v4 with: - python-version: '>=3.10' + python-version: '3.12' - name: Install dependencies run: pip install -e $scripts_azureml_assets_dir diff --git a/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/asset.yaml b/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/asset.yaml deleted file mode 100644 index 8b41182f70..0000000000 --- a/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/asset.yaml +++ /dev/null @@ -1,12 +0,0 @@ -name: minimal-py39-inference - -version: auto -type: environment -spec: spec.yaml -extra_config: environment.yaml -test: - pytest: - enabled: true - pip_requirements: tests/requirements.txt - tests_dir: tests -categories: ["Inference"] \ No newline at end of file diff --git a/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/context/Dockerfile b/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/context/Dockerfile deleted file mode 100644 index a68c36a763..0000000000 --- a/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/context/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -FROM mcr.microsoft.com/azureml/inference-base-2004:{{latest-image-tag}} - -WORKDIR / -ENV AZUREML_CONDA_ENVIRONMENT_PATH=/azureml-envs/minimal -ENV AZUREML_CONDA_DEFAULT_ENVIRONMENT=$AZUREML_CONDA_ENVIRONMENT_PATH - -# Prepend path to AzureML conda environment -ENV PATH $AZUREML_CONDA_ENVIRONMENT_PATH/bin:$PATH - -ENV LD_LIBRARY_PATH $AZUREML_CONDA_ENVIRONMENT_PATH/lib:$LD_LIBRARY_PATH - -# Create conda environment -USER root -RUN sed -i '66,148d' /var/runit/gunicorn/run -COPY conda_dependencies.yaml . -RUN conda env create -p $AZUREML_CONDA_ENVIRONMENT_PATH -f conda_dependencies.yaml -q && \ - rm conda_dependencies.yaml && \ - conda run -p $AZUREML_CONDA_ENVIRONMENT_PATH pip cache purge && \ - conda clean -a -y -USER dockeruser - -CMD [ "runsvdir", "/var/runit" ] \ No newline at end of file diff --git a/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/context/conda_dependencies.yaml b/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/context/conda_dependencies.yaml deleted file mode 100644 index 77a2b1191f..0000000000 --- a/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/context/conda_dependencies.yaml +++ /dev/null @@ -1,9 +0,0 @@ -name: minimal -channels: -- conda-forge -- anaconda -dependencies: -- python=3.9.13 -- pip -- pip: - - azureml-inference-server-http=={{latest-pypi-version}} \ No newline at end of file diff --git a/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/environment.yaml b/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/environment.yaml deleted file mode 100644 index 1f9b3fd98f..0000000000 --- a/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/environment.yaml +++ /dev/null @@ -1,12 +0,0 @@ -image: - name: azureml/curated/minimal-py39-inference - os: linux - context: - dir: context - dockerfile: Dockerfile - template_files: - - Dockerfile - - conda_dependencies.yaml - publish: - location: mcr - visibility: public diff --git a/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/spec.yaml b/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/spec.yaml deleted file mode 100644 index 518d9c61f7..0000000000 --- a/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/spec.yaml +++ /dev/null @@ -1,18 +0,0 @@ -$schema: https://azuremlschemas.azureedge.net/latest/environment.schema.json - -description: >- - AzureML minimal/Ubuntu 20.04/Python 3.9 cpu environment. - -name: "{{asset.name}}" -version: "{{asset.version}}" - -build: - path: "{{image.context.path}}" - dockerfile_path: "{{image.dockerfile.path}}" - -os_type: linux - -tags: - OS: Ubuntu20.04 - Inferencing: "" - Preview: "" diff --git a/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/tests/minimal_inference_test.py b/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/tests/minimal_inference_test.py deleted file mode 100644 index b3595a5e51..0000000000 --- a/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/tests/minimal_inference_test.py +++ /dev/null @@ -1,81 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -"""Tests running a sample job in the minimal 20.04 py39 cpu environment.""" -import os -import time -from pathlib import Path -from azure.ai.ml import command, MLClient -from azure.ai.ml._restclient.models import JobStatus -from azure.ai.ml.entities import Environment, BuildContext -from azure.identity import AzureCliCredential - -BUILD_CONTEXT = Path("../context") -JOB_SOURCE_CODE = "src" -TIMEOUT_MINUTES = os.environ.get("timeout_minutes", 30) -STD_LOG = Path("artifacts/user_logs/std_log.txt") - - -def test_minimal_cpu_inference(): - """Tests a sample job using minimal 20.04 py39 cpu as the environment.""" - this_dir = Path(__file__).parent - - subscription_id = os.environ.get("subscription_id") - resource_group = os.environ.get("resource_group") - workspace_name = os.environ.get("workspace") - - ml_client = MLClient( - AzureCliCredential(), subscription_id, resource_group, workspace_name - ) - - env_name = "minimal_cpu_inference" - - env_docker_context = Environment( - build=BuildContext(path=this_dir / BUILD_CONTEXT), - name=env_name, - description="minimal 20.04 py39 cpu inference environment created from a Docker context.", - ) - returned_env = ml_client.environments.create_or_update(env_docker_context) - - # create the command - job = command( - code=this_dir / JOB_SOURCE_CODE, # local path where the code is stored - command="python main.py --score ${{inputs.score}}", - inputs=dict( - score="valid_score.py", - ), - environment=returned_env, - compute=os.environ.get("cpu_cluster"), - display_name="minimal-cpu-inference-example", - description="A test run of the minimal 20.04 py39 cpu inference curated environment", - experiment_name="minimalCPUInferenceExperiment" - ) - - returned_job = ml_client.create_or_update(job) - assert returned_job is not None - - # Poll until final status is reached or timed out - timeout = time.time() + (TIMEOUT_MINUTES * 60) - while time.time() <= timeout: - job = ml_client.jobs.get(returned_job.name) - status = job.status - if status in [JobStatus.COMPLETED, JobStatus.FAILED]: - break - time.sleep(30) # sleep 30 seconds - else: - # Timeout - ml_client.jobs.cancel(returned_job.name) - raise Exception(f"Test aborted because the job took longer than {TIMEOUT_MINUTES} minutes. " - f"Last status was {status}.") - - if status == JobStatus.FAILED: - ml_client.jobs.download(returned_job.name) - if STD_LOG.exists(): - print(f"*** BEGIN {STD_LOG} ***") - with open(STD_LOG, "r") as f: - print(f.read(), end="") - print(f"*** END {STD_LOG} ***") - else: - ml_client.jobs.stream(returned_job.name) - - assert status == JobStatus.COMPLETED diff --git a/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/tests/requirements.txt b/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/tests/requirements.txt deleted file mode 100644 index 2533caf083..0000000000 --- a/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/tests/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -azure-ai-ml==1.2.0 -azure.identity -requests \ No newline at end of file diff --git a/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/tests/src/main.py b/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/tests/src/main.py deleted file mode 100644 index 95c672e87f..0000000000 --- a/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/tests/src/main.py +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -"""Validate minimal inference cpu environment by running azmlinfsrv.""" - -# imports -import os -import subprocess -import requests -from datetime import datetime, timedelta -import time -import argparse - - -def main(args): - """Start inference server and post scoring request.""" - # start the server - server_process = start_server("/var/tmp", ["--entry_script", args.score, "--port", "8081"]) - - # score a request - req = score_with_post() - server_process.kill() - - print(req) - - -def start_server(log_directory, args, timeout=timedelta(seconds=15)): - """Start inference server with options.""" - stderr_file = open(os.path.join(log_directory, "stderr.txt"), "w") - stdout_file = open(os.path.join(log_directory, "stdout.txt"), "w") - - env = os.environ.copy() - server_process = subprocess.Popen(["azmlinfsrv"] + args, stdout=stdout_file, stderr=stderr_file, env=env) - - max_time = datetime.now() + timeout - - while datetime.now() < max_time: - time.sleep(0.25) - req = None - try: - req = requests.get("http://127.0.0.1:8081", timeout=10) - except Exception as e: - print(e) - - if req is not None and req.ok: - break - - # Ensure the server is still running - status = server_process.poll() - if status is not None: - break - - print(log_directory, "stderr.txt") - print(log_directory, "stdout.txt") - - return server_process - - -def score_with_post(headers=None, data=None): - """Post scoring request to the server.""" - url = "http://127.0.0.1:8081/score" - return requests.post(url=url, headers=headers, data=data) - - -def parse_args(): - """Parse input arguments.""" - # setup arg parser - parser = argparse.ArgumentParser() - - # add arguments - parser.add_argument("--score", type=str) - - # parse args - args = parser.parse_args() - - # return args - return args - - -# run script -if __name__ == "__main__": - # parse args - args = parse_args() - - # run main function - main(args) diff --git a/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/tests/src/valid_score.py b/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/tests/src/valid_score.py deleted file mode 100644 index 8642f1d230..0000000000 --- a/assets/inference/environments/minimal-ubuntu20.04-py39-cpu-inference/tests/src/valid_score.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -"""A basic entry script.""" - -# imports -import uuid -import os -from datetime import datetime -from azureml_inference_server_http.api.aml_response import AMLResponse -from azureml_inference_server_http.api.aml_request import rawhttp - - -def init(): - """Sample init function.""" - print("Initializing") - - -@rawhttp -def run(input_data): - """Sample run function.""" - print('A new request received~~~') - try: - r = dict() - r['request_id'] = str(uuid.uuid4()) - r['now'] = datetime.now().strftime("%Y/%m/%d %H:%M:%S %f") - r['pid'] = os.getpid() - r['message'] = "this is a sample" - - return AMLResponse(r, 200, json_str=True) - except Exception as e: - error = str(e) - - return AMLResponse({'error': error}, 500, json_str=True) diff --git a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/asset.yaml b/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/asset.yaml deleted file mode 100644 index 916cf4ab31..0000000000 --- a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/asset.yaml +++ /dev/null @@ -1,12 +0,0 @@ -name: mlflow-py39-inference - -version: auto -type: environment -spec: spec.yaml -extra_config: environment.yaml -test: - pytest: - enabled: true - pip_requirements: tests/requirements.txt - tests_dir: tests -categories: ["Inference"] \ No newline at end of file diff --git a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/context/Dockerfile b/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/context/Dockerfile deleted file mode 100644 index c57989ab9d..0000000000 --- a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/context/Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ -FROM mcr.microsoft.com/azureml/inference-base-2004:{{latest-image-tag}} - -WORKDIR / -ENV AZUREML_CONDA_ENVIRONMENT_PATH=/azureml-envs/mlflow -ENV AZUREML_CONDA_DEFAULT_ENVIRONMENT=$AZUREML_CONDA_ENVIRONMENT_PATH - -# Prepend path to AzureML conda environment -ENV PATH $AZUREML_CONDA_ENVIRONMENT_PATH/bin:$PATH -ENV LD_LIBRARY_PATH $AZUREML_CONDA_ENVIRONMENT_PATH/lib:$LD_LIBRARY_PATH - -# Set MLFlow environment variables -ENV AML_APP_ROOT="/var/mlflow_resources" -ENV AZUREML_ENTRY_SCRIPT="mlflow_score_script.py" - -USER root - -# We'll copy the HF scripts as well to enable better handling for v2 packaging. This will not require changes to the -# packages installed in the image, as the expectation is that these will all be brought along with the model. -COPY mlflow_score_script.py /var/mlflow_resources/mlflow_score_script.py -COPY mlflow_hf_score_cpu.py /var/mlflow_resources/mlflow_hf_score_cpu.py -COPY mlflow_hf_score_gpu.py /var/mlflow_resources/mlflow_hf_score_gpu.py - -# Create conda environment -COPY conda_dependencies.yaml . -RUN conda env create -p $AZUREML_CONDA_ENVIRONMENT_PATH -f conda_dependencies.yaml -q && \ - rm conda_dependencies.yaml && \ - conda run -p $AZUREML_CONDA_ENVIRONMENT_PATH pip cache purge && \ - conda clean -a -y -USER dockeruser - -CMD [ "runsvdir", "/var/runit" ] \ No newline at end of file diff --git a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/context/conda_dependencies.yaml b/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/context/conda_dependencies.yaml deleted file mode 100644 index 73eb0e5c2f..0000000000 --- a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/context/conda_dependencies.yaml +++ /dev/null @@ -1,11 +0,0 @@ -name: mlflow -channels: -- conda-forge -- anaconda -dependencies: -- python=3.9.13 -- pip -- pip: - - azureml-inference-server-http=={{latest-pypi-version}} - - azureml-ai-monitoring=={{latest-pypi-version}} - - mlflow \ No newline at end of file diff --git a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/context/mlflow_hf_score_cpu.py b/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/context/mlflow_hf_score_cpu.py deleted file mode 100644 index 55da678f58..0000000000 --- a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/context/mlflow_hf_score_cpu.py +++ /dev/null @@ -1,189 +0,0 @@ -"""Mlflow hugging face for cpu.""" -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -import os -import re -import json -import logging -import pandas as pd -import azureml.evaluate.mlflow as azureml_mlflow -from mlflow.pyfunc.scoring_server import _get_jsonable_obj -from azureml.contrib.services.aml_response import AMLResponse - - -_logger = logging.getLogger(__name__) - - -class SupportedTasks: - """For Support Taks.""" - - def __init__(self): - """For init .""" - self.supported_tasks = { - "LARGE_LANGUAGE_TASKS": [ - "question-answering", - "text-classification", - "fill-mask", - "summarization", - "text-generation", - "token-classification", - "translation", - ], - "AUDIO_TASKS": [ - "automatic-speech-recognition", - ], - "VISION_TASKS": [ - "image-classification", - "image-classification-multilabel", - ], - } - - def large_language(self): - """Large language.""" - return self.supported_tasks["LARGE_LANGUAGE_TASKS"] - - def audio(self): - """For Audio.""" - return self.supported_tasks["AUDIO_TASKS"] - - def vision(self): - """For Vision.""" - return self.supported_tasks["VISION_TASKS"] - - def all(self): - """For all.""" - return self.audio() + self.vision() + self.large_language() - - def media(self): - """For media.""" - return self.audio() + self.vision() - - -# Function that sanitizes pandas dataframe input -def sanitize_pandas_input(input_data): - """For Function that sanitizes pandas dataframe input.""" - if isinstance(input_data, pd.DataFrame) and "inputs" in input_data.columns and len(input_data.columns) == 1: - return input_data.to_dict() - else: - pass - - -# Function that validates translation types -def validate_translation_type(translation_type): - """For Function that validates translation types.""" - if translation_type == "translation": - return True - # Translation tasks should have one of the following formats: "translation_xx_to_yy" - # or "translation_xx_yy_to_zz_aa" - translation_pattern = re.compile( - "|".join( - [ - "^translation_[A-Za-z]{2}_to_[A-Za-z]{2}$", - "^translation_[A-Za-z]{2}_[A-Za-z]{2}_to_[A-Za-z]{2}_[A-Za-z]{2}$", - ] - ) - ) - return bool(translation_pattern.match(translation_type)) - - -def init(): - """For init.""" - global task_name, model, supported_tasks - - model_path = str(os.getenv("AZUREML_MODEL_DIR")) - - # Walking through the AZUREML_MODEL_DIR folder to find folder containing MLmodel file. - # Terminates if number of MLmodel files != 1 - mlflow_model_folders = list() - for root, dirs, files in os.walk(model_path): - for name in files: - if name.lower() == "mlmodel": - mlflow_model_folders.append(root) - - if len(mlflow_model_folders) == 0: - raise Exception("---- No MLmodel files found in AZUREML_MODEL_DIR ----") - elif len(mlflow_model_folders) > 1: - raise Exception("---- More than one MLmodel files found in AZUREML_MODEL_DIR. Terminating. ----") - - model_path = mlflow_model_folders[0] - - model = azureml_mlflow.pyfunc.load_model(model_path) - task_name = model._model_impl.task_type - - # Initialize SupportedTasks - supported_tasks = SupportedTasks() - - if task_name not in supported_tasks.all() or not validate_translation_type(task_name): - return AMLResponse( - f"Invalid task_name, task should be one of the following: {supported_tasks.all()}", - 400, - ) - - -# Function that handles real-time inference requests -def online_inference(input_data): - """For Function that handles real-time inference requests.""" - if isinstance(input_data, pd.DataFrame): - model_input_signature = model.metadata.signature.inputs.to_dict() - if len(model_input_signature) > 1 or task_name in supported_tasks.media(): - input_data = sanitize_pandas_input(input_data) - - if isinstance(input_data, dict): - parameters = input_data.get("parameters", {}) - translation_type = parameters.get("task_type", "") - - if "translation" not in task_name and "translation" in translation_type: - return AMLResponse("Cannot pass task_type parameter for given model.", 400) - if "translation" in task_name and "translation" in translation_type: - if not validate_translation_type(translation_type): - return AMLResponse( - """Invalid translation_type, should be in form translation_ab_to_yz or - translation_ab_cd_to_wx_yz""", - 400, - ) - try: - return _get_jsonable_obj(model._model_impl.predict(input_data), pandas_orient="records") - except Exception as e: - return AMLResponse(str(e), 400) - - -def run(input_data): - """To run for input data.""" - _logger.info("Inference request received") - - # Process string input - if isinstance(input_data, str): - input_data = json.loads(input_data) - - if ( - # Allowed input formats are: - # dictioary with only "inputs" key - (isinstance(input_data, dict) and "inputs" in input_data and len(input_data.keys()) == 1) - # dictionary with "inputs" and "parameters" keys only - or ( - isinstance(input_data, dict) - and "inputs" in input_data - and "parameters" in input_data - and len(input_data.keys()) == 2 - ) - # dataframe with "inputs" column - or (isinstance(input_data, pd.DataFrame) and "inputs" in input_data.columns and len(input_data.columns) == 1) - # dataframe with model input signature as columns - or ( - isinstance(input_data, pd.DataFrame) - and set(i["name"] for i in model.metadata.signature.inputs.to_dict()) == set(input_data.columns.to_list()) - ) - ): - result = online_inference(input_data) - else: - return AMLResponse( - "Invalid input. Use dict in form" - + """ '{"inputs": {"input_signature":["data"]},"parameters": {}}' """ - + """or pandas dataframe in form {"inputs": {"input_signature1": ["data1"], "input_signature2":["data2"] - .... }}""", - 400, - ) - - _logger.info("Inferencing successful") - return result diff --git a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/context/mlflow_hf_score_gpu.py b/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/context/mlflow_hf_score_gpu.py deleted file mode 100644 index 5cfaaa4223..0000000000 --- a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/context/mlflow_hf_score_gpu.py +++ /dev/null @@ -1,224 +0,0 @@ -"""Mlflow hugging face gpu.""" -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -import os -import re -import json -import logging -import torch -import pandas as pd -from mlflow.exceptions import MlflowException -from mlflow.models.model import MLMODEL_FILE_NAME -from mlflow.pyfunc.scoring_server import _get_jsonable_obj -from mlflow.tracking.artifact_utils import _download_artifact_from_uri -from mlflow.models import Model -from mlflow.protos.databricks_pb2 import ( - RESOURCE_DOES_NOT_EXIST, -) -from mlflow.utils.model_utils import ( - _add_code_from_conf_to_system_path -) -from azureml.contrib.services.aml_response import AMLResponse -from azureml.evaluate.mlflow.hftransformers import _load_pyfunc as azureml_lp - -FLAVOR_NAME = "python_function" -CODE = "code" -DATA = "data" - - -_logger = logging.getLogger(__name__) - - -class SupportedTasks: - """Supported Tasks.""" - - def __init__(self): - """Init.""" - self.supported_tasks = { - "LARGE_LANGUAGE_TASKS": [ - "question-answering", - "text-classification", - "fill-mask", - "summarization", - "text-generation", - "token-classification", - "translation", - ], - "AUDIO_TASKS": [ - "automatic-speech-recognition", - ], - "VISION_TASKS": [ - "image-classification", - "image-classification-multilabel", - ] - } - - def large_language(self): - """Large language.""" - return self.supported_tasks['LARGE_LANGUAGE_TASKS'] - - def audio(self): - """Audio.""" - return self.supported_tasks["AUDIO_TASKS"] - - def vision(self): - """Vision.""" - return self.supported_tasks["VISION_TASKS"] - - def all(self): - """All.""" - return self.audio() + self.vision() + self.large_language() - - # Audio and Vision models have loader modules for predict - def media(self): - """Audio and Vision models have loader modules for predict.""" - return self.audio() + self.vision() - - -# Function that converts pandas dataframe input to json -def convert_pandas_to_dict(input_data): - """For Function that converts pandas dataframe input to json.""" - return input_data.to_dict() if ("inputs" in input_data.columns and - len(input_data.columns) == 1) else {"inputs": input_data.to_dict()} - - -# Function that appends device parameter -def append_device_parameter(inputs): - """For Function that appends device parameter.""" - device_parameter = {"dev_args": {"device": 0}} - if "parameters" in inputs: - inputs["parameters"].update(device_parameter) - else: - inputs.update({"parameters": device_parameter}) - - return inputs - - -# Function that validates translation types -def validate_translation_type(translation_type): - """For Function that validates translation types.""" - if translation_type == "translation": - return True - # Translation tasks should have one of the following formats: "translation_xx_to_yy" - # or "translation_xx_yy_to_zz_aa" - translation_pattern = re.compile( - "|".join( - [ - "^translation_[A-Za-z]{2}_to_[A-Za-z]{2}$", - "^translation_[A-Za-z]{2}_[A-Za-z]{2}_to_[A-Za-z]{2}_[A-Za-z]{2}$", - ] - ) - ) - return bool(translation_pattern.match(translation_type)) - - -def init(): - """Init.""" - global task_name, predict, signature, supported_tasks - - if torch.cuda.is_available(): - _logger.info("---Using GPU---") - else: - raise Exception("---GPU is not available. Please check the CUDA configuration---") - - model_path = str(os.getenv("AZUREML_MODEL_DIR")) - - mlflow_model_folders = list() - for root, dirs, files in os.walk(model_path): - for name in files: - if name.lower() == "mlmodel": - mlflow_model_folders.append(root) - - if len(mlflow_model_folders) == 0: - raise Exception("---- No MLmodel files found in AZUREML_MODEL_DIR ----") - elif len(mlflow_model_folders) > 1: - print("---- More than one MLmodel files found in AZUREML_MODEL_DIR. Terminating. ----") - - model_path = mlflow_model_folders[0] - - local_path = _download_artifact_from_uri(artifact_uri=model_path) - model_meta = Model.load(os.path.join(local_path, MLMODEL_FILE_NAME)) - conf = model_meta.flavors.get(FLAVOR_NAME) - if conf is None: - raise MlflowException( - f'Model does not have the "{FLAVOR_NAME}" flavor', - RESOURCE_DOES_NOT_EXIST, - ) - - _add_code_from_conf_to_system_path(local_path, conf, code_key=CODE) - data_path = os.path.join(local_path, conf[DATA]) if (DATA in conf) else local_path - kwargs = {"model_hf_load_kwargs": {"device_map": "eval_na"}} - model_impl = azureml_lp(data_path, **kwargs) - task_name = model_impl.task_type - supported_tasks = SupportedTasks() - if not (task_name in supported_tasks.all() or validate_translation_type(task_name)): - return AMLResponse( - f"Invalid task_name, task should be one of the following: {supported_tasks.all()}", - 400, - ) - predict = model_impl.predict - signature = model_meta.signature - - -# Function that handles real-time inference requests -def online_inference(input_data): - """For Function that handles real-time inference requests.""" - if isinstance(input_data, pd.DataFrame): - input_data = convert_pandas_to_dict(input_data) - - if isinstance(input_data, dict): - parameters = input_data.get("parameters", {}) - translation_type = parameters.get("task_type", "") - - if "translation" not in task_name and "translation" in translation_type: - return AMLResponse("Cannot pass task_type parameter for given model.", 400) - if "translation" in task_name and "translation" in translation_type: - if not validate_translation_type(translation_type): - return AMLResponse( - """Invalid translation_type, should be in form translation_ab_to_yz or - translation_xx_yy_to_zz_aa""", - 400, - ) - if isinstance(input_data, pd.DataFrame): - input_data = convert_pandas_to_dict(input_data) - - input_data = append_device_parameter(input_data) - try: - return _get_jsonable_obj(predict(input_data), pandas_orient="records") - except Exception as e: - return AMLResponse(str(e), 400) - - -def run(input_data): - """Run for input data.""" - _logger.info("Inference request received") - - # Process String input - if isinstance(input_data, str): - input_data = json.loads(input_data) - - if ( - # Accepted input formats are: - # dictioary with only "inputs" key - (isinstance(input_data, dict) and "inputs" in input_data and len(input_data.keys()) == 1) - # dictionary with only "inputs" and "parameters" key - or (isinstance(input_data, dict) and "inputs" in input_data and "parameters" in input_data - and len(input_data.keys()) == 2) - # dataframe with inputs key only - or (isinstance(input_data, pd.DataFrame) and "inputs" in input_data.columns - and len(input_data.columns) == 1) - # dataframe with model signature keys - or (isinstance(input_data, pd.DataFrame) and - set(i['name'] for i in signature.inputs.to_dict()) == set(input_data.columns.to_list())) - ): - result = online_inference(input_data) - else: - return AMLResponse( - "Invalid input. Use dict in form" - + """ '{"inputs": {"input_signature":["data"]},"parameters": {}}' """ - + """or pandas dataframe in form {"inputs": {"inputs_signature": ["data"]}}""", 400 - ) - - _logger.info("Inferencing successful") - return result diff --git a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/context/mlflow_score_script.py b/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/context/mlflow_score_script.py deleted file mode 100644 index 39ab1451ef..0000000000 --- a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/context/mlflow_score_script.py +++ /dev/null @@ -1,612 +0,0 @@ -"""Mlflow score script.""" -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -import json -import logging -import numpy as np -import os -import mlflow -import inspect - -from copy import deepcopy -from inference_schema.parameter_types.abstract_parameter_type import AbstractParameterType -from inference_schema.parameter_types.numpy_parameter_type import NumpyParameterType -from inference_schema.parameter_types.standard_py_parameter_type import StandardPythonParameterType -from inference_schema.schema_decorators import input_schema, output_schema -from mlflow.models import Model -from mlflow.pyfunc import load_model -from mlflow.pyfunc.scoring_server import _get_jsonable_obj -from azureml.ai.monitoring import Collector -from mlflow.types.utils import _infer_schema -from mlflow.types.schema import Schema, ColSpec, DataType -from mlflow.exceptions import MlflowException - -_logger = logging.getLogger(__name__) - -# Pandas installed, may not be necessary for tensorspec based models, so don't require it all the time -pandas_installed = False -try: - import pandas as pd - from inference_schema.parameter_types.pandas_parameter_type import PandasParameterType - - pandas_installed = True -except ImportError: - _logger.warning('Unable to import pandas') - -param_schema_supported = False -try: - from mlflow.types.schema import ParamSchema - param_schema_supported = True -except ImportError: - _logger.warning(f'Unable to import ParamSchema from MLflow. MLflow version: {mlflow.__version__}') - - -class NoSampleParameterType(AbstractParameterType): - """NoSampleParameterType.""" - - def __init__(self): - """Init.""" - super(NoSampleParameterType, self).__init__(None) - - def deserialize_input(self, input_data): - """Passthrough, do nothing to the incoming data.""" - return input_data - - def input_to_swagger(self): - """Return schema for an empty object.""" - return {"type": "object", "example": {}} - - -def create_tensor_spec_sample_io(model_signature_io): - """Create tensor spec sample.""" - _logger.info("Creating tensor spec sample") - # Create a sample numpy.ndarray based on shape/type of the tensor info of the model - io = model_signature_io.inputs - if not model_signature_io.has_input_names(): - # If the input is not a named tensor, the sample io value that we create will just be a numpy.ndarray - shape = io[0].shape - if shape and shape[0] == -1: - # -1 for first dimension means the input data is batched - # Create a numpy array with the first dimension of shape as 1 so that inference-schema - # can correctly generate the swagger sample for the input - shape = list(deepcopy(shape)) - shape[0] = 1 - sample_io = np.zeros(tuple(shape), dtype=io[0].type) - else: - # otherwise, the input is a named tensor, so the sample io value that we create will be - # Dict[str, numpy.ndarray], which maps input name to a numpy.ndarray of the corresponding size - sample_io = {} - for io_val in io: - shape = io_val.shape - if shape and shape[0] == -1: - # -1 for first dimension means the input data is batched - # Create a numpy array with the first dimension of shape as 1 so that inference-schema - # can correctly generate the swagger sample for the input - shape = list(deepcopy(shape)) - shape[0] = 1 - sample_io[io_val.name] = np.zeros(tuple(shape), dtype=io_val.type) - return sample_io - - -def create_col_spec_sample_io(model_signature_io): - """Create col spec sample.""" - _logger.info("Creating col spec sample") - # Create a sample pandas.DataFrame based on shape/type of the tensor info of the model - try: - columns = model_signature_io.input_names() - except AttributeError: # MLflow < 1.24.0 - columns = model_signature_io.column_names() - types = model_signature_io.pandas_types() - schema = {} - for c, t in zip(columns, types): - schema[c] = t - df = pd.DataFrame(columns=columns) - return df.astype(dtype=schema) - - -def create_other_sample_io(model_signature_io): - """Create other sample.""" - _logger.info("Creating 'other' (Python object) sample") - inputs = model_signature_io.inputs - sample_string = "sample string" - if type(inputs[0]) is ColSpec and inputs[0].name is not None: - # if isinstance(inputs, dict): - _logger.info("Creating dict sample") - sample_dict = {} - for input in inputs: - if input.type == DataType.boolean: - sample_input = True - elif input.type == DataType.string: - sample_input = sample_string - elif input.type == DataType.integer or input.type == DataType.long: - sample_input = 42 - elif input.type == DataType.float or input.type == DataType.double: - sample_input = 0.15 - else: - _logger.info(f"Unhandled input type in dictionary value: {input.type}") - sample_dict[input.name] = sample_input - return sample_dict - if isinstance(inputs, list): - _logger.info("Creating list sample") - sample_list = [] - if len(inputs) > 0 and (isinstance(inputs[0], str) or isinstance(inputs[0], ColSpec) and - inputs[0].type == DataType.string): - sample_list.append(sample_string) - return sample_list - elif isinstance(inputs, str): - _logger.info("Creating str sample") - return sample_string - raise "Unhandled data type when creating non colspec and non tensorspec sample" - - -def create_param_sample(model_signature_params): - """Create param sample.""" - sample_params = {} - if param_schema_supported and model_signature_params is not None and type(model_signature_params) is ParamSchema: - for param in model_signature_params.params: - if param.default is not None: - sample_params[param.name] = param.default - else: - param_type = param.dtype - if param_type == DataType.boolean: - sample_params[param.name] = True - elif param_type == DataType.string: - sample_params[param.name] = "sample string" - elif param_type == DataType.integer or param_type == DataType.long: - sample_params[param.name] = 42 - elif param_type == DataType.float or param_type == DataType.double: - sample_params[param.name] = 0.15 - else: - _logger.info(f"Unhandled param type: {param_type}") - return sample_params - - -model_path = os.path.join(os.getenv("AZUREML_MODEL_DIR"), os.getenv("MLFLOW_MODEL_FOLDER")) - -# model loaded here using mlfow.models import Model so we have access to the model signature -model = Model.load(model_path) - -is_hfv2 = "hftransformersv2" in model.flavors -_logger.info(f"is_hfv2: {is_hfv2}") -is_transformers = "transformers" in model.flavors -_logger.info(f"is_transformers: {is_transformers}") -is_langchain = "langchain" in model.flavors -_logger.info(f"is_langchain: {is_langchain}") -is_openai = "openai" in model.flavors -_logger.info(f"is_openai: {is_openai}") - -try: - metadata = model.metadata -except Exception as e: - _logger.warning(f"failed to fetch metadata with err: {str(e)}") - metadata = None - -if metadata and metadata.get('is_acft_model', False): - base_model_name = metadata.get("base_model_name", None) - if base_model_name: - _logger.info(f"base_model_name: {base_model_name}") - base_model_task = metadata.get("base_model_task", None) - if base_model_task: - _logger.info(f"base_model_task: {base_model_task}") - base_model_asset_id = metadata.get("base_model_asset_id", None) - if base_model_asset_id: - _logger.info(f"base_model_asset_id: {base_model_asset_id}") - finetuning_task = metadata.get("finetuning_task", None) - if finetuning_task: - _logger.info(f"finetuning_task: {finetuning_task}") - is_finetuned = metadata.get("is_finetuned_model", None) - if is_finetuned is not None: - _logger.info(f"is_finetuned_model: {is_finetuned}") - -sample_input = None -input_param = None -sample_output = None -output_param = None -sample_params = None -params_param = None - - -def get_sample_input_from_loaded_example(input_example_info, loaded_input): - """Get sample input from loaded example.""" - orient = "split" if "columns" in loaded_input else "values" - if input_example_info['type'] == 'dataframe': - _logger.info("Getting sample from loaded dataframe example") - sample_input = pd.read_json( - json.dumps(loaded_input), - # needs open source fix - # orient=input_example_info['pandas_orient'], - orient=orient, - dtype=False - ) - elif input_example_info["type"] == "ndarray": - _logger.info("Getting sample from loaded numpy example") - inputs = loaded_input["inputs"] - if isinstance(inputs, dict): - sample_input = { - input_name: np.asarray(input_value) for input_name, input_value in inputs.items() - } - else: - sample_input = np.asarray(inputs) - else: - _logger.info("Getting sample from loaded python object example") - # currently unused, as type always comes through from MLflow _Example creation as ndarray or dataframe - sample_input = loaded_input - _logger.warning('Potentially unable to handle sample model input of type "{}". The type must be one ' - 'of the list detailed in the MLflow repository: ' - 'https://github.com/mlflow/mlflow/blob/master/mlflow/types/utils.py#L91 ' - '"dataframe" or "ndarray" is guaranteed to work best. For more information, please see: ' - 'https://aka.ms/aml-mlflow-deploy."'.format(model.saved_input_example_info['type'])) - return sample_input - - -# If a sample input is provided, load this input and use this as the sample input to create the -# scoring script and inference-schema decorators instead of creating a sample based on just the -# signature information -try: - if model.saved_input_example_info: - sample_input_file_path = os.path.join(model_path, model.saved_input_example_info['artifact_path']) - with open(sample_input_file_path, 'r') as sample_input_file: - _logger.info(f"loading example from file path: {sample_input_file_path}") - loaded_input = json.load(sample_input_file) - sample_input = get_sample_input_from_loaded_example(model.saved_input_example_info, loaded_input) -except Exception as e: - _logger.warning( - "Failure processing model sample input: {}.\nWill attempt to create sample input based on model signature. " - "For more information, please see: https://aka.ms/aml-mlflow-deploy.".format(e) - ) - - -def get_samples_from_signature( - model_signature_x, - previous_sample_input=None, - previous_sample_output=None, - previous_sample_params=None): - """Get samples from signature.""" - if model_signature_x is None: - _logger.info("No model signature, returning previous sample input and output") - return previous_sample_input, previous_sample_output, previous_sample_params - model_signature_inputs = model_signature_x.inputs - model_signature_outputs = model_signature_x.outputs - try: - model_signature_params = model_signature_x.params - except AttributeError: - _logger.info(f"Params not available on model signature. Setting to None. MLflow version: {mlflow.__version__}") - model_signature_params = None - if model_signature_inputs == Schema([ColSpec("string")]) and is_transformers: - _logger.info("Getting sample from a transformers model taking string input") - sample_input_x = create_other_sample_io(model_signature_inputs) - elif type(model_signature_inputs.inputs[0]) is ColSpec and \ - model_signature_inputs.inputs[0].name is not None and is_transformers: - _logger.info("Getting sample from a transformers model taking dict input") - sample_input_x = create_other_sample_io(model_signature_inputs) - elif model_signature_inputs and previous_sample_input is None: - _logger.info("Getting sample from non-transformers model") - if model_signature_inputs.is_tensor_spec(): - sample_input_x = create_tensor_spec_sample_io(model_signature_inputs) - else: - try: - sample_input_x = create_col_spec_sample_io(model_signature_inputs) - except: # noqa: E722 - sample_input_x = create_other_sample_io(model_signature_inputs) - _logger.warning("Sample input could not be parsed as either TensorSpec" - " or ColSpec. Falling back to taking the sample as is rather than" - " converting to numpy arrays or DataFrame.") - else: - _logger.info("Using previous sample input") - sample_input_x = previous_sample_input - - if model_signature_outputs and previous_sample_output is None: - if model_signature_outputs.is_tensor_spec(): - sample_output_x = create_tensor_spec_sample_io(model_signature_outputs) - else: - sample_output_x = create_col_spec_sample_io(model_signature_outputs) - else: - sample_output_x = previous_sample_output - - if model_signature_params and previous_sample_params is None: - sample_params_x = create_param_sample(model_signature_params) - else: - sample_params_x = previous_sample_params - - return sample_input_x, sample_output_x, sample_params_x - - -# Handle the signature information to attempt creation of a sample based on signature if no concrete -# sample was provided -model_signature = model.signature -if model_signature: - sample_input, sample_output, sample_params = get_samples_from_signature( - model_signature, sample_input, sample_output, sample_params) -else: - _logger.warning( - "No signature information provided for model. If no sample information was provided with the model " - "the deployment's swagger will not include input and output schema and typing information." - "For more information, please see: https://aka.ms/aml-mlflow-deploy." - ) - - -def get_parameter_type(sample_input_ex, sample_output_ex=None, sample_param_ex=None): - """Get parameter type.""" - if sample_input_ex is None: - _logger.info("sample input is none, returning NoSampleParameterType") - input_param = NoSampleParameterType() - else: - try: - # schema = _infer_schema(sample_input_ex) - # schema_types = schema.input_types - _infer_schema(sample_input_ex) - except MlflowException: - pass - finally: - if isinstance(sample_input_ex, np.ndarray): - _logger.info("sample input is a numpy array") - # Unnamed tensor input - input_param = NumpyParameterType(sample_input_ex, enforce_shape=False) - elif pandas_installed and isinstance(sample_input_ex, pd.DataFrame): - _logger.info("sample input is a dataframe") - # TODO check with OSS about pd.Series - input_param = PandasParameterType(sample_input_ex, enforce_shape=False, orient='split') - # elif schema_types and isinstance(sample_input_ex, dict) and \ - # not all(stype == DataType.string for stype in schema_types) and \ - # all(isinstance(value, list) for value in sample_input_ex.values()): - # # for dictionaries where there is any non-string type, named tensor - # param_arg = {} - # for key, value in sample_input_ex.items(): - # param_arg[key] = NumpyParameterType(value, enforce_shape=False) - # input_param = StandardPythonParameterType(param_arg) - elif isinstance(sample_input_ex, dict) and is_transformers: - input_param = StandardPythonParameterType(sample_input_ex) - elif isinstance(sample_input_ex, dict): - _logger.info("sample input is a dict") - # TODO keeping this around while _infer_schema doesn't work on dataframe string signatures - param_arg = {} - for key, value in sample_input_ex.items(): - param_arg[key] = NumpyParameterType(value, enforce_shape=False) - input_param = StandardPythonParameterType(param_arg) - elif isinstance(sample_input_ex, list) and is_transformers: - _logger.info("transformers sample input is a list") - input_param = StandardPythonParameterType(sample_input_ex) - else: - _logger.info("sample input is string, bytes, or non-transformers list") - # strings, bytes, lists and dictionaries with only strings as base type - input_param = NoSampleParameterType() - - if sample_output_ex is None: - output_param = NoSampleParameterType() - else: - if isinstance(sample_output_ex, np.ndarray): - # Unnamed tensor input - output_param = NumpyParameterType(sample_output_ex, enforce_shape=False) - elif isinstance(sample_output_ex, dict): - param_arg = {} - for key, value in sample_output_ex.items(): - param_arg[key] = NumpyParameterType(value, enforce_shape=False) - output_param = StandardPythonParameterType(param_arg) - else: - output_param = PandasParameterType(sample_output_ex, enforce_shape=False, orient='records') - - if sample_param_ex is None: - param_param = NoSampleParameterType() - else: - param_param = StandardPythonParameterType(sample_param_ex) - - return input_param, output_param, param_param - - -input_param, output_param, params_param = get_parameter_type(sample_input, sample_output, sample_params) - -_logger.info(f"loading model from model path: {model_path}") -# we use mlflow.pyfunc's load_model function because it has a predict function on it we need for inferencing -model = load_model(model_path) - - -def init(): - """Init.""" - _logger.info("Initializing MLflow scoring script") - global inputs_collector, outputs_collector - try: - inputs_collector = Collector(name='model_inputs') - outputs_collector = Collector(name='model_outputs') - _logger.info("Input and output collector initialized") - except Exception as e: - _logger.error("Error initializing model_inputs collector and model_outputs collector. {}".format(e)) - - -@input_schema("input_data", input_param) -@input_schema("params", params_param, optional=True) -@output_schema(output_param) -def run(input_data, params=None): - """Run.""" - _logger.info("Entering run function in MLflow scoring script") - context = None - - # to support customers transitioning from hftransformersv2 - if params is None and "parameters" in input_data and is_transformers: - params = input_data["parameters"] - del input_data["parameters"] - - remaining_keys = list(input_data.keys()) - if len(remaining_keys) == 1 and remaining_keys[0] == "input_string": - input_data = input_data["input_string"] - - if ( - isinstance(input_data, np.ndarray) - or (isinstance(input_data, dict) and input_data and isinstance(list(input_data.values())[0], np.ndarray)) - or (pandas_installed and isinstance(input_data, pd.DataFrame)) - ): - _logger.info("Predicting for dataframe and ndarray") - # Collect model input - try: - context = inputs_collector.collect(input_data) - except Exception as e: - _logger.error("Error collecting model_inputs collection request. {}".format(e)) - - if inspect.signature(model.predict).parameters.get("params"): - result = model.predict(input_data, params=params) - else: - _logger.warning("Switching back to use a model.predict() without params. " + - "Likely an older version of MLflow in use. MLflow version: {mlflow.__version__}") - result = model.predict(input_data) - - # Collect model output - try: - mdc_output_df = pd.DataFrame(result) - outputs_collector.collect(mdc_output_df, context) - except Exception as e: - _logger.error("Error collecting model_outputs collection request. {}".format(e)) - - return _get_jsonable_obj(result, pandas_orient="records") - - if is_transformers or is_langchain or is_openai: - _logger.info("Parsing model input for LLMs") - input = parse_model_input_from_input_data_transformers(input_data) - else: - _logger.info("Parsing model input for traditional models") - input = parse_model_input_from_input_data_traditional(input_data) - - # Collect model input - try: - context = inputs_collector.collect(input) - except Exception as e: - _logger.error("Error collecting model_inputs collection request. {}".format(e)) - - if inspect.signature(model.predict).parameters.get("params"): - result = model.predict(input, params=params) - else: - _logger.warning("Switching back to use a model.predict() without params. " + - "Likely an older version of MLflow in use. MLflow version: {mlflow.__version__}") - result = model.predict(input) - - # Collect output data - try: - mdc_output_df = pd.DataFrame(result) - outputs_collector.collect(mdc_output_df, context) - except Exception as e: - _logger.error("Error collecting model_outputs collection request. {}".format(e)) - - return _get_jsonable_obj(result, pandas_orient="records") - - -def parse_model_input_from_input_data_traditional(input_data): - """Parse model input from input data traditional.""" - # Format input - if isinstance(input_data, str): - input_data = json.loads(input_data) - if 'input_data' in input_data: - input_data = input_data['input_data'] - if is_hfv2: - input = input_data - elif isinstance(input_data, list): - # if a list, assume the input is a numpy array - input = np.asarray(input_data) - elif isinstance(input_data, dict) and "columns" in input_data and "index" in input_data and "data" in input_data: - # if the dictionary follows pandas split column format, deserialize into a pandas Dataframe - input = pd.read_json(json.dumps(input_data), orient="split", dtype=False) - else: - # otherwise, assume input is a named tensor, and deserialize into a dict[str, numpy.ndarray] - input = {input_name: np.asarray(input_value) for input_name, input_value in input_data.items()} - return input - - -def parse_model_input_from_input_data_transformers(input_data): - """Parse model input from input data transformers.""" - # Format input - if isinstance(input_data, str): - _logger.info("input data is str") - try: - input_data = json.loads(input_data) - except ValueError: - # allow non-json strings to go through - input = input_data - - if isinstance(input_data, dict) and 'input_data' in input_data: - _logger.info("getting inputs out of input dictionary") - input_data = input_data['input_data'] - - if is_hfv2: - _logger.info("input passed through directly for hfv2 models") - input = input_data - elif isinstance(input_data, str) or isinstance(input_data, bytes): - _logger.info("input passed through directly for str/bytes") - # strings and bytes go through - input = input_data - elif isinstance(input_data, list) and all(isinstance(element, str) for element in input_data): - _logger.info("input passed through directly for lists of strings") - # lists of strings go through - input = input_data - elif ( - isinstance(input_data, list) - and all(isinstance(element, dict) for element in input_data) - ): - _logger.info("input passed through directly for dictionaries of strings") - # lists of dicts of [str: str | List[str]] go through - try: - for dict_input in input_data: - _validate_input_dictionary_contains_only_strings_and_lists_of_strings(dict_input) - input = input_data - except MlflowException: - _logger.error("Could not parse model input - passed a list of dictionaries" + - " which had entries which were not strings or lists.") - elif isinstance(input_data, list): - _logger.info("assuming list is a numpy array") - # if a list, assume the input is a numpy array - input = np.asarray(input_data) - elif isinstance(input_data, dict) and "columns" in input_data and "index" in input_data and "data" in input_data: - _logger.info("coercing input to dataframe") - # if the dictionary follows pandas split column format, deserialize into a pandas Dataframe - input = pd.read_json(json.dumps(input_data), orient="split", dtype=False) - elif isinstance(input_data, dict): - # if input is a dictionary, but is not all ndarrays and is not pandas, it must only contain strings - try: - _validate_input_dictionary_contains_only_strings_and_lists_of_strings(input_data) - _logger.info("input passed through directly for dicts/lists of strings") - input = input_data - except MlflowException: - _logger.info("deserializing input as a named tensor") - # otherwise, assume input is a named tensor, and deserialize into a dict[str, numpy.ndarray] - input = {input_name: np.asarray(input_value) for input_name, input_value in input_data.items()} - else: - _logger.info(f"Input did not match any particular format. Input type: {type(input_data)}") - input = input_data - - return input - - -# vendored from MLflow OSS -def _validate_input_dictionary_contains_only_strings_and_lists_of_strings(data): - invalid_keys = [] - invalid_values = [] - value_type = None - for key, value in data.items(): - if not value_type: - value_type = type(value) - if isinstance(key, bool): - invalid_keys.append(key) - elif not isinstance(key, (str, int)): - invalid_keys.append(key) - if isinstance(value, list) and not all(isinstance(item, (str, bytes)) for item in value): - invalid_values.append(key) - elif not isinstance(value, (np.ndarray, list, str, bytes)): - invalid_values.append(key) - elif isinstance(value, np.ndarray) or value_type == np.ndarray: - if not isinstance(value, value_type): - invalid_values.append(key) - if invalid_values: - from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE - raise MlflowException( - "Invalid values in dictionary. If passing a dictionary containing strings, all " - "values must be either strings or lists of strings. If passing a dictionary containing " - "numeric values, the data must be enclosed in a numpy.ndarray. The following keys " - f"in the input dictionary are invalid: {invalid_values}", - error_code=INVALID_PARAMETER_VALUE, - ) - if invalid_keys: - raise MlflowException( - f"The dictionary keys are not all strings or indexes. Invalid keys: {invalid_keys}" - ) - - -# for testing purposes, return input, parameter, and output params -def _get_schema_params(): - return input_param, params_param, output_param diff --git a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/environment.yaml b/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/environment.yaml deleted file mode 100644 index af28f88e5c..0000000000 --- a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/environment.yaml +++ /dev/null @@ -1,12 +0,0 @@ -image: - name: azureml/curated/mlflow-py39-inference - os: linux - context: - dir: context - dockerfile: Dockerfile - template_files: - - Dockerfile - - conda_dependencies.yaml - publish: - location: mcr - visibility: public diff --git a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/spec.yaml b/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/spec.yaml deleted file mode 100644 index fcdf494bdd..0000000000 --- a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/spec.yaml +++ /dev/null @@ -1,18 +0,0 @@ -$schema: https://azuremlschemas.azureedge.net/latest/environment.schema.json - -description: >- - AzureML MLflow/Ubuntu 20.04/Python 3.9 cpu environment. - -name: "{{asset.name}}" -version: "{{asset.version}}" - -build: - path: "{{image.context.path}}" - dockerfile_path: "{{image.dockerfile.path}}" - -os_type: linux - -tags: - OS: Ubuntu20.04 - Inferencing: "" - Preview: "" diff --git a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/mlflow_test.py b/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/mlflow_test.py deleted file mode 100644 index 0674e8f946..0000000000 --- a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/mlflow_test.py +++ /dev/null @@ -1,84 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -"""Tests running a sample job in the mlflow 20.04 py39 cpu environment.""" -import os -import time -from pathlib import Path -from azure.ai.ml import command, MLClient -from azure.ai.ml._restclient.models import JobStatus -from azure.ai.ml.entities import Environment, BuildContext -from azure.identity import AzureCliCredential - -BUILD_CONTEXT = Path("../context") -JOB_SOURCE_CODE = "src" -TIMEOUT_MINUTES = os.environ.get("timeout_minutes", 30) -STD_LOG = Path("artifacts/user_logs/std_log.txt") - - -def test_mlflow_cpu_inference(): - """Tests a sample job using mlflow 20.04 py39 cpu as the environment.""" - this_dir = Path(__file__).parent - - subscription_id = os.environ.get("subscription_id") - resource_group = os.environ.get("resource_group") - workspace_name = os.environ.get("workspace") - - ml_client = MLClient( - AzureCliCredential(), subscription_id, resource_group, workspace_name - ) - - env_name = "mlflow_py39_inference" - - env_docker_context = Environment( - build=BuildContext(path=this_dir / BUILD_CONTEXT), - name=env_name, - description="mlflow 20.04 py39 cpu inference environment created from a Docker context.", - ) - returned_env = ml_client.environments.create_or_update(env_docker_context) - - # create the command - job = command( - code=this_dir / JOB_SOURCE_CODE, # local path where the code is stored - command="python main.py --model_dir ${{inputs.model_dir}} " - "--score ${{inputs.score}} --score_input ${{inputs.score_input}}", - inputs=dict( - score="/var/mlflow_resources/mlflow_score_script.py", - score_input="sample_2_0_input.txt", - model_dir="mlflow_2_0_model_folder" - ), - environment=returned_env, - compute=os.environ.get("cpu_cluster"), - display_name="mlflow-py39-inference-example", - description="A test run of the mlflow 20.04 py39 cpu inference curated environment", - experiment_name="mlflow39InferenceExperiment" - ) - - returned_job = ml_client.create_or_update(job) - assert returned_job is not None - - # Poll until final status is reached or timed out - timeout = time.time() + (TIMEOUT_MINUTES * 60) - while time.time() <= timeout: - job = ml_client.jobs.get(returned_job.name) - status = job.status - if status in [JobStatus.COMPLETED, JobStatus.FAILED]: - break - time.sleep(30) # sleep 30 seconds - else: - # Timeout - ml_client.jobs.cancel(returned_job.name) - raise Exception(f"Test aborted because the job took longer than {TIMEOUT_MINUTES} minutes. " - f"Last status was {status}.") - - if status == JobStatus.FAILED: - ml_client.jobs.download(returned_job.name) - if STD_LOG.exists(): - print(f"*** BEGIN {STD_LOG} ***") - with open(STD_LOG, "r") as f: - print(f.read(), end="") - print(f"*** END {STD_LOG} ***") - else: - ml_client.jobs.stream(returned_job.name) - - assert status == JobStatus.COMPLETED diff --git a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/requirements.txt b/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/requirements.txt deleted file mode 100644 index 2533caf083..0000000000 --- a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -azure-ai-ml==1.2.0 -azure.identity -requests \ No newline at end of file diff --git a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/main.py b/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/main.py deleted file mode 100644 index 6733614251..0000000000 --- a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/main.py +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -"""Validate minimal inference cpu environment by running azmlinfsrv.""" - -# imports -import json -import os -import subprocess -import requests -from datetime import datetime, timedelta -import time -import argparse - - -def main(args): - """Start inference server and post scoring request.""" - # start the server - server_process = start_server("/var/tmp", - ["--entry_script", args.score, "--port", "8081"], - args.model_dir) - - # score a request - with open(args.score_input) as f: - payload_data = json.load(f) - - headers = {"Content-Type": "application/json"} - res = score_with_post(headers=headers, data=payload_data) - server_process.kill() - - print_file_contents("/var/tmp", "stderr.txt") - print_file_contents("/var/tmp", "stdout.txt") - print(res) - - -def start_server(log_directory, args, model_dir, timeout=timedelta(seconds=60)): - """Start inference server with options.""" - stderr_file = open(os.path.join(log_directory, "stderr.txt"), "w") - stdout_file = open(os.path.join(log_directory, "stdout.txt"), "w") - - env = os.environ.copy() - env["AZUREML_MODEL_DIR"] = os.path.dirname(os.path.abspath(__file__)) - env["MLFLOW_MODEL_FOLDER"] = model_dir - print(os.path.abspath(__file__)) - server_process = subprocess.Popen(["azmlinfsrv"] + args, stdout=stdout_file, stderr=stderr_file, env=env) - - max_time = datetime.now() + timeout - - while datetime.now() < max_time: - time.sleep(0.25) - req = None - try: - req = requests.get("http://127.0.0.1:8081", timeout=10) - except Exception as e: - print(e) - - if req is not None and req.ok: - break - - # Ensure the server is still running - status = server_process.poll() - if status is not None: - break - - return server_process - - -def score_with_post(headers=None, data=None): - """Post scoring request to the server.""" - url = "http://127.0.0.1:8081/score" - return requests.post(url=url, headers=headers, data=data) - - -def print_file_contents(log_directory, file_name): - """Print out file contents.""" - print(log_directory, file_name) - file_path = os.path.join(log_directory, file_name) - try: - with open(file_path, 'r') as file: - contents = file.read() - print(contents) - except FileNotFoundError: - print("file path is not valid.") - - -def parse_args(): - """Parse input arguments.""" - # setup arg parser - parser = argparse.ArgumentParser() - - # add arguments - parser.add_argument("--score", type=str) - parser.add_argument("--model_dir", type=str) - parser.add_argument("--score_input", type=str) - - # parse args - args = parser.parse_args() - - # return args - return args - - -# run script -if __name__ == "__main__": - # parse args - args = parse_args() - - # run main function - main(args) diff --git a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/mlflow_2_0_model_folder/MLmodel b/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/mlflow_2_0_model_folder/MLmodel deleted file mode 100644 index df9981e0a8..0000000000 --- a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/mlflow_2_0_model_folder/MLmodel +++ /dev/null @@ -1,20 +0,0 @@ -flavors: - python_function: - cloudpickle_version: 2.1.0 - env: - conda: conda.yaml - virtualenv: python_env.yaml - loader_module: mlflow.pyfunc.model - python_model: python_model.pkl - python_version: 3.9.13 -mlflow_version: 2.0.1 -model_uuid: 687fb8fa7a044a1cb8ee79b5f76368f8 -saved_input_example_info: - artifact_path: input_example.json - pandas_orient: split - type: dataframe -signature: - inputs: '[{"name": "a", "type": "double"}, {"name": "b", "type": "long"}, {"name": - "c", "type": "string"}]' - outputs: '[{"name": "a", "type": "double"}]' -utc_time_created: '2022-11-18 22:14:59.029851' diff --git a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/mlflow_2_0_model_folder/conda.yaml b/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/mlflow_2_0_model_folder/conda.yaml deleted file mode 100644 index 93e0db8ab3..0000000000 --- a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/mlflow_2_0_model_folder/conda.yaml +++ /dev/null @@ -1,9 +0,0 @@ -channels: -- conda-forge -- anaconda -dependencies: -- python=3.9.13 -- pip -- pip: - - mlflow - - cloudpickle==2.1.0 \ No newline at end of file diff --git a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/mlflow_2_0_model_folder/input_example.json b/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/mlflow_2_0_model_folder/input_example.json deleted file mode 100644 index 4f8ebcd6a8..0000000000 --- a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/mlflow_2_0_model_folder/input_example.json +++ /dev/null @@ -1 +0,0 @@ -{"columns": ["a", "b", "c"], "data": [[3.0, 1, "foo"]]} \ No newline at end of file diff --git a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/mlflow_2_0_model_folder/python_env.yaml b/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/mlflow_2_0_model_folder/python_env.yaml deleted file mode 100644 index d745c5a21b..0000000000 --- a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/mlflow_2_0_model_folder/python_env.yaml +++ /dev/null @@ -1,7 +0,0 @@ -python: 3.9.13 -build_dependencies: -- pip -- setuptools==65.2.0 -- wheel==0.37.1 -dependencies: -- -r requirements.txt diff --git a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/mlflow_2_0_model_folder/python_model.pkl b/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/mlflow_2_0_model_folder/python_model.pkl deleted file mode 100644 index e398f00d7e..0000000000 Binary files a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/mlflow_2_0_model_folder/python_model.pkl and /dev/null differ diff --git a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/mlflow_2_0_model_folder/requirements.txt b/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/mlflow_2_0_model_folder/requirements.txt deleted file mode 100644 index 95a61d86e2..0000000000 --- a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/mlflow_2_0_model_folder/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -mlflow -cloudpickle==2.1.0 \ No newline at end of file diff --git a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/sample_2_0_input.txt b/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/sample_2_0_input.txt deleted file mode 100644 index 3057c0a3b2..0000000000 --- a/assets/inference/environments/mlflow-ubuntu20.04-py39-cpu-inference/tests/src/sample_2_0_input.txt +++ /dev/null @@ -1 +0,0 @@ -{"input_data":{"columns":["a", "b", "c"],"index":[0],"data":[[3.0, 1, "foo"]]}} \ No newline at end of file diff --git a/assets/large_language_models/rag/components/crack_and_chunk/spec.yaml b/assets/large_language_models/rag/components/crack_and_chunk/spec.yaml index b6f9da6e80..dc0e9e08fd 100644 --- a/assets/large_language_models/rag/components/crack_and_chunk/spec.yaml +++ b/assets/large_language_models/rag/components/crack_and_chunk/spec.yaml @@ -4,7 +4,7 @@ type: command tags: Preview: "" -version: 0.0.78 +version: 0.0.79 name: llm_rag_crack_and_chunk display_name: LLM - Crack and Chunk Data is_deterministic: true diff --git a/assets/large_language_models/rag/components/crack_and_chunk_and_embed/spec.yaml b/assets/large_language_models/rag/components/crack_and_chunk_and_embed/spec.yaml index abba93b02f..f3617d8388 100644 --- a/assets/large_language_models/rag/components/crack_and_chunk_and_embed/spec.yaml +++ b/assets/large_language_models/rag/components/crack_and_chunk_and_embed/spec.yaml @@ -4,7 +4,7 @@ type: command tags: Preview: "" -version: 0.0.49 +version: 0.0.50 name: llm_rag_crack_and_chunk_and_embed display_name: LLM - Crack, Chunk and Embed Data is_deterministic: true diff --git a/assets/large_language_models/rag/components/crack_chunk_embed_index_and_register/spec.yaml b/assets/large_language_models/rag/components/crack_chunk_embed_index_and_register/spec.yaml index 11e8f50550..d814a93789 100644 --- a/assets/large_language_models/rag/components/crack_chunk_embed_index_and_register/spec.yaml +++ b/assets/large_language_models/rag/components/crack_chunk_embed_index_and_register/spec.yaml @@ -1,5 +1,5 @@ name: llm_rag_crack_chunk_embed_index_and_register -version: 0.0.37 +version: 0.0.38 tags: Preview: "" diff --git a/assets/large_language_models/rag/components/crawl_url/spec.yaml b/assets/large_language_models/rag/components/crawl_url/spec.yaml index bf9429ebcd..ee4b926ab6 100644 --- a/assets/large_language_models/rag/components/crawl_url/spec.yaml +++ b/assets/large_language_models/rag/components/crawl_url/spec.yaml @@ -4,7 +4,7 @@ type: command tags: Preview: "" -version: 0.0.36 +version: 0.0.37 name: llm_rag_crawl_url display_name: LLM - Crawl URL to Retrieve Data is_deterministic: true diff --git a/assets/large_language_models/rag/components/create_faiss_index/spec.yaml b/assets/large_language_models/rag/components/create_faiss_index/spec.yaml index 2fa43eaa9b..18ede4279a 100644 --- a/assets/large_language_models/rag/components/create_faiss_index/spec.yaml +++ b/assets/large_language_models/rag/components/create_faiss_index/spec.yaml @@ -4,7 +4,7 @@ type: command tags: Preview: "" -version: 0.0.76 +version: 0.0.77 name: llm_rag_create_faiss_index display_name: LLM - Create FAISS Index is_deterministic: true diff --git a/assets/large_language_models/rag/components/create_promptflow/spec.yaml b/assets/large_language_models/rag/components/create_promptflow/spec.yaml index 2bd7db797c..c8aa7c8e9e 100644 --- a/assets/large_language_models/rag/components/create_promptflow/spec.yaml +++ b/assets/large_language_models/rag/components/create_promptflow/spec.yaml @@ -4,7 +4,7 @@ type: command tags: Preview: "" -version: 0.0.87 +version: 0.0.88 name: llm_rag_create_promptflow display_name: LLM - Create Prompt Flow is_deterministic: true diff --git a/assets/large_language_models/rag/components/data_import_acs/spec.yaml b/assets/large_language_models/rag/components/data_import_acs/spec.yaml index 2272b53481..1da27ab174 100644 --- a/assets/large_language_models/rag/components/data_import_acs/spec.yaml +++ b/assets/large_language_models/rag/components/data_import_acs/spec.yaml @@ -4,7 +4,7 @@ type: command tags: Preview: "" -version: 0.0.72 +version: 0.0.73 name: llm_rag_data_import_acs display_name: LLM - Import Data from ACS is_deterministic: false diff --git a/assets/large_language_models/rag/components/generate_embeddings/spec.yaml b/assets/large_language_models/rag/components/generate_embeddings/spec.yaml index ce35780a9d..d1429620fd 100644 --- a/assets/large_language_models/rag/components/generate_embeddings/spec.yaml +++ b/assets/large_language_models/rag/components/generate_embeddings/spec.yaml @@ -4,7 +4,7 @@ type: command tags: Preview: "" -version: 0.0.71 +version: 0.0.72 name: llm_rag_generate_embeddings display_name: LLM - Generate Embeddings is_deterministic: true diff --git a/assets/large_language_models/rag/components/generate_embeddings_parallel/spec.yaml b/assets/large_language_models/rag/components/generate_embeddings_parallel/spec.yaml index 8513dea007..5832614b07 100644 --- a/assets/large_language_models/rag/components/generate_embeddings_parallel/spec.yaml +++ b/assets/large_language_models/rag/components/generate_embeddings_parallel/spec.yaml @@ -4,7 +4,7 @@ type: parallel tags: Preview: "" -version: 0.0.77 +version: 0.0.78 name: llm_rag_generate_embeddings_parallel display_name: LLM - Generate Embeddings Parallel is_deterministic: true diff --git a/assets/large_language_models/rag/components/git_clone/spec.yaml b/assets/large_language_models/rag/components/git_clone/spec.yaml index 8653d0a933..c178bac799 100644 --- a/assets/large_language_models/rag/components/git_clone/spec.yaml +++ b/assets/large_language_models/rag/components/git_clone/spec.yaml @@ -4,7 +4,7 @@ type: command tags: Preview: "" -version: 0.0.75 +version: 0.0.76 name: llm_rag_git_clone display_name: LLM - Clone Git Repo is_deterministic: true diff --git a/assets/large_language_models/rag/components/image_embed_index/spec.yaml b/assets/large_language_models/rag/components/image_embed_index/spec.yaml index 38a7d65fea..c03dad3bea 100644 --- a/assets/large_language_models/rag/components/image_embed_index/spec.yaml +++ b/assets/large_language_models/rag/components/image_embed_index/spec.yaml @@ -4,7 +4,7 @@ type: command tags: Preview: "" -version: 0.0.29 +version: 0.0.30 name: llm_rag_image_embed_index display_name: LLM - Embedding images with Florence is_deterministic: true diff --git a/assets/large_language_models/rag/components/qa_data_generation/spec.yaml b/assets/large_language_models/rag/components/qa_data_generation/spec.yaml index 910319710f..dfae5c80ff 100644 --- a/assets/large_language_models/rag/components/qa_data_generation/spec.yaml +++ b/assets/large_language_models/rag/components/qa_data_generation/spec.yaml @@ -4,7 +4,7 @@ type: command tags: Preview: "" -version: 0.0.76 +version: 0.0.77 name: llm_rag_qa_data_generation display_name: LLM - Generate QnA Test Data is_deterministic: true diff --git a/assets/large_language_models/rag/components/register_mlindex_asset/spec.yaml b/assets/large_language_models/rag/components/register_mlindex_asset/spec.yaml index 78128d3a96..bfd6bf7869 100644 --- a/assets/large_language_models/rag/components/register_mlindex_asset/spec.yaml +++ b/assets/large_language_models/rag/components/register_mlindex_asset/spec.yaml @@ -4,7 +4,7 @@ type: command tags: Preview: "" -version: 0.0.75 +version: 0.0.76 name: llm_rag_register_mlindex_asset display_name: LLM - Register Vector Index Asset is_deterministic: true diff --git a/assets/large_language_models/rag/components/register_qa_data_asset/spec.yaml b/assets/large_language_models/rag/components/register_qa_data_asset/spec.yaml index 7762526767..933e19944f 100644 --- a/assets/large_language_models/rag/components/register_qa_data_asset/spec.yaml +++ b/assets/large_language_models/rag/components/register_qa_data_asset/spec.yaml @@ -4,7 +4,7 @@ type: command tags: Preview: "" -version: 0.0.68 +version: 0.0.69 name: llm_rag_register_qa_data_asset display_name: LLM - Register QA Generation Data Asset is_deterministic: true diff --git a/assets/large_language_models/rag/components/update_acs_index/spec.yaml b/assets/large_language_models/rag/components/update_acs_index/spec.yaml index c6e9281d92..134d7462f8 100644 --- a/assets/large_language_models/rag/components/update_acs_index/spec.yaml +++ b/assets/large_language_models/rag/components/update_acs_index/spec.yaml @@ -4,7 +4,7 @@ type: command tags: Preview: "" -version: 0.0.75 +version: 0.0.76 name: llm_rag_update_acs_index display_name: LLM - Update ACS Index is_deterministic: true diff --git a/assets/large_language_models/rag/components/update_azure_cosmos_mongo_vcore_index/spec.yaml b/assets/large_language_models/rag/components/update_azure_cosmos_mongo_vcore_index/spec.yaml index 72c07757d8..9de224502d 100644 --- a/assets/large_language_models/rag/components/update_azure_cosmos_mongo_vcore_index/spec.yaml +++ b/assets/large_language_models/rag/components/update_azure_cosmos_mongo_vcore_index/spec.yaml @@ -4,7 +4,7 @@ type: command tags: Preview: "" -version: 0.0.31 +version: 0.0.32 name: llm_rag_update_cosmos_mongo_vcore_index display_name: LLM - Update Azure Cosmos Mongo vCore Index is_deterministic: true diff --git a/assets/large_language_models/rag/components/update_milvus_index/spec.yaml b/assets/large_language_models/rag/components/update_milvus_index/spec.yaml index 76bb332ef9..0ce553652b 100644 --- a/assets/large_language_models/rag/components/update_milvus_index/spec.yaml +++ b/assets/large_language_models/rag/components/update_milvus_index/spec.yaml @@ -4,7 +4,7 @@ type: command tags: Preview: "" -version: 0.0.31 +version: 0.0.32 name: llm_rag_update_milvus_index display_name: LLM - Update Milvus Index is_deterministic: true diff --git a/assets/large_language_models/rag/components/update_pinecone_index/spec.yaml b/assets/large_language_models/rag/components/update_pinecone_index/spec.yaml index dbf63e45bc..258d584351 100644 --- a/assets/large_language_models/rag/components/update_pinecone_index/spec.yaml +++ b/assets/large_language_models/rag/components/update_pinecone_index/spec.yaml @@ -4,7 +4,7 @@ type: command tags: Preview: "" -version: 0.0.43 +version: 0.0.44 name: llm_rag_update_pinecone_index display_name: LLM - Update Pinecone Index is_deterministic: true diff --git a/assets/large_language_models/rag/components/validate_deployments/spec.yaml b/assets/large_language_models/rag/components/validate_deployments/spec.yaml index 5b6a3abb87..98e4bd8d1b 100644 --- a/assets/large_language_models/rag/components/validate_deployments/spec.yaml +++ b/assets/large_language_models/rag/components/validate_deployments/spec.yaml @@ -4,7 +4,7 @@ type: command tags: Preview: "" -version: 0.0.81 +version: 0.0.82 name: llm_rag_validate_deployments display_name: LLM - Validate Deployments is_deterministic: false diff --git a/assets/large_language_models/rag/environments/rag_embeddings/context/Dockerfile b/assets/large_language_models/rag/environments/rag_embeddings/context/Dockerfile index cb44bdae08..cc4b11df84 100644 --- a/assets/large_language_models/rag/environments/rag_embeddings/context/Dockerfile +++ b/assets/large_language_models/rag/environments/rag_embeddings/context/Dockerfile @@ -104,8 +104,8 @@ RUN python3 -m nltk.downloader punkt && \ ENV TIKA_SERVER_JAR file:///tika-server.jar # Install tika server -RUN downloadUrl='http://search.maven.org/remotecontent?filepath=org/apache/tika/tika-server-standard/3.0.0/tika-server-standard-3.0.0.jar'; \ - downloadMd5='http://search.maven.org/remotecontent?filepath=org/apache/tika/tika-server-standard/3.0.0/tika-server-standard-3.0.0.jar.md5'; \ +RUN downloadUrl='http://search.maven.org/remotecontent?filepath=org/apache/tika/tika-server-standard/3.1.0/tika-server-standard-3.1.0.jar'; \ + downloadMd5='http://search.maven.org/remotecontent?filepath=org/apache/tika/tika-server-standard/3.1.0/tika-server-standard-3.1.0.jar.md5'; \ wget --progress=dot:giga -O tika-server.jar "$downloadUrl"; \ # tika-python looks for tika-server.jar.md5 file along with TIKA_SERVER_JAR wget -O tika-server.jar.md5 "$downloadMd5"; \ diff --git a/assets/models/system/ALLaM-2-7b-instruct/spec.yaml b/assets/models/system/ALLaM-2-7b-instruct/spec.yaml index 3e82db085d..2458a41085 100644 --- a/assets/models/system/ALLaM-2-7b-instruct/spec.yaml +++ b/assets/models/system/ALLaM-2-7b-instruct/spec.yaml @@ -10,7 +10,6 @@ tags: displayName: "ALLaM-2-7b-instruct" summary: "ALLaM is a series of powerful language models designed to advance Arabic Language Technology." disable-batch: "true" - disable-maap: "true" maxOutputTokens: 4096 hiddenlayerscanned : "true" languages: "AR, EN" @@ -34,4 +33,4 @@ tags: Standard_ND96amsr_A100_v4, Standard_NC96ads_A100_v4 ] -version: 3 +version: 2 diff --git a/assets/models/system/openai-whisper-large-v3/spec.yaml b/assets/models/system/openai-whisper-large-v3/spec.yaml index 063c5496fc..36964f4b7b 100644 --- a/assets/models/system/openai-whisper-large-v3/spec.yaml +++ b/assets/models/system/openai-whisper-large-v3/spec.yaml @@ -6,7 +6,7 @@ properties: SHA: "" inference-min-sku-spec: 6|0|56|112 inference-recommended-sku: Standard_DS5_v2, Standard_D16a_v4, Standard_D16as_v4, Standard_D32a_v4, Standard_D32as_v4, Standard_D48a_v4, Standard_D48as_v4, Standard_D64a_v4, Standard_D64as_v4, Standard_D96a_v4, Standard_D96as_v4, Standard_F32s_v2, Standard_F48s_v2, Standard_F64s_v2, Standard_F72s_v2, Standard_FX24mds, Standard_FX36mds, Standard_FX48mds, Standard_E16s_v3, Standard_E32s_v3, Standard_E48s_v3, Standard_E64s_v3, Standard_NC6s_v3, Standard_NC8as_T4_v3, Standard_NC12s_v3, Standard_NC16as_T4_v3, Standard_NC64as_T4_v3, Standard_NC48ads_A100_v4, Standard_NC96ads_A100_v4, Standard_ND96asr_v4, Standard_ND96amsr_A100_v4, Standard_ND40rs_v2 - languages: en, zh, de, es, ru, ko, fr, ja, pt, tr, pl, ca, nl, ar, sv, it, id, hi, fi, vi, he, uk, el, ms, cs, ro, da, hu, ta, no, th, ur, hr, bg, lt, la, mi, ml, cy, sk, te, fa, lv, bn, sr, az, sl, kn, et, mk, br, eu, is, hy, ne, mn, bs, kk, sq, sw, gl, mr, pa, si, km, sn, yo, so, af, oc, ka, be, tg, sd, gu, am, yi, lo, uz, fo, ht, ps, tk, nn, mt, sa, lb, my, bo, tl, mg, as, tt, haw, ln, ha, ba, jw, su + languages: en, zh, de, es, ru, ko, fr, ja, pt, tr, pl, ca, nl, ar, sv, it, id, hi, fi, vi, he, uk, el, ms, cs, ro, da, hu, ta, no, th, ur, hr, bg, lt, la, mi, ml, cy, sk, te, fa, lv, bn, sr, az, sl, kn, et, mk, br, eu, is, hy, ne, mn, bs, kk, sq, sw, gl, mr, pa, si, km, sn, yo, so, af, oc, ka, be, tg, sd, gu, am, yi, lo, uz, fo, ht, ps, tk, nn, mt, sa, lb, my, bo, tl, mg, as, tt, ln, ha, ba, jw, su tags: huggingface_model_id: openai/whisper-large-v3 hiddenlayerscanned: "" @@ -48,4 +48,4 @@ tags: license: mit SharedComputeCapacityEnabled: "" task: automatic-speech-recognition -version: 5 +version: 6 diff --git a/assets/models/system/stabilityai-stable-diffusion-xl-refiner-1-0/MLmodel b/assets/models/system/stabilityai-stable-diffusion-xl-refiner-1-0/MLmodel index e15c728568..7e9cf50d29 100644 --- a/assets/models/system/stabilityai-stable-diffusion-xl-refiner-1-0/MLmodel +++ b/assets/models/system/stabilityai-stable-diffusion-xl-refiner-1-0/MLmodel @@ -3,7 +3,7 @@ flavors: artifacts: model_dir: path: artifacts/INPUT_model_path - uri: /mnt/azureml/cr/j/1072f8cb6ce441698bec335701c81429/cap/data-capability/wd/INPUT_model_path + uri: /mnt/azureml/cr/j/56b90b081c0f47a3a762d91e87421b18/cap/data-capability/wd/INPUT_model_path cloudpickle_version: 2.2.1 code: code env: @@ -11,19 +11,20 @@ flavors: virtualenv: python_env.yaml loader_module: mlflow.pyfunc.model python_model: python_model.pkl - python_version: 3.8.18 + python_version: 3.9.20 + streamable: false metadata: base_model_name: stabilityai/stable-diffusion-xl-refiner-1.0 base_model_task: image-to-image is_acft_model: true is_finetuned_model: false -mlflow_version: 2.10.2 -model_size_bytes: 30888665872 -model_uuid: 0b6ce11600f5498cb97ec3e0efeb5d60 +mlflow_version: 2.15.1 +model_size_bytes: 30888652342 +model_uuid: 67cda94ee3814b68baa4b58c399e3694 signature: inputs: '[{"type": "string", "name": "prompt", "required": true}, {"type": "binary", "name": "image", "required": true}]' outputs: '[{"type": "binary", "name": "generated_image", "required": true}, {"type": "boolean", "name": "nsfw_content_detected", "required": true}]' params: null -utc_time_created: '2024-04-29 17:41:13.002668' +utc_time_created: '2025-02-03 16:23:47.964278' diff --git a/assets/models/system/stabilityai-stable-diffusion-xl-refiner-1-0/model.yaml b/assets/models/system/stabilityai-stable-diffusion-xl-refiner-1-0/model.yaml index ce92de7a72..9da4d831e2 100644 --- a/assets/models/system/stabilityai-stable-diffusion-xl-refiner-1-0/model.yaml +++ b/assets/models/system/stabilityai-stable-diffusion-xl-refiner-1-0/model.yaml @@ -1,6 +1,6 @@ path: container_name: finetuning-image-models - container_path: HuggingFace-mlflow/stabilityai-stable-diffusion-xl-refiner-1-0/1714413791/mlflow_model_folder + container_path: HuggingFace-mlflow/stabilityai-stable-diffusion-xl-refiner-1-0/1738651720/mlflow_model_folder storage_name: automlcesdkdataresources type: azureblob publish: diff --git a/assets/models/system/stabilityai-stable-diffusion-xl-refiner-1-0/spec.yaml b/assets/models/system/stabilityai-stable-diffusion-xl-refiner-1-0/spec.yaml index 8e7dd3235e..598ecfa373 100644 --- a/assets/models/system/stabilityai-stable-diffusion-xl-refiner-1-0/spec.yaml +++ b/assets/models/system/stabilityai-stable-diffusion-xl-refiner-1-0/spec.yaml @@ -24,4 +24,4 @@ tags: Standard_ND96amsr_A100_v4, Standard_ND96asr_v4 ] -version: 5 +version: 6 diff --git a/assets/training/distillation/components/data_generation/spec.yaml b/assets/training/distillation/components/data_generation/spec.yaml index 0de2961f05..8116018547 100644 --- a/assets/training/distillation/components/data_generation/spec.yaml +++ b/assets/training/distillation/components/data_generation/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: oss_distillation_generate_data -version: 0.0.8 +version: 0.0.9 type: command is_deterministic: True @@ -121,6 +121,10 @@ inputs: type: uri_file description: Validation status. mode: rw_mount + + model_asset_id: + type: string + description: Student model to use outputs: generated_train_file_path: @@ -152,5 +156,6 @@ command: >- $[[--enable_chain_of_density ${{inputs.enable_chain_of_density}}]] $[[--max_len_summary ${{inputs.max_len_summary}}]] --data_generation_task_type ${{inputs.data_generation_task_type}} + --model_asset_id ${{inputs.model_asset_id}} --generated_train_file_path ${{outputs.generated_train_file_path}} --generated_validation_file_path ${{outputs.generated_validation_file_path}} diff --git a/assets/training/distillation/components/data_generation_batch_scoring_pipeline/spec.yaml b/assets/training/distillation/components/data_generation_batch_scoring_pipeline/spec.yaml index 0d4d8454f0..751d5b535e 100644 --- a/assets/training/distillation/components/data_generation_batch_scoring_pipeline/spec.yaml +++ b/assets/training/distillation/components/data_generation_batch_scoring_pipeline/spec.yaml @@ -160,7 +160,6 @@ inputs: 4. MATH: Generate Math data for numerical responses 5. SUMMARIZATION: Generate Key Summary for an Article - # Output of validation component. validation_info: type: uri_file diff --git a/assets/training/distillation/components/data_generation_batch_scoring_postprocess/spec.yaml b/assets/training/distillation/components/data_generation_batch_scoring_postprocess/spec.yaml index 1720d6d8f6..f89a121e99 100644 --- a/assets/training/distillation/components/data_generation_batch_scoring_postprocess/spec.yaml +++ b/assets/training/distillation/components/data_generation_batch_scoring_postprocess/spec.yaml @@ -82,6 +82,7 @@ inputs: type: uri_file description: Connection config file for batch scoring + outputs: generated_batch_train_file_path: type: uri_file diff --git a/assets/training/distillation/components/data_generation_seq_scoring_pipeline/spec.yaml b/assets/training/distillation/components/data_generation_seq_scoring_pipeline/spec.yaml index ce2d2cae1a..edcc5951b2 100644 --- a/assets/training/distillation/components/data_generation_seq_scoring_pipeline/spec.yaml +++ b/assets/training/distillation/components/data_generation_seq_scoring_pipeline/spec.yaml @@ -172,6 +172,10 @@ inputs: 4. MATH: Generate Math data for numerical responses 5. SUMMARIZATION: Generate Key Summary for an Article + model_asset_id: + type: string + description: The student model asset id + optional: false # Training parameters num_train_epochs: @@ -212,7 +216,7 @@ outputs: jobs: oss_distillation_generate_data: type: command - component: azureml:oss_distillation_generate_data:0.0.8 + component: azureml:oss_distillation_generate_data:0.0.9 compute: '${{parent.inputs.compute_data_generation}}' resources: instance_type: '${{parent.inputs.instance_type_data_generation}}' @@ -236,6 +240,7 @@ jobs: request_batch_size: '${{parent.inputs.request_batch_size}}' min_endpoint_success_ratio: '${{parent.inputs.min_endpoint_success_ratio}}' validation_output: '${{parent.inputs.validation_output}}' + model_asset_id: '${{parent.inputs.model_asset_id}}' outputs: generated_train_file_path: '${{parent.outputs.generated_train_file_path}}' generated_validation_file_path: '${{parent.outputs.generated_validation_file_path}}' diff --git a/assets/training/distillation/components/pipeline/spec.yaml b/assets/training/distillation/components/pipeline/spec.yaml index 8e179ea29c..2984f6a8e4 100644 --- a/assets/training/distillation/components/pipeline/spec.yaml +++ b/assets/training/distillation/components/pipeline/spec.yaml @@ -270,11 +270,11 @@ inputs: optional: true description: Validation parameters propagated from pipeline. - # Model parameters + # Student Model parameters model_asset_id: type: string optional: false - description: Asset id of model + description: Asset id of the student model # Model registration registered_model_name: @@ -323,6 +323,7 @@ jobs: num_train_epochs: '${{parent.inputs.num_train_epochs}}' per_device_train_batch_size: '${{parent.inputs.per_device_train_batch_size}}' learning_rate: '${{parent.inputs.learning_rate}}' + model_asset_id: '${{parent.inputs.model_asset_id}}' outputs: validation_info: type: uri_file @@ -426,6 +427,7 @@ jobs: max_len_summary: '${{parent.inputs.max_len_summary}}' data_generation_task_type: '${{parent.inputs.data_generation_task_type}}' validation_output: '${{parent.jobs.oss_distillation_validate_pipeline.outputs.validation_info}}' + model_asset_id: '${{parent.inputs.model_asset_id}}' outputs: generated_train_file_path: type: uri_file @@ -460,7 +462,7 @@ jobs: oss_text_generation_data_import: type: command - component: azureml:oss_text_generation_data_import:0.0.25 + component: azureml:oss_text_generation_data_import:0.0.26 compute: '${{parent.inputs.compute_data_import}}' resources: instance_type: '${{parent.inputs.instance_type_data_import}}' @@ -478,7 +480,7 @@ jobs: oss_chat_completion_finetune: type: command - component: azureml:oss_chat_completion_finetune:0.0.25 + component: azureml:oss_chat_completion_finetune:0.0.26 compute: '${{parent.inputs.compute_finetune}}' resources: instance_type: '${{parent.inputs.instance_type_finetune}}' diff --git a/assets/training/distillation/components/pipeline_validation/spec.yaml b/assets/training/distillation/components/pipeline_validation/spec.yaml index 84a99106f0..a52d287e19 100644 --- a/assets/training/distillation/components/pipeline_validation/spec.yaml +++ b/assets/training/distillation/components/pipeline_validation/spec.yaml @@ -135,6 +135,11 @@ inputs: optional: true description: Start learning rate. + model_asset_id: + type: string + optional: false + description: The student model to finetune + outputs: validation_info: type: uri_file @@ -163,4 +168,5 @@ command: >- $[[--num_train_epochs ${{inputs.num_train_epochs}}]] $[[--per_device_train_batch_size ${{inputs.per_device_train_batch_size}}]] $[[--learning_rate ${{inputs.learning_rate}}]] + --model_asset_id '${{inputs.model_asset_id}}' --validation_info ${{outputs.validation_info}} diff --git a/assets/training/distillation/src/common/constants.py b/assets/training/distillation/src/common/constants.py index 6835f7f713..8d02799bff 100644 --- a/assets/training/distillation/src/common/constants.py +++ b/assets/training/distillation/src/common/constants.py @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. -"""Data generatior constants.""" +"""Data generation constants.""" import re from enum import EnumMeta, Enum @@ -36,15 +36,6 @@ } } -# SUPPORTED STUDENT MODEL -# MAP keys are model name in registry, which maps to specific model details like registry and supported versions -SUPPORTED_STUDENT_MODEL_MAP = { - "Meta-Llama-3.1-8B-Instruct": { - "supported_registries": ["azureml-meta"], - "supported_version_pattern": re.compile(r"\d+"), - } -} - # Scoring paths VLLM_CHAT_SCORE_PATH = "/v1/chat/completions" HFTV2_TEXT_GEN_SCORE_PATH = "/score" diff --git a/assets/training/distillation/src/common/student_models.py b/assets/training/distillation/src/common/student_models.py new file mode 100644 index 0000000000..813614aaee --- /dev/null +++ b/assets/training/distillation/src/common/student_models.py @@ -0,0 +1,132 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +"""Student Model Info and Requirements.""" + +import re +from typing import Dict, List + +from common.constants import REGISTRY_MODEL_PATTERN, DataGenerationTaskType + + +class StudentModels: + """Student model information and requirements.""" + + SUPPORTED_STUDENT_MODELS = { + "Meta-Llama-3.1-8B-Instruct": { + "supported_registries": ["azureml-meta"], + "supported_version_pattern": re.compile(r"\d+") + }, + "Phi-3-mini-4k-instruct": { + "supported_registries": ["azureml"], + "supported_version_pattern": re.compile(r"\d+") + }, + "Phi-3-mini-128k-instruct": { + "supported_registries": ["azureml"], + "supported_version_pattern": re.compile(r"\d+") + }, + "Phi-3.5-mini-instruct": { + "supported_registries": ["azureml"], + "supported_version_pattern": re.compile(r"\d+") + }, + "Phi-3.5-MoE-instruct": { + "supported_registries": ["azureml"], + "supported_version_pattern": re.compile(r"\d+") + }, + "Phi-3-medium-4k-instruct": { + "supported_registries": ["azureml"], + "supported_version_pattern": re.compile(r"\d+"), + }, + "Phi-3-medium-128k-instruct": { + "supported_registries": ["azureml"], + "supported_version_pattern": re.compile(r"\d+"), + }, + } + + # Student models that do not recognize system prompts + NO_SYSTEM_PROMPT_MODELS = [ + "Phi-3-medium-4k-instruct", + "Phi-3-medium-128k-instruct" + ] + + @classmethod + def no_system_prompt_reformat(cls, data: List[Dict[str, list]]) -> List[Dict[str, list]]: + """Add system prompt to user prompt for student models that do not accept system prompts. + + :param data: The synthetic data generated from the teacher model + :type data: List[Dict[str, list]] + :return: Reformated data + :rtype: List[Dict[str, list]] + """ + new_data = [] + system_message = "" + for messages in data: + system_message = messages["messages"][0]["content"] + question = messages["messages"][1]["content"] + reformatted_data = { + "messages": + [ + {"role": "user", "content": system_message + " " + question}, + messages["messages"][2] + ] + } + new_data.append(reformatted_data) + return new_data + + @classmethod + def no_system_prompt_reformat_conversation(cls, data: List[Dict[str, list]]) -> List[Dict[str, list]]: + """Add system prompt to user prompt for student models that do not accept system prompts. + + :param data: The synthetic data generated from the teacher model + :type data: List[Dict[str, list]] + :return: Reformated data + :rtype: List[Dict[str, list]] + """ + new_data = [] + system_message = "" + for messages in data: + system_message = messages["messages"][0]["content"] + user_prompt = messages["messages"][1]["content"] + reformatted_data = { + "messages": + [ + {"role": "user", "content": system_message + " " + user_prompt}, + messages["messages"][2:] + ] + } + new_data.append(reformatted_data) + return new_data + + @classmethod + def reformat(cls, student_model: str, task_type: str, data: List[Dict[str, list]]) -> List[Dict[str, list]]: + """Reformats synthetic data based on the student model and task type requirements. + + :param student_model: The student model to finetune + :type student_model: str + :param task_type: The data generation task type + :type task_type: str + :param data: The synthetic data generated from the teacher model + :type data: List[Dict[str, list]] + :return: Reformatted data based on student model and task type + :rtype: List[Dict[str, list]] + """ + if student_model in cls.NO_SYSTEM_PROMPT_MODELS: + if task_type == DataGenerationTaskType.CONVERSATION: + return cls.no_system_prompt_reformat_conversation(data) + return cls.no_system_prompt_reformat(data) + return data + + @classmethod + def parse_model_asset_id(cls, asset_id: str) -> str: + """Parse asset id to extract the student model name. + + :param asset_id: The asset id of the student model in the form + azureml://registries/{registry}/models/{model}/versions/{version}. + :type asset_id: str + """ + match = re.search(REGISTRY_MODEL_PATTERN, asset_id) + model = match.group("model") + + if model not in cls.NO_SYSTEM_PROMPT_MODELS: + raise Exception("Model is not in supported student model list") + return model diff --git a/assets/training/distillation/src/common/utils.py b/assets/training/distillation/src/common/utils.py index b0dac291d4..de778ab54f 100644 --- a/assets/training/distillation/src/common/utils.py +++ b/assets/training/distillation/src/common/utils.py @@ -33,11 +33,12 @@ from common.constants import ( REQUESTS_RETRY_DELAY, REGISTRY_MODEL_PATTERN, - SUPPORTED_STUDENT_MODEL_MAP, SUPPORTED_TEACHER_MODEL_MAP, BackoffConstants, ) +from common.student_models import StudentModels + logger = get_logger_app( "azureml.acft.contrib.hf.nlp.entry_point.data_import.data_import" @@ -396,7 +397,7 @@ def validate_student_model_details(model_asset_id: str) -> Tuple[str, str, str]: Returns: Tuple[str, str, str]: Tuple containing registry name, model name and model version """ - return _get_model_details(model_asset_id, SUPPORTED_STUDENT_MODEL_MAP) + return _get_model_details(model_asset_id, StudentModels.SUPPORTED_STUDENT_MODELS) def get_base_url(url: str) -> str: diff --git a/assets/training/distillation/src/generate_data.py b/assets/training/distillation/src/generate_data.py index 2a50a281af..a3251cbbda 100644 --- a/assets/training/distillation/src/generate_data.py +++ b/assets/training/distillation/src/generate_data.py @@ -52,6 +52,8 @@ DEFAULT_MAX_LEN_SUMMARY, ) +from common.student_models import StudentModels + from common.utils import ( get_workspace_mlclient, get_endpoint_details, @@ -219,6 +221,13 @@ def get_parser(): choices=[v.value for v in DataGenerationTaskType], ) + parser.add_argument( + "--model_asset_id", + type=str, + required=True, + help="Student model to use" + ) + return parser @@ -273,7 +282,9 @@ def generate_synthetic_data( generated_validation_file_path: Path, train_file_path: Path, data_generation_task_type: str, - validation_file_path: Path = None, + student_model: str, + validation_file_path: Path = None + ): """Generate and save synthentic data under output_dataset. @@ -288,6 +299,7 @@ def generate_synthetic_data( max_len_summary (int): Maximum word count for text summarization output_dataset (Path): Path to output directory train_file_path (Path): Train JSONL file path + student_model (str): Student model name validation_file_path (Path, optional): Validation JSONL file path. Defaults to None. """ @@ -351,7 +363,7 @@ def process_request(idx: str, data: dict, url: str, endpoint_key: str): dict: result dictionary """ try: - # Basic validation for the input data + # Basic validation for the input data messages = data.pop("messages", []) if not messages: # empty messages return { @@ -527,10 +539,17 @@ def batch_process_data( ) else: output_data.append({"messages": future_result["messages"]}) - Path(output_file_path.parent).mkdir(exist_ok=True, parents=True) - with open(output_file_path, "w") as f: - for entry in output_data: - f.write(json.dumps(entry) + "\n") + Path(output_file_path.parent).mkdir(exist_ok=True, parents=True) + + # Reformat data based on student model limitations + output_data = StudentModels.reformat( + student_model=student_model, + task_type=data_generation_task_type, + data=output_data + ) + with open(output_file_path, "w") as f: + for entry in output_data: + f.write(json.dumps(entry) + "\n") if error_map: logger.info( @@ -594,6 +613,7 @@ def data_import(args: Namespace): enable_cod_str = args.enable_chain_of_density max_len_summary = args.max_len_summary data_generation_task_type = args.data_generation_task_type + model_asset_id = args.model_asset_id # validate file formats validate_file_paths_with_supported_formats( @@ -680,7 +700,8 @@ def data_import(args: Namespace): generated_validation_file_path=generated_validation_file_path, train_file_path=train_file_path, data_generation_task_type=data_generation_task_type, - validation_file_path=validation_file_path, + student_model=StudentModels.parse_model_asset_id(model_asset_id), + validation_file_path=validation_file_path ) diff --git a/assets/training/distillation/src/generate_data_postprocess.py b/assets/training/distillation/src/generate_data_postprocess.py index c90a84075f..b308f674a7 100644 --- a/assets/training/distillation/src/generate_data_postprocess.py +++ b/assets/training/distillation/src/generate_data_postprocess.py @@ -36,6 +36,7 @@ STATUS_SUCCESS, FINISH_REASON_STOP, ) +# from common.student_models import StudentModels from common.utils import ( get_hash_value, @@ -166,6 +167,13 @@ def get_parser(): help="A config file path that contains deployment configurations.", ) + # parser.add_argument( + # "--model_asset_id", + # type=str, + # required=True, + # help="The student model asset id" + # ) + return parser @@ -200,7 +208,8 @@ def postprocess_data( data_generation_task_type: str, min_endpoint_success_ratio: float, output_file_path: str, - hash_data: str, + hash_data: str + # student_model: str ): """Generate and save synthentic data under output_dataset. @@ -213,6 +222,7 @@ def postprocess_data( min_endpoint_success_ratio (float): Minimum success ratio below which run will be considered a failure output_file_path (str): Output JSONL file path. hash_data (str): Path to the jsonl file containing the hash for each payload. + student_model (str): The student model to finetune """ error_count = 0 output_data = [] @@ -288,6 +298,13 @@ def postprocess_data( if success_ratio < min_endpoint_success_ratio: msg = f"Success ratio for dataset {input_file_path}: {success_ratio} < {min_endpoint_success_ratio}." raise Exception(msg) + + # Reformat data based on student model limitations + # output_data = StudentModels.reformat( + # student_model=student_model, + # task_type=data_generation_task_type, + # data=output_data + # ) with open(output_file_path, "w") as f: for record in output_data: f.write(json.dumps(record) + "\n") @@ -308,6 +325,7 @@ def data_import(args: Namespace): hash_train_data = args.hash_train_data hash_validation_data = args.hash_validation_data connection_config_file = args.connection_config_file + # model_asset_id = args.model_asset_id enable_cot = True if enable_cot_str.lower() == "true" else False enable_cod = True if enable_cod_str.lower() == "true" else False @@ -330,7 +348,8 @@ def data_import(args: Namespace): data_generation_task_type=data_generation_task_type, min_endpoint_success_ratio=min_endpoint_success_ratio, output_file_path=generated_batch_train_file_path, - hash_data=hash_train_data, + hash_data=hash_train_data + # student_model=StudentModels.parse_model_asset_id(model_asset_id) ) if validation_file_path: with log_activity( @@ -349,7 +368,8 @@ def data_import(args: Namespace): data_generation_task_type=data_generation_task_type, min_endpoint_success_ratio=min_endpoint_success_ratio, output_file_path=generated_batch_validation_file_path, - hash_data=hash_validation_data, + hash_data=hash_validation_data + # student_model=StudentModels.parse_model_asset_id(model_asset_id) ) else: Path(generated_batch_validation_file_path.parent).mkdir( diff --git a/assets/training/distillation/src/validate_pipeline.py b/assets/training/distillation/src/validate_pipeline.py index a916ba7dea..eaa0d236a1 100644 --- a/assets/training/distillation/src/validate_pipeline.py +++ b/assets/training/distillation/src/validate_pipeline.py @@ -205,7 +205,7 @@ def _validate_model_inference(self): url = url if VLLM_CHAT_SCORE_PATH in url else f"{url}{VLLM_CHAT_SCORE_PATH}" logger.info(f"Model endpoint: {url}") response = requests.post( - url=url, headers=headers, data=json.dumps(inference_params) + url=url, headers=headers, data=json.dumps(inference_params), timeout=180 ) response.raise_for_status() diff --git a/assets/training/finetune_acft_hf_nlp/components/finetune/chat_completion/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/finetune/chat_completion/spec.yaml index 2abc2b0556..bdcec594d0 100644 --- a/assets/training/finetune_acft_hf_nlp/components/finetune/chat_completion/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/finetune/chat_completion/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: chat_completion_finetune -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/finetune/question_answering/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/finetune/question_answering/spec.yaml index a94858f829..18231636bc 100644 --- a/assets/training/finetune_acft_hf_nlp/components/finetune/question_answering/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/finetune/question_answering/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: question_answering_finetune -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/finetune/summarization/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/finetune/summarization/spec.yaml index 0743a1eae3..d96ca4d73e 100644 --- a/assets/training/finetune_acft_hf_nlp/components/finetune/summarization/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/finetune/summarization/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: summarization_finetune -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/finetune/text_classification/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/finetune/text_classification/spec.yaml index f66ef609a1..422208df75 100644 --- a/assets/training/finetune_acft_hf_nlp/components/finetune/text_classification/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/finetune/text_classification/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: text_classification_finetune -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: false diff --git a/assets/training/finetune_acft_hf_nlp/components/finetune/text_generation/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/finetune/text_generation/spec.yaml index 7b56db5758..d45f7e0168 100644 --- a/assets/training/finetune_acft_hf_nlp/components/finetune/text_generation/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/finetune/text_generation/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: text_generation_finetune -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/finetune/token_classification/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/finetune/token_classification/spec.yaml index 03910bd128..71eef45eb3 100644 --- a/assets/training/finetune_acft_hf_nlp/components/finetune/token_classification/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/finetune/token_classification/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: token_classification_finetune -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: false diff --git a/assets/training/finetune_acft_hf_nlp/components/finetune/translation/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/finetune/translation/spec.yaml index d97a270c35..8df804ca23 100644 --- a/assets/training/finetune_acft_hf_nlp/components/finetune/translation/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/finetune/translation/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: translation_finetune -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/model_converter/common/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/model_converter/common/spec.yaml index acfe3cb9e2..99f06b046b 100644 --- a/assets/training/finetune_acft_hf_nlp/components/model_converter/common/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/model_converter/common/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: ft_nlp_model_converter -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/model_import/chat_completion/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/model_import/chat_completion/spec.yaml index 31506ad3f5..36bc3f42f3 100644 --- a/assets/training/finetune_acft_hf_nlp/components/model_import/chat_completion/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/model_import/chat_completion/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: chat_completion_model_import -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/model_import/question_answering/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/model_import/question_answering/spec.yaml index 07afcefa48..d00490913e 100644 --- a/assets/training/finetune_acft_hf_nlp/components/model_import/question_answering/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/model_import/question_answering/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: question_answering_model_import -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/model_import/summarization/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/model_import/summarization/spec.yaml index 8dfc4b66e5..d145f54d2a 100644 --- a/assets/training/finetune_acft_hf_nlp/components/model_import/summarization/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/model_import/summarization/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: summarization_model_import -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/model_import/text_classification/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/model_import/text_classification/spec.yaml index 78d583417d..28bd1cba67 100644 --- a/assets/training/finetune_acft_hf_nlp/components/model_import/text_classification/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/model_import/text_classification/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: text_classification_model_import -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/model_import/text_generation/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/model_import/text_generation/spec.yaml index 562352d69f..cc6c690eb0 100644 --- a/assets/training/finetune_acft_hf_nlp/components/model_import/text_generation/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/model_import/text_generation/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: text_generation_model_import -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/model_import/token_classification/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/model_import/token_classification/spec.yaml index d96b8bdf08..2868933520 100644 --- a/assets/training/finetune_acft_hf_nlp/components/model_import/token_classification/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/model_import/token_classification/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: token_classification_model_import -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/model_import/translation/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/model_import/translation/spec.yaml index fb52ba94da..2ca9838a21 100644 --- a/assets/training/finetune_acft_hf_nlp/components/model_import/translation/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/model_import/translation/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: translation_model_import -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/chat_completion/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/chat_completion/spec.yaml index 893ff31192..8b3d0b66b2 100644 --- a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/chat_completion/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/chat_completion/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/pipelineComponent.schema.json name: chat_completion_pipeline -version: 0.0.68 +version: 0.0.69 type: pipeline display_name: Chat Completion Pipeline description: Pipeline Component to finetune Hugging Face pretrained models for chat completion task. The component supports optimizations such as LoRA, Deepspeed and ONNXRuntime for performance enhancement. See [docs](https://aka.ms/azureml/components/chat_completion_pipeline) to learn more. @@ -488,14 +488,14 @@ outputs: description: output folder containing _best_ finetuned model in mlflow format. mode: rw_mount - # evaluation_result: - # type: uri_folder - # description: Test Data Evaluation Results + evaluation_result: + type: uri_folder + description: Test Data Evaluation Results jobs: ft_nlp_common_validation: type: command - component: azureml:ft_nlp_common_validation:0.0.67 + component: azureml:ft_nlp_common_validation:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -532,7 +532,7 @@ jobs: auto_find_batch_size: '${{parent.inputs.auto_find_batch_size}}' chat_completion_model_import: type: command - component: azureml:chat_completion_model_import:0.0.67 + component: azureml:chat_completion_model_import:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -543,7 +543,7 @@ jobs: validation_output: '${{parent.jobs.ft_nlp_common_validation.outputs.validation_info}}' chat_completion_datapreprocess: type: command - component: azureml:chat_completion_datapreprocess:0.0.67 + component: azureml:chat_completion_datapreprocess:0.0.68 compute: '${{parent.inputs.compute_preprocess}}' resources: instance_type: '${{parent.inputs.instance_type_preprocess}}' @@ -560,7 +560,7 @@ jobs: model_selector_output: '${{parent.jobs.chat_completion_model_import.outputs.output_dir}}' chat_completion_finetune: type: command - component: azureml:chat_completion_finetune:0.0.67 + component: azureml:chat_completion_finetune:0.0.68 compute: '${{parent.inputs.compute_finetune}}' distribution: type: pytorch @@ -618,7 +618,7 @@ jobs: # mlflow_model_folder: '${{parent.outputs.mlflow_model_folder}}' ft_nlp_model_converter: type: command - component: azureml:ft_nlp_model_converter:0.0.67 + component: azureml:ft_nlp_model_converter:0.0.68 compute: '${{parent.inputs.compute_finetune}}' resources: instance_type: '${{parent.inputs.instance_type_finetune}}' diff --git a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/question_answering/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/question_answering/spec.yaml index 9bf6f7309c..9d14c77b4c 100644 --- a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/question_answering/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/question_answering/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/pipelineComponent.schema.json name: question_answering_pipeline -version: 0.0.68 +version: 0.0.69 type: pipeline display_name: Question Answering Pipeline description: Pipeline Component to finetune Hugging Face pretrained models for extractive question answering task. The component supports optimizations such as LoRA, Deepspeed and ONNXRuntime for performance enhancement. See [docs](https://aka.ms/azureml/components/question_answering_pipeline) to learn more. @@ -541,7 +541,7 @@ outputs: jobs: ft_nlp_common_validation: type: command - component: azureml:ft_nlp_common_validation:0.0.67 + component: azureml:ft_nlp_common_validation:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -578,7 +578,7 @@ jobs: auto_find_batch_size: '${{parent.inputs.auto_find_batch_size}}' question_answering_model_import: type: command - component: azureml:question_answering_model_import:0.0.67 + component: azureml:question_answering_model_import:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -589,7 +589,7 @@ jobs: validation_output: '${{parent.jobs.ft_nlp_common_validation.outputs.validation_info}}' question_answering_datapreprocess: type: command - component: azureml:question_answering_datapreprocess:0.0.67 + component: azureml:question_answering_datapreprocess:0.0.68 compute: '${{parent.inputs.compute_preprocess}}' resources: instance_type: '${{parent.inputs.instance_type_preprocess}}' @@ -614,7 +614,7 @@ jobs: model_selector_output: '${{parent.jobs.question_answering_model_import.outputs.output_dir}}' question_answering_finetune: type: command - component: azureml:question_answering_finetune:0.0.67 + component: azureml:question_answering_finetune:0.0.68 compute: '${{parent.inputs.compute_finetune}}' distribution: type: pytorch @@ -671,7 +671,7 @@ jobs: pytorch_model_folder: '${{parent.outputs.pytorch_model_folder}}' ft_nlp_model_converter: type: command - component: azureml:ft_nlp_model_converter:0.0.67 + component: azureml:ft_nlp_model_converter:0.0.68 compute: '${{parent.inputs.compute_finetune}}' resources: instance_type: '${{parent.inputs.instance_type_finetune}}' diff --git a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/summarization/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/summarization/spec.yaml index 2e548b3958..42f55193be 100644 --- a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/summarization/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/summarization/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/pipelineComponent.schema.json name: summarization_pipeline -version: 0.0.68 +version: 0.0.69 type: pipeline display_name: Summarization Pipeline description: Pipeline Component to finetune Hugging Face pretrained models for summarization task. The component supports optimizations such as LoRA, Deepspeed and ONNXRuntime for performance enhancement. See [docs](https://aka.ms/azureml/components/summarization_pipeline) to learn more. @@ -512,7 +512,7 @@ outputs: jobs: ft_nlp_common_validation: type: command - component: azureml:ft_nlp_common_validation:0.0.67 + component: azureml:ft_nlp_common_validation:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -549,7 +549,7 @@ jobs: auto_find_batch_size: '${{parent.inputs.auto_find_batch_size}}' summarization_model_import: type: command - component: azureml:summarization_model_import:0.0.67 + component: azureml:summarization_model_import:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -560,7 +560,7 @@ jobs: validation_output: '${{parent.jobs.ft_nlp_common_validation.outputs.validation_info}}' summarization_datapreprocess: type: command - component: azureml:summarization_datapreprocess:0.0.67 + component: azureml:summarization_datapreprocess:0.0.68 compute: '${{parent.inputs.compute_preprocess}}' resources: instance_type: '${{parent.inputs.instance_type_preprocess}}' @@ -580,7 +580,7 @@ jobs: model_selector_output: '${{parent.jobs.summarization_model_import.outputs.output_dir}}' summarization_finetune: type: command - component: azureml:summarization_finetune:0.0.67 + component: azureml:summarization_finetune:0.0.68 compute: '${{parent.inputs.compute_finetune}}' distribution: type: pytorch @@ -637,7 +637,7 @@ jobs: pytorch_model_folder: '${{parent.outputs.pytorch_model_folder}}' ft_nlp_model_converter: type: command - component: azureml:ft_nlp_model_converter:0.0.67 + component: azureml:ft_nlp_model_converter:0.0.68 compute: '${{parent.inputs.compute_finetune}}' resources: instance_type: '${{parent.inputs.instance_type_finetune}}' diff --git a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_classification/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_classification/spec.yaml index ac57df59c2..57806b79cb 100644 --- a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_classification/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_classification/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/pipelineComponent.schema.json name: text_classification_pipeline -version: 0.0.68 +version: 0.0.69 type: pipeline display_name: Text Classification Pipeline description: Pipeline component to finetune Hugging Face pretrained models for text classification task. The component supports optimizations such as LoRA, Deepspeed and ONNXRuntime for performance enhancement. See [docs](https://aka.ms/azureml/components/text_classification_pipeline) to learn more. @@ -514,7 +514,7 @@ outputs: jobs: ft_nlp_common_validation: type: command - component: azureml:ft_nlp_common_validation:0.0.67 + component: azureml:ft_nlp_common_validation:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -551,7 +551,7 @@ jobs: auto_find_batch_size: '${{parent.inputs.auto_find_batch_size}}' text_classification_model_import: type: command - component: azureml:text_classification_model_import:0.0.67 + component: azureml:text_classification_model_import:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -562,7 +562,7 @@ jobs: validation_output: '${{parent.jobs.ft_nlp_common_validation.outputs.validation_info}}' text_classification_datapreprocess: type: command - component: azureml:text_classification_datapreprocess:0.0.67 + component: azureml:text_classification_datapreprocess:0.0.68 compute: '${{parent.inputs.compute_preprocess}}' resources: instance_type: '${{parent.inputs.instance_type_preprocess}}' @@ -583,7 +583,7 @@ jobs: model_selector_output: '${{parent.jobs.text_classification_model_import.outputs.output_dir}}' text_classification_finetune: type: command - component: azureml:text_classification_finetune:0.0.67 + component: azureml:text_classification_finetune:0.0.68 compute: '${{parent.inputs.compute_finetune}}' distribution: type: pytorch @@ -640,7 +640,7 @@ jobs: pytorch_model_folder: '${{parent.outputs.pytorch_model_folder}}' ft_nlp_model_converter: type: command - component: azureml:ft_nlp_model_converter:0.0.67 + component: azureml:ft_nlp_model_converter:0.0.68 compute: '${{parent.inputs.compute_finetune}}' resources: instance_type: '${{parent.inputs.instance_type_finetune}}' diff --git a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation/spec.yaml index 3076464df3..26cc23e76e 100644 --- a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/pipelineComponent.schema.json name: text_generation_pipeline -version: 0.0.68 +version: 0.0.69 type: pipeline display_name: Text Generation Pipeline description: Pipeline component for text generation @@ -528,7 +528,7 @@ outputs: jobs: ft_nlp_common_validation: type: command - component: azureml:ft_nlp_common_validation:0.0.67 + component: azureml:ft_nlp_common_validation:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -566,7 +566,7 @@ jobs: auto_find_batch_size: '${{parent.inputs.auto_find_batch_size}}' text_generation_model_import: type: command - component: azureml:text_generation_model_import:0.0.67 + component: azureml:text_generation_model_import:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -578,7 +578,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_datapreprocess: type: command - component: azureml:text_generation_datapreprocess:0.0.67 + component: azureml:text_generation_datapreprocess:0.0.68 compute: '${{parent.inputs.compute_preprocess}}' resources: instance_type: '${{parent.inputs.instance_type_preprocess}}' @@ -598,7 +598,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_finetune: type: command - component: azureml:text_generation_finetune:0.0.67 + component: azureml:text_generation_finetune:0.0.68 compute: '${{parent.inputs.compute_finetune}}' distribution: type: pytorch @@ -656,7 +656,7 @@ jobs: pytorch_model_folder: '${{parent.outputs.pytorch_model_folder}}' ft_nlp_model_converter: type: command - component: azureml:ft_nlp_model_converter:0.0.67 + component: azureml:ft_nlp_model_converter:0.0.68 compute: '${{parent.inputs.compute_finetune}}' resources: instance_type: '${{parent.inputs.instance_type_finetune}}' diff --git a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_basic_high/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_basic_high/spec.yaml index a49519ddea..49a80cc776 100644 --- a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_basic_high/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_basic_high/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/pipelineComponent.schema.json name: text_generation_pipeline_singularity_basic_high -version: 0.0.68 +version: 0.0.69 type: pipeline display_name: Text Generation Pipeline Singularity Basic High description: Pipeline component for text generation @@ -520,7 +520,7 @@ outputs: jobs: ft_nlp_common_validation: type: command - component: azureml:ft_nlp_common_validation:0.0.67 + component: azureml:ft_nlp_common_validation:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -563,7 +563,7 @@ jobs: auto_find_batch_size: '${{parent.inputs.auto_find_batch_size}}' text_generation_model_import: type: command - component: azureml:text_generation_model_import:0.0.67 + component: azureml:text_generation_model_import:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -580,7 +580,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_datapreprocess: type: command - component: azureml:text_generation_datapreprocess:0.0.67 + component: azureml:text_generation_datapreprocess:0.0.68 compute: '${{parent.inputs.compute_preprocess}}' resources: instance_type: '${{parent.inputs.instance_type_preprocess}}' @@ -605,7 +605,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_finetune: type: command - component: azureml:text_generation_finetune:0.0.67 + component: azureml:text_generation_finetune:0.0.68 compute: '${{parent.inputs.compute_finetune}}' distribution: type: pytorch @@ -667,7 +667,7 @@ jobs: pytorch_model_folder: '${{parent.outputs.pytorch_model_folder}}' ft_nlp_model_converter: type: command - component: azureml:ft_nlp_model_converter:0.0.67 + component: azureml:ft_nlp_model_converter:0.0.68 compute: '${{parent.inputs.compute_finetune}}' resources: instance_type: '${{parent.inputs.instance_type_finetune}}' diff --git a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_basic_low/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_basic_low/spec.yaml index 0de4831a0a..3944d74f4b 100644 --- a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_basic_low/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_basic_low/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/pipelineComponent.schema.json name: text_generation_pipeline_singularity_basic_low -version: 0.0.68 +version: 0.0.69 type: pipeline display_name: Text Generation Pipeline Singularity Basic Low description: Pipeline component for text generation @@ -520,7 +520,7 @@ outputs: jobs: ft_nlp_common_validation: type: command - component: azureml:ft_nlp_common_validation:0.0.67 + component: azureml:ft_nlp_common_validation:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -563,7 +563,7 @@ jobs: auto_find_batch_size: '${{parent.inputs.auto_find_batch_size}}' text_generation_model_import: type: command - component: azureml:text_generation_model_import:0.0.67 + component: azureml:text_generation_model_import:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -580,7 +580,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_datapreprocess: type: command - component: azureml:text_generation_datapreprocess:0.0.67 + component: azureml:text_generation_datapreprocess:0.0.68 compute: '${{parent.inputs.compute_preprocess}}' resources: instance_type: '${{parent.inputs.instance_type_preprocess}}' @@ -605,7 +605,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_finetune: type: command - component: azureml:text_generation_finetune:0.0.67 + component: azureml:text_generation_finetune:0.0.68 compute: '${{parent.inputs.compute_finetune}}' distribution: type: pytorch @@ -667,7 +667,7 @@ jobs: pytorch_model_folder: '${{parent.outputs.pytorch_model_folder}}' ft_nlp_model_converter: type: command - component: azureml:ft_nlp_model_converter:0.0.67 + component: azureml:ft_nlp_model_converter:0.0.68 compute: '${{parent.inputs.compute_finetune}}' resources: instance_type: '${{parent.inputs.instance_type_finetune}}' diff --git a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_basic_medium/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_basic_medium/spec.yaml index 68d6667efc..59cc1e921a 100644 --- a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_basic_medium/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_basic_medium/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/pipelineComponent.schema.json name: text_generation_pipeline_singularity_basic_medium -version: 0.0.68 +version: 0.0.69 type: pipeline display_name: Text Generation Pipeline Singularity Basic Medium description: Pipeline component for text generation @@ -520,7 +520,7 @@ outputs: jobs: ft_nlp_common_validation: type: command - component: azureml:ft_nlp_common_validation:0.0.67 + component: azureml:ft_nlp_common_validation:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -563,7 +563,7 @@ jobs: auto_find_batch_size: '${{parent.inputs.auto_find_batch_size}}' text_generation_model_import: type: command - component: azureml:text_generation_model_import:0.0.67 + component: azureml:text_generation_model_import:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -580,7 +580,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_datapreprocess: type: command - component: azureml:text_generation_datapreprocess:0.0.67 + component: azureml:text_generation_datapreprocess:0.0.68 compute: '${{parent.inputs.compute_preprocess}}' resources: instance_type: '${{parent.inputs.instance_type_preprocess}}' @@ -605,7 +605,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_finetune: type: command - component: azureml:text_generation_finetune:0.0.67 + component: azureml:text_generation_finetune:0.0.68 compute: '${{parent.inputs.compute_finetune}}' distribution: type: pytorch @@ -667,7 +667,7 @@ jobs: pytorch_model_folder: '${{parent.outputs.pytorch_model_folder}}' ft_nlp_model_converter: type: command - component: azureml:ft_nlp_model_converter:0.0.67 + component: azureml:ft_nlp_model_converter:0.0.68 compute: '${{parent.inputs.compute_finetune}}' resources: instance_type: '${{parent.inputs.instance_type_finetune}}' diff --git a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_premium_high/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_premium_high/spec.yaml index 9aaad747de..3a8732d480 100644 --- a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_premium_high/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_premium_high/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/pipelineComponent.schema.json name: text_generation_pipeline_singularity_premium_high -version: 0.0.68 +version: 0.0.69 type: pipeline display_name: Text Generation Pipeline Singularity Premium High description: Pipeline component for text generation @@ -520,7 +520,7 @@ outputs: jobs: ft_nlp_common_validation: type: command - component: azureml:ft_nlp_common_validation:0.0.67 + component: azureml:ft_nlp_common_validation:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -563,7 +563,7 @@ jobs: auto_find_batch_size: '${{parent.inputs.auto_find_batch_size}}' text_generation_model_import: type: command - component: azureml:text_generation_model_import:0.0.67 + component: azureml:text_generation_model_import:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -580,7 +580,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_datapreprocess: type: command - component: azureml:text_generation_datapreprocess:0.0.67 + component: azureml:text_generation_datapreprocess:0.0.68 compute: '${{parent.inputs.compute_preprocess}}' resources: instance_type: '${{parent.inputs.instance_type_preprocess}}' @@ -605,7 +605,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_finetune: type: command - component: azureml:text_generation_finetune:0.0.67 + component: azureml:text_generation_finetune:0.0.68 compute: '${{parent.inputs.compute_finetune}}' distribution: type: pytorch @@ -667,7 +667,7 @@ jobs: pytorch_model_folder: '${{parent.outputs.pytorch_model_folder}}' ft_nlp_model_converter: type: command - component: azureml:ft_nlp_model_converter:0.0.67 + component: azureml:ft_nlp_model_converter:0.0.68 compute: '${{parent.inputs.compute_finetune}}' resources: instance_type: '${{parent.inputs.instance_type_finetune}}' diff --git a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_premium_low/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_premium_low/spec.yaml index a1ec8fdf9d..04b4d36467 100644 --- a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_premium_low/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_premium_low/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/pipelineComponent.schema.json name: text_generation_pipeline_singularity_premium_low -version: 0.0.68 +version: 0.0.69 type: pipeline display_name: Text Generation Pipeline Singularity Premium Low description: Pipeline component for text generation @@ -520,7 +520,7 @@ outputs: jobs: ft_nlp_common_validation: type: command - component: azureml:ft_nlp_common_validation:0.0.67 + component: azureml:ft_nlp_common_validation:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -563,7 +563,7 @@ jobs: auto_find_batch_size: '${{parent.inputs.auto_find_batch_size}}' text_generation_model_import: type: command - component: azureml:text_generation_model_import:0.0.67 + component: azureml:text_generation_model_import:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -580,7 +580,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_datapreprocess: type: command - component: azureml:text_generation_datapreprocess:0.0.67 + component: azureml:text_generation_datapreprocess:0.0.68 compute: '${{parent.inputs.compute_preprocess}}' resources: instance_type: '${{parent.inputs.instance_type_preprocess}}' @@ -605,7 +605,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_finetune: type: command - component: azureml:text_generation_finetune:0.0.67 + component: azureml:text_generation_finetune:0.0.68 compute: '${{parent.inputs.compute_finetune}}' distribution: type: pytorch @@ -667,7 +667,7 @@ jobs: pytorch_model_folder: '${{parent.outputs.pytorch_model_folder}}' ft_nlp_model_converter: type: command - component: azureml:ft_nlp_model_converter:0.0.67 + component: azureml:ft_nlp_model_converter:0.0.68 compute: '${{parent.inputs.compute_finetune}}' resources: instance_type: '${{parent.inputs.instance_type_finetune}}' diff --git a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_premium_medium/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_premium_medium/spec.yaml index 761454b49f..43d9e9184c 100644 --- a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_premium_medium/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_premium_medium/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/pipelineComponent.schema.json name: text_generation_pipeline_singularity_premium_medium -version: 0.0.68 +version: 0.0.69 type: pipeline display_name: Text Generation Pipeline Singularity Premium Medium description: Pipeline component for text generation @@ -520,7 +520,7 @@ outputs: jobs: ft_nlp_common_validation: type: command - component: azureml:ft_nlp_common_validation:0.0.67 + component: azureml:ft_nlp_common_validation:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -563,7 +563,7 @@ jobs: auto_find_batch_size: '${{parent.inputs.auto_find_batch_size}}' text_generation_model_import: type: command - component: azureml:text_generation_model_import:0.0.67 + component: azureml:text_generation_model_import:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -580,7 +580,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_datapreprocess: type: command - component: azureml:text_generation_datapreprocess:0.0.67 + component: azureml:text_generation_datapreprocess:0.0.68 compute: '${{parent.inputs.compute_preprocess}}' resources: instance_type: '${{parent.inputs.instance_type_preprocess}}' @@ -605,7 +605,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_finetune: type: command - component: azureml:text_generation_finetune:0.0.67 + component: azureml:text_generation_finetune:0.0.68 compute: '${{parent.inputs.compute_finetune}}' distribution: type: pytorch @@ -667,7 +667,7 @@ jobs: pytorch_model_folder: '${{parent.outputs.pytorch_model_folder}}' ft_nlp_model_converter: type: command - component: azureml:ft_nlp_model_converter:0.0.67 + component: azureml:ft_nlp_model_converter:0.0.68 compute: '${{parent.inputs.compute_finetune}}' resources: instance_type: '${{parent.inputs.instance_type_finetune}}' diff --git a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_standard_high/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_standard_high/spec.yaml index 9d1fc3c0c7..70f54e3490 100644 --- a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_standard_high/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_standard_high/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/pipelineComponent.schema.json name: text_generation_pipeline_singularity_standard_high -version: 0.0.68 +version: 0.0.69 type: pipeline display_name: Text Generation Pipeline Singularity Standard High description: Pipeline component for text generation @@ -520,7 +520,7 @@ outputs: jobs: ft_nlp_common_validation: type: command - component: azureml:ft_nlp_common_validation:0.0.67 + component: azureml:ft_nlp_common_validation:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -563,7 +563,7 @@ jobs: auto_find_batch_size: '${{parent.inputs.auto_find_batch_size}}' text_generation_model_import: type: command - component: azureml:text_generation_model_import:0.0.67 + component: azureml:text_generation_model_import:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -580,7 +580,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_datapreprocess: type: command - component: azureml:text_generation_datapreprocess:0.0.67 + component: azureml:text_generation_datapreprocess:0.0.68 compute: '${{parent.inputs.compute_preprocess}}' resources: instance_type: '${{parent.inputs.instance_type_preprocess}}' @@ -605,7 +605,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_finetune: type: command - component: azureml:text_generation_finetune:0.0.67 + component: azureml:text_generation_finetune:0.0.68 compute: '${{parent.inputs.compute_finetune}}' distribution: type: pytorch @@ -667,7 +667,7 @@ jobs: pytorch_model_folder: '${{parent.outputs.pytorch_model_folder}}' ft_nlp_model_converter: type: command - component: azureml:ft_nlp_model_converter:0.0.67 + component: azureml:ft_nlp_model_converter:0.0.68 compute: '${{parent.inputs.compute_finetune}}' resources: instance_type: '${{parent.inputs.instance_type_finetune}}' diff --git a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_standard_low/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_standard_low/spec.yaml index 77ab07def5..a3c75ee734 100644 --- a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_standard_low/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_standard_low/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/pipelineComponent.schema.json name: text_generation_pipeline_singularity_standard_low -version: 0.0.68 +version: 0.0.69 type: pipeline display_name: Text Generation Pipeline Singularity Standard Low description: Pipeline component for text generation @@ -520,7 +520,7 @@ outputs: jobs: ft_nlp_common_validation: type: command - component: azureml:ft_nlp_common_validation:0.0.67 + component: azureml:ft_nlp_common_validation:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -563,7 +563,7 @@ jobs: auto_find_batch_size: '${{parent.inputs.auto_find_batch_size}}' text_generation_model_import: type: command - component: azureml:text_generation_model_import:0.0.67 + component: azureml:text_generation_model_import:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -580,7 +580,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_datapreprocess: type: command - component: azureml:text_generation_datapreprocess:0.0.67 + component: azureml:text_generation_datapreprocess:0.0.68 compute: '${{parent.inputs.compute_preprocess}}' resources: instance_type: '${{parent.inputs.instance_type_preprocess}}' @@ -605,7 +605,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_finetune: type: command - component: azureml:text_generation_finetune:0.0.67 + component: azureml:text_generation_finetune:0.0.68 compute: '${{parent.inputs.compute_finetune}}' distribution: type: pytorch @@ -667,7 +667,7 @@ jobs: pytorch_model_folder: '${{parent.outputs.pytorch_model_folder}}' ft_nlp_model_converter: type: command - component: azureml:ft_nlp_model_converter:0.0.67 + component: azureml:ft_nlp_model_converter:0.0.68 compute: '${{parent.inputs.compute_finetune}}' resources: instance_type: '${{parent.inputs.instance_type_finetune}}' diff --git a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_standard_medium/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_standard_medium/spec.yaml index 1f1244dcd7..69d004866f 100644 --- a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_standard_medium/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/text_generation_singularity_standard_medium/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/pipelineComponent.schema.json name: text_generation_pipeline_singularity_standard_medium -version: 0.0.68 +version: 0.0.69 type: pipeline display_name: Text Generation Pipeline Singularity Standard Medium description: Pipeline component for text generation @@ -520,7 +520,7 @@ outputs: jobs: ft_nlp_common_validation: type: command - component: azureml:ft_nlp_common_validation:0.0.67 + component: azureml:ft_nlp_common_validation:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -563,7 +563,7 @@ jobs: auto_find_batch_size: '${{parent.inputs.auto_find_batch_size}}' text_generation_model_import: type: command - component: azureml:text_generation_model_import:0.0.67 + component: azureml:text_generation_model_import:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -580,7 +580,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_datapreprocess: type: command - component: azureml:text_generation_datapreprocess:0.0.67 + component: azureml:text_generation_datapreprocess:0.0.68 compute: '${{parent.inputs.compute_preprocess}}' resources: instance_type: '${{parent.inputs.instance_type_preprocess}}' @@ -605,7 +605,7 @@ jobs: system_properties: '${{parent.inputs.system_properties}}' text_generation_finetune: type: command - component: azureml:text_generation_finetune:0.0.67 + component: azureml:text_generation_finetune:0.0.68 compute: '${{parent.inputs.compute_finetune}}' distribution: type: pytorch @@ -667,7 +667,7 @@ jobs: pytorch_model_folder: '${{parent.outputs.pytorch_model_folder}}' ft_nlp_model_converter: type: command - component: azureml:ft_nlp_model_converter:0.0.67 + component: azureml:ft_nlp_model_converter:0.0.68 compute: '${{parent.inputs.compute_finetune}}' resources: instance_type: '${{parent.inputs.instance_type_finetune}}' diff --git a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/token_classification/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/token_classification/spec.yaml index 8adda93279..ba9b47fc01 100644 --- a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/token_classification/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/token_classification/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/pipelineComponent.schema.json name: token_classification_pipeline -version: 0.0.68 +version: 0.0.69 type: pipeline display_name: Token Classification Pipeline description: Pipeline component to finetune Hugging Face pretrained models for token classification task. The component supports optimizations such as LoRA, Deepspeed and ONNXRuntime for performance enhancement. See [docs](https://aka.ms/azureml/components/token_classification_pipeline) to learn more. @@ -507,7 +507,7 @@ outputs: jobs: ft_nlp_common_validation: type: command - component: azureml:ft_nlp_common_validation:0.0.67 + component: azureml:ft_nlp_common_validation:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -544,7 +544,7 @@ jobs: auto_find_batch_size: '${{parent.inputs.auto_find_batch_size}}' token_classification_model_import: type: command - component: azureml:token_classification_model_import:0.0.67 + component: azureml:token_classification_model_import:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -555,7 +555,7 @@ jobs: validation_output: '${{parent.jobs.ft_nlp_common_validation.outputs.validation_info}}' token_classification_datapreprocess: type: command - component: azureml:token_classification_datapreprocess:0.0.67 + component: azureml:token_classification_datapreprocess:0.0.68 compute: '${{parent.inputs.compute_preprocess}}' resources: instance_type: '${{parent.inputs.instance_type_preprocess}}' @@ -574,7 +574,7 @@ jobs: model_selector_output: '${{parent.jobs.token_classification_model_import.outputs.output_dir}}' token_classification_finetune: type: command - component: azureml:token_classification_finetune:0.0.67 + component: azureml:token_classification_finetune:0.0.68 compute: '${{parent.inputs.compute_finetune}}' distribution: type: pytorch @@ -631,7 +631,7 @@ jobs: pytorch_model_folder: '${{parent.outputs.pytorch_model_folder}}' ft_nlp_model_converter: type: command - component: azureml:ft_nlp_model_converter:0.0.67 + component: azureml:ft_nlp_model_converter:0.0.68 compute: '${{parent.inputs.compute_finetune}}' resources: instance_type: '${{parent.inputs.instance_type_finetune}}' diff --git a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/translation/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/translation/spec.yaml index 80cbfc57dd..eaebdd51c2 100644 --- a/assets/training/finetune_acft_hf_nlp/components/pipeline_components/translation/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/pipeline_components/translation/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/pipelineComponent.schema.json name: translation_pipeline -version: 0.0.68 +version: 0.0.69 type: pipeline display_name: Translation Pipeline description: Pipeline component to finetune Hugging Face pretrained models for translation task. The component supports optimizations such as LoRA, Deepspeed and ONNXRuntime for performance enhancement. See [docs](https://aka.ms/azureml/components/translation_pipeline) to learn more. @@ -504,7 +504,7 @@ outputs: jobs: ft_nlp_common_validation: type: command - component: azureml:ft_nlp_common_validation:0.0.67 + component: azureml:ft_nlp_common_validation:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -541,7 +541,7 @@ jobs: auto_find_batch_size: '${{parent.inputs.auto_find_batch_size}}' translation_model_import: type: command - component: azureml:translation_model_import:0.0.67 + component: azureml:translation_model_import:0.0.68 compute: '${{parent.inputs.compute_model_import}}' resources: instance_type: '${{parent.inputs.instance_type_model_import}}' @@ -552,7 +552,7 @@ jobs: validation_output: '${{parent.jobs.ft_nlp_common_validation.outputs.validation_info}}' translation_datapreprocess: type: command - component: azureml:translation_datapreprocess:0.0.67 + component: azureml:translation_datapreprocess:0.0.68 compute: '${{parent.inputs.compute_preprocess}}' resources: instance_type: '${{parent.inputs.instance_type_preprocess}}' @@ -571,7 +571,7 @@ jobs: model_selector_output: '${{parent.jobs.translation_model_import.outputs.output_dir}}' translation_finetune: type: command - component: azureml:translation_finetune:0.0.67 + component: azureml:translation_finetune:0.0.68 compute: '${{parent.inputs.compute_finetune}}' distribution: type: pytorch @@ -628,7 +628,7 @@ jobs: pytorch_model_folder: '${{parent.outputs.pytorch_model_folder}}' ft_nlp_model_converter: type: command - component: azureml:ft_nlp_model_converter:0.0.67 + component: azureml:ft_nlp_model_converter:0.0.68 compute: '${{parent.inputs.compute_finetune}}' resources: instance_type: '${{parent.inputs.instance_type_finetune}}' diff --git a/assets/training/finetune_acft_hf_nlp/components/preprocess/chat_completion/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/preprocess/chat_completion/spec.yaml index 05bd2d9ecd..6d94f38b6c 100644 --- a/assets/training/finetune_acft_hf_nlp/components/preprocess/chat_completion/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/preprocess/chat_completion/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: chat_completion_datapreprocess -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/preprocess/question_answering/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/preprocess/question_answering/spec.yaml index 2f8cfadda6..9a5038b4f9 100644 --- a/assets/training/finetune_acft_hf_nlp/components/preprocess/question_answering/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/preprocess/question_answering/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: question_answering_datapreprocess -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/preprocess/summarization/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/preprocess/summarization/spec.yaml index ddd77a7638..2cfb544a49 100644 --- a/assets/training/finetune_acft_hf_nlp/components/preprocess/summarization/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/preprocess/summarization/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: summarization_datapreprocess -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/preprocess/text_classification/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/preprocess/text_classification/spec.yaml index 9d3bda9104..e32ab5c9a1 100644 --- a/assets/training/finetune_acft_hf_nlp/components/preprocess/text_classification/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/preprocess/text_classification/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: text_classification_datapreprocess -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/preprocess/text_generation/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/preprocess/text_generation/spec.yaml index 580c4f5f35..d26e1100a3 100644 --- a/assets/training/finetune_acft_hf_nlp/components/preprocess/text_generation/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/preprocess/text_generation/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: text_generation_datapreprocess -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/preprocess/token_classification/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/preprocess/token_classification/spec.yaml index cfcd715e79..532b3ce283 100644 --- a/assets/training/finetune_acft_hf_nlp/components/preprocess/token_classification/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/preprocess/token_classification/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: token_classification_datapreprocess -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/preprocess/translation/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/preprocess/translation/spec.yaml index 9d4d2b17d6..90b1e64a44 100644 --- a/assets/training/finetune_acft_hf_nlp/components/preprocess/translation/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/preprocess/translation/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: translation_datapreprocess -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components/validation/common/spec.yaml b/assets/training/finetune_acft_hf_nlp/components/validation/common/spec.yaml index ead7371ab9..b8d631dc14 100644 --- a/assets/training/finetune_acft_hf_nlp/components/validation/common/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components/validation/common/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: ft_nlp_common_validation -version: 0.0.67 +version: 0.0.68 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/environments/data_import/context/Dockerfile b/assets/training/finetune_acft_hf_nlp/environments/data_import/context/Dockerfile index 6ebc9c8384..3f81fc7bce 100644 --- a/assets/training/finetune_acft_hf_nlp/environments/data_import/context/Dockerfile +++ b/assets/training/finetune_acft_hf_nlp/environments/data_import/context/Dockerfile @@ -14,5 +14,5 @@ RUN pip install -r requirements.txt --no-cache-dir # temp fix for vulnerabilties, remove after pypi release RUN pip install scikit-learn==1.5.1 -# The below file is required for baking the code into the environment +# The below file is required for baking the code into the environment COPY data_import_run.py /azureml/data_import/run.py diff --git a/assets/training/finetune_acft_image/environments/acpt_image_framework_selector/context/Dockerfile b/assets/training/finetune_acft_image/environments/acpt_image_framework_selector/context/Dockerfile index 3d283f40a8..40dabf3e86 100644 --- a/assets/training/finetune_acft_image/environments/acpt_image_framework_selector/context/Dockerfile +++ b/assets/training/finetune_acft_image/environments/acpt_image_framework_selector/context/Dockerfile @@ -14,4 +14,4 @@ ENV AZURE_ML_CLI_PRIVATE_FEATURES_ENABLED=True RUN pip install gunicorn==22.0.0 RUN pip install certifi==2024.07.04 RUN pip install onnx==1.17.0 -# dummy number to change when needing to force rebuild without changing the definition: 1 \ No newline at end of file +# dummy number to change when needing to force rebuild without changing the definition: 2 \ No newline at end of file diff --git a/assets/training/finetune_acft_image/environments/acpt_image_framework_selector/context/requirements.txt b/assets/training/finetune_acft_image/environments/acpt_image_framework_selector/context/requirements.txt index 19218e7e2c..6a5f7ad962 100644 --- a/assets/training/finetune_acft_image/environments/acpt_image_framework_selector/context/requirements.txt +++ b/assets/training/finetune_acft_image/environments/acpt_image_framework_selector/context/requirements.txt @@ -6,6 +6,4 @@ azureml-mlflow azureml-core requests setuptools>=71.1.0 -Werkzeug==3.1.3 -https://azuremlsdktestpypi.blob.core.windows.net/wheels/AzureML-Nebula-py-feed/dev-nebulaml-package/nebulaml-0.1.0.dev2624-20241226.3-py3-none-any.whl -https://azuremlsdktestpypi.blob.core.windows.net/wheels/AzureML-Nebula-py-feed/dev-package/torch_nebula-0.1.0.dev2624-20241226.3-py3-none-any.whl \ No newline at end of file +Werkzeug==3.1.3 \ No newline at end of file diff --git a/assets/training/model_management/environments/model-management/context/Dockerfile b/assets/training/model_management/environments/model-management/context/Dockerfile index 605ad3f010..8571092dc7 100644 --- a/assets/training/model_management/environments/model-management/context/Dockerfile +++ b/assets/training/model_management/environments/model-management/context/Dockerfile @@ -22,16 +22,12 @@ COPY requirements.txt . # Going forward azureml-automl-dnn-vision needs to update version for torch and numpy RUN conda install python=3.9 -y -RUN conda remove jinja2 -y - -RUN conda install -c conda-forge jinja2=3.1.5 -y - RUN pip install -r requirements.txt --no-cache-dir # Vulnerability fix RUN pip install Pillow gunicorn onnx==1.17.0 idna tqdm requests==2.32.1 tornado==6.4.2 certifi==2024.07.04 urllib3==1.26.19 scikit-learn==1.5.1 mlflow==2.19 mlflow-skinny==2.19 marshmallow==3.23.2 -# List installed packages +# List pip packages RUN pip list ## Delete