diff --git a/assets/aml-benchmark/components/batch_benchmark_config_generator/spec.yaml b/assets/aml-benchmark/components/batch_benchmark_config_generator/spec.yaml index a38b89f374..ce67f1e31c 100644 --- a/assets/aml-benchmark/components/batch_benchmark_config_generator/spec.yaml +++ b/assets/aml-benchmark/components/batch_benchmark_config_generator/spec.yaml @@ -4,7 +4,7 @@ type: command name: batch_benchmark_config_generator display_name: Batch Benchmark Config Generator description: Generates the config for the batch score component. -version: 0.0.6 +version: 0.0.7 is_deterministic: true inputs: diff --git a/assets/evaluation_on_cloud/environments/evaluations-built-in/asset.yaml b/assets/evaluation_on_cloud/environments/evaluations-built-in/asset.yaml new file mode 100644 index 0000000000..93e930eddc --- /dev/null +++ b/assets/evaluation_on_cloud/environments/evaluations-built-in/asset.yaml @@ -0,0 +1,6 @@ +name: evaluations-built-in +version: auto +type: environment +spec: spec.yaml +extra_config: environment.yaml +categories: ["Evaluation"] diff --git a/assets/evaluation_on_cloud/environments/evaluations-built-in/context/Dockerfile b/assets/evaluation_on_cloud/environments/evaluations-built-in/context/Dockerfile new file mode 100644 index 0000000000..c881b87906 --- /dev/null +++ b/assets/evaluation_on_cloud/environments/evaluations-built-in/context/Dockerfile @@ -0,0 +1,8 @@ +FROM mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu22.04:latest + +COPY requirements.txt /app/requirements.txt +RUN pip install -r /app/requirements.txt + +# Copy your Python file into the image +COPY evaluate_on_data.py /app/evaluate_on_data.py +COPY save_evaluation.py /app/save_evaluation.py \ No newline at end of file diff --git a/assets/evaluation_on_cloud/environments/evaluations-built-in/context/evaluate_on_data.py b/assets/evaluation_on_cloud/environments/evaluations-built-in/context/evaluate_on_data.py new file mode 100644 index 0000000000..c9d36ae737 --- /dev/null +++ b/assets/evaluation_on_cloud/environments/evaluations-built-in/context/evaluate_on_data.py @@ -0,0 +1,124 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +"""Evaluate for a built-in or custom evulator.""" +import argparse +import json +import logging +import mlflow +import os +import pandas as pd +import requests +import shutil +from azure.ai.ml.identity import AzureMLOnBehalfOfCredential +from azure.ai.evaluation import evaluate +from save_eval import load_evaluator + +logger = logging.getLogger(__name__) + + +def update_value_in_dict(d, key_substring, new_func): + """Recursively search for a value containing 'key_substring' and apply 'new_func' to modify it.""" + for key, value in d.items(): + if isinstance(value, dict): + update_value_in_dict(value, key_substring, new_func) + elif isinstance(value, str) and key_substring in value: + d[key] = new_func(value) + + +def find_file_and_get_parent_dir(root_dir, file_name="flow.flex.yaml"): + """Find the flex flow or any given file in a directory and return the parent directory.""" + for dirpath, _, filenames in os.walk(root_dir): + if file_name in filenames: + logger.info(f"Found {file_name} in {dirpath}") + return dirpath + + +def copy_evaluator_files(command_line_args): + """Copy the mounted evaluator files to the relative paths to enable read/write.""" + evaluator_name_id_map = json.loads(command_line_args.evaluator_name_id_map) + for evaluator_name, evaluator_id in evaluator_name_id_map.items(): + dir_path = find_file_and_get_parent_dir(evaluator_id) + if dir_path: + shutil.copytree(dir_path, f"./{evaluator_name}") + logger.info(f"Copying {dir_path} to ./{evaluator_name}") + logger.info(evaluator_name, os.listdir(f"./{evaluator_name}")) + else: + logger.info(f"Directory for evaluator {evaluator_name} not found.") + + +def initialize_evaluators(command_line_args): + """Initialize the evaluators using correct parameters and credentials for rai evaluators.""" + evaluators = {} + evaluators_o = json.loads(command_line_args.evaluators) + for evaluator_name, evaluator in evaluators_o.items(): + init_params = evaluator["InitParams"] + update_value_in_dict(init_params, "AZURE_OPENAI_API_KEY", lambda x: os.environ[x.upper()]) + flow = load_evaluator('./' + evaluator_name) + if any(rai_eval in evaluator["Id"] for rai_eval in rai_evaluators): + init_params["credential"] = AzureMLOnBehalfOfCredential() + evaluators[evaluator_name] = flow(**init_params) + return evaluators + + +def run_evaluation(command_line_args, evaluators): + """Run evaluation using evaluators.""" + results = evaluate( + data=command_line_args.eval_data, + evaluators=evaluators + ) + metrics = {} + for metric_name, metric_value in results['metrics'].items(): + logger.info("Logging metric:", metric_name, metric_value) + metrics[metric_name] = metric_value + mlflow.log_metrics(metrics) + + if results and results.get("rows"): + # Convert the results to a DataFrame + df = pd.DataFrame(results["rows"]) + + # Save the DataFrame as a JSONL file + df.to_json("instance_results.jsonl", orient="records", lines=True) + df.to_json("eval_results.jsonl", orient="records", lines=True) + mlflow.log_artifact("instance_results.jsonl") + mlflow.log_artifact("eval_results.jsonl") + + +def get_promptflow_run_logs(): + """Get promptflow run logs.""" + if os.path.exists("/root/.promptflow/.runs/"): + runs = os.listdir("/root/.promptflow/.runs/") + for run in runs: + if os.path.exists(f"/root/.promptflow/.runs/{run}/logs.txt"): + with open(f"/root/.promptflow/.runs/{run}/logs.txt", "r") as f: + logger.info(f"RUN {run} =========================") + logger.info(f.read()) + else: + logger.info("RUN DOES NOT EXIST") + + +# Create a session for making HTTP requests +session = requests.Session() + +# Parse command line arguments and debug to ensure working +parser = argparse.ArgumentParser("eval") +parser.add_argument("--eval_data", type=str) +parser.add_argument("--eval_output", type=str) +parser.add_argument("--evaluators", type=str) +parser.add_argument("--evaluator_name_id_map", type=str) + +args = parser.parse_args() +rai_evaluators = ['HateUnfairnessEvaluator', 'Sexual-Content-Evaluator', 'Hate-and-Unfairness-Evaluator', + 'Violent-Content-Evaluator', 'Self-Harm-Related-Content-Evaluator'] + +if __name__ == '__main__': + copy_evaluator_files(args) + evaluators = initialize_evaluators(args) + logger.info("*************** Collecting Result of Evaluators ******************") + # Run the evaluation + with mlflow.start_run() as run: + try: + run_evaluation(args, evaluators) + except Exception as e: + logger.error("EXCEPT", e) + get_promptflow_run_logs() diff --git a/assets/evaluation_on_cloud/environments/evaluations-built-in/context/requirements.txt b/assets/evaluation_on_cloud/environments/evaluations-built-in/context/requirements.txt new file mode 100644 index 0000000000..6e0b2786f2 --- /dev/null +++ b/assets/evaluation_on_cloud/environments/evaluations-built-in/context/requirements.txt @@ -0,0 +1,5 @@ +azure-ai-evaluation +openai +azureml-mlflow +azure-identity +azure-ai-ml \ No newline at end of file diff --git a/assets/evaluation_on_cloud/environments/evaluations-built-in/context/save_evaluation.py b/assets/evaluation_on_cloud/environments/evaluations-built-in/context/save_evaluation.py new file mode 100644 index 0000000000..ddf8675c44 --- /dev/null +++ b/assets/evaluation_on_cloud/environments/evaluations-built-in/context/save_evaluation.py @@ -0,0 +1,30 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +"""Load a built-in or custom evulator as flow.""" +import importlib +import logging +import os +import sys +from promptflow.client import load_flow + +logger = logging.getLogger(__name__) + + +def load_evaluator(evaluator): + """Load evaluator as flow.""" + logger.info(f"Loading evaluator {evaluator}") + loaded_evaluator = load_flow(evaluator) + logger.info(loaded_evaluator) + module_parent = loaded_evaluator.path.parent.name + module_name = loaded_evaluator.entry.split(":")[0] + logger.info(f"Loading module {os.getcwd()} {module_name} from {module_parent}") + module_path = os.path.join(os.getcwd(), module_parent, module_name + ".py") + logger.info(f"Loading module {module_name} from {module_path}") + spec = importlib.util.spec_from_file_location(module_name, module_path) + mod = importlib.util.module_from_spec(spec) + logger.info(f"Loaded module {mod}") + sys.modules[module_name] = mod + spec.loader.exec_module(mod) + eval_class = getattr(mod, loaded_evaluator.entry.split(":")[1]) + return eval_class diff --git a/assets/evaluation_on_cloud/environments/evaluations-built-in/environment.yaml b/assets/evaluation_on_cloud/environments/evaluations-built-in/environment.yaml new file mode 100644 index 0000000000..e995657493 --- /dev/null +++ b/assets/evaluation_on_cloud/environments/evaluations-built-in/environment.yaml @@ -0,0 +1,11 @@ +image: + name: azureml/curated/evaluations-built-in + os: linux + context: + dir: context + dockerfile: Dockerfile + template_files: + - Dockerfile + publish: + location: mcr + visibility: public \ No newline at end of file diff --git a/assets/evaluation_on_cloud/environments/evaluations-built-in/spec.yaml b/assets/evaluation_on_cloud/environments/evaluations-built-in/spec.yaml new file mode 100644 index 0000000000..1a135ac6d0 --- /dev/null +++ b/assets/evaluation_on_cloud/environments/evaluations-built-in/spec.yaml @@ -0,0 +1,11 @@ +$schema: https://azuremlschemas.azureedge.net/latest/environment.schema.json +description: Python environment for running promptflow-evals based evaluators. + +name: "{{asset.name}}" +version: "{{asset.version}}" + +os_type: linux + +build: + path: "{{image.context.path}}" + dockerfile_path: "{{image.dockerfile.path}}" diff --git a/assets/large_language_models/rag/environments/rag/context/conda_dependencies.yaml b/assets/large_language_models/rag/environments/rag/context/conda_dependencies.yaml index 4b9ea813f2..aebbf3210e 100644 --- a/assets/large_language_models/rag/environments/rag/context/conda_dependencies.yaml +++ b/assets/large_language_models/rag/environments/rag/context/conda_dependencies.yaml @@ -8,7 +8,7 @@ dependencies: - scikit-learn - pip: # RAG package - - azureml-rag[azure,cognitive_search,data_generation,pinecone,milvus,azure_cosmos_mongo_vcore,azure_cosmos_nosql]==0.2.36 + - azureml-rag[azure,langchain,cognitive_search,data_generation,pinecone,milvus,azure_cosmos_mongo_vcore,azure_cosmos_nosql]==0.2.36 # Azure - azure-ai-formrecognizer==3.3.1 - azure-identity=={{latest-pypi-version}} @@ -29,7 +29,6 @@ dependencies: - datasets~=2.10.1 - faiss-cpu~=1.7.3 - inference-schema>=1.8.0 - - langchain<0.3 - lxml - markdown - mlflow-skinny==2.3.2 diff --git a/assets/large_language_models/rag/environments/rag_embeddings/context/conda_dependencies.yaml b/assets/large_language_models/rag/environments/rag_embeddings/context/conda_dependencies.yaml index b3112331b7..706beebd25 100644 --- a/assets/large_language_models/rag/environments/rag_embeddings/context/conda_dependencies.yaml +++ b/assets/large_language_models/rag/environments/rag_embeddings/context/conda_dependencies.yaml @@ -7,7 +7,7 @@ dependencies: - pip=24.0 - pip: # RAG package - - azureml-rag[azure,faiss,cognitive_search,document_parsing,data_generation,pinecone,milvus,azure_cosmos_mongo_vcore,azure_cosmos_nosql]==0.2.36 + - azureml-rag[azure,faiss,langchain,cognitive_search,document_parsing,data_generation,pinecone,milvus,azure_cosmos_mongo_vcore,azure_cosmos_nosql]==0.2.36 # Azure AI - azure-ai-formrecognizer==3.3.1 # Azure @@ -30,7 +30,6 @@ dependencies: - faiss-cpu~=1.7.3 - GitPython>=3.1 - inference-schema>=1.8.0 - - langchain<0.3 - lxml - markdown - mlflow>=2.6.0 diff --git a/assets/models/system/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224/asset.yaml b/assets/models/system/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224/asset.yaml new file mode 100644 index 0000000000..fcf5c5a05b --- /dev/null +++ b/assets/models/system/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224/asset.yaml @@ -0,0 +1,4 @@ +extra_config: model.yaml +spec: spec.yaml +type: model +categories: ["Foundation Models"] diff --git a/assets/models/system/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224/description.md b/assets/models/system/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224/description.md new file mode 100644 index 0000000000..522272f304 --- /dev/null +++ b/assets/models/system/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224/description.md @@ -0,0 +1,71 @@ +BiomedCLIP is a biomedical vision-language foundation model that is pretrained on PMC-15M, a dataset of 15 million figure-caption pairs extracted from biomedical research articles in PubMed Central, using contrastive learning. It uses PubMedBERT as the text encoder and Vision Transformer as the image encoder, with domain-specific adaptations. It can perform various vision-language processing (VLP) tasks such as cross-modal retrieval, image classification, and visual question answering. BiomedCLIP establishes new state of the art in a wide range of standard datasets, and substantially outperforms prior VLP approaches: + +![performance](https://huggingface.co/microsoft/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224/resolve/main/biomed-vlp-eval.svg) + +**Citation** + +``` +@misc{https://doi.org/10.48550/arXiv.2303.00915, + doi = {10.48550/ARXIV.2303.00915}, + url = {https://arxiv.org/abs/2303.00915}, + author = {Zhang, Sheng and Xu, Yanbo and Usuyama, Naoto and Bagga, Jaspreet and Tinn, Robert and Preston, Sam and Rao, Rajesh and Wei, Mu and Valluri, Naveen and Wong, Cliff and Lungren, Matthew and Naumann, Tristan and Poon, Hoifung}, + title = {Large-Scale Domain-Specific Pretraining for Biomedical Vision-Language Processing}, + publisher = {arXiv}, + year = {2023}, +} + +``` + +## Model Use + +**Intended Use** +This model is intended to be used solely for (I) future research on visual-language processing and (II) reproducibility of the experimental results reported in the reference paper. + +**Primary Intended Use** +The primary intended use is to support AI researchers building on top of this work. BiomedCLIP and its associated models should be helpful for exploring various biomedical VLP research questions, especially in the radiology domain. + +**Out-of-Scope Use** +Any deployed use case of the model --- commercial or otherwise --- is currently out of scope. Although we evaluated the models using a broad set of publicly-available research benchmarks, the models and evaluations are not intended for deployed use cases. Please refer to the associated paper for more details. + +**Data** +This model builds upon PMC-15M dataset, which is a large-scale parallel image-text dataset for biomedical vision-language processing. It contains 15 million figure-caption pairs extracted from biomedical research articles in PubMed Central. It covers a diverse range of biomedical image types, such as microscopy, radiography, histology, and more. + +**Limitations** +This model was developed using English corpora, and thus can be considered English-only. + +**Further information** +Please refer to the corresponding paper, "Large-Scale Domain-Specific Pretraining for Biomedical Vision-Language Processing" for additional details on the model training and evaluation. + +## Sample Input and Output (for real-time inference) + +### Sample Input + +```json +{ + "input_data": { + "columns": [ + "image", + "text" + ], + "index":[0, 1, 2], + "data": [ + ["image1", "labe1, label2, label3"], + ["image2", "labe1, label2, label3"], + ["image3", "labe1, label2, label3"], + ] + } +} +``` +### Sample Output +```json +[ + { + "probs": [0.95, 0.03, 0.02], + "labels": ["label1", "label2", "label3"] + }, + { + "probs": [0.04, 0.93, 0.03], + "labels": ["label1", "label2", "label3"] + } +] +``` \ No newline at end of file diff --git a/assets/models/system/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224/model.yaml b/assets/models/system/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224/model.yaml new file mode 100644 index 0000000000..01fd42f578 --- /dev/null +++ b/assets/models/system/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224/model.yaml @@ -0,0 +1,8 @@ +path: + container_name: models + container_path: huggingface/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224/mlflow_model_folder + storage_name: automlcesdkdataresources + type: azureblob +publish: + description: description.md + type: mlflow_model diff --git a/assets/models/system/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224/spec.yaml b/assets/models/system/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224/spec.yaml new file mode 100644 index 0000000000..0d0ce199b4 --- /dev/null +++ b/assets/models/system/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224/spec.yaml @@ -0,0 +1,34 @@ +$schema: https://azuremlschemas.azureedge.net/latest/model.schema.json + +name: BiomedCLIP-PubMedBERT_256-vit_base_patch16_224 +path: ./ + +properties: + inference-min-sku-spec: 6|1|112|64 + inference-recommended-sku: Standard_NC6s_v3, Standard_NC12s_v3, Standard_NC24s_v3, Standard_NC24ads_A100_v4, Standard_NC48ads_A100_v4, Standard_NC96ads_A100_v4, Standard_ND96asr_v4, Standard_ND96amsr_A100_v4, Standard_ND40rs_v2 + languages: en + SharedComputeCapacityEnabled: true + +tags: + task: zero-shot-image-classification + industry: health-and-life-sciences + Preview: "" + inference_supported_envs: + - hf + license: mit + author: Microsoft + hiddenlayerscanned: "" + SharedComputeCapacityEnabled: "" + inference_compute_allow_list: + [ + Standard_NC6s_v3, + Standard_NC12s_v3, + Standard_NC24s_v3, + Standard_NC24ads_A100_v4, + Standard_NC48ads_A100_v4, + Standard_NC96ads_A100_v4, + Standard_ND96asr_v4, + Standard_ND96amsr_A100_v4, + Standard_ND40rs_v2, + ] +version: 1 \ No newline at end of file diff --git a/assets/models/system/Virchow/asset.yaml b/assets/models/system/Virchow/asset.yaml new file mode 100644 index 0000000000..fcf5c5a05b --- /dev/null +++ b/assets/models/system/Virchow/asset.yaml @@ -0,0 +1,4 @@ +extra_config: model.yaml +spec: spec.yaml +type: model +categories: ["Foundation Models"] diff --git a/assets/models/system/Virchow/description.md b/assets/models/system/Virchow/description.md new file mode 100644 index 0000000000..c8179cd652 --- /dev/null +++ b/assets/models/system/Virchow/description.md @@ -0,0 +1,113 @@ +Virchow is a self-supervised vision transformer pretrained using 1.5M whole slide histopathology images. The model can be used as a tile-level feature extractor (frozen or finetuned) to achieve state-of-the-art results for a wide variety of downstream computational pathology use cases. + +## Model Details + +**Developed by:** Paige, NYC, USA and Microsoft Research, Cambridge, MA USA +**Model Type:** Image feature backbone +**Model Stats:** + Params (M): 632 + Image size: 224 x 224 + Model Architecture: +**Architecture:** ViT-H/14 + Patch size: 14 + Layers: 32 + Embedding dimension: 1280 + Activation function: SwiGLU + Attention heads: 16 + LayerScale: true +**Training Details:** + Precision: Mixed precision (fp16) + Objective: Modified DINOv2 (https://doi.org/10.48550/arXiv.2304.07193) +**Paper:** + A foundation model for clinical-grade computational pathology and rare cancers detection: https://www.nature.com/articles/s41591-024-03141-0 +**Pretraining Dataset:** Internal dataset of 1.5 million whole slide images from Memorial Sloan Kettering Cancer Center, tiles sampled at 0.5 microns per pixel resolution (20x magnification). +**License:** Apache 2.0 + +## Model Usage + +**Direct use** +Virchow intended to be used as a frozen feature extractor as the foundation for tile-level and whole slide-level classifiers. + +**Downstream use** +Virchow can be finetuned to adapt to specific tasks and/or datasets. + +**Terms** + +The Virchow Model and associated code are released under the Apache License, Version 2.0 (the "License"). You may obtain a copy of the License at: + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +Additional Terms + +Please note that the primary email used to sign up for your Hugging Face account must match your institutional email to receive approval. By downloading the Virchow Model, you attest that all information (affiliation, research use) is correct and up-to-date. Downloading the Virchow Model requires prior registration on Hugging Face and agreeing to the terms of use. + +While the Apache 2.0 License grants broad permissions, we kindly request that users adhere to the following guidelines: + +Attribution: We encourage proper attribution when using or redistributing the Virchow Model or its derivatives. Please include a reference to the original source and creators. + +Responsible Use: Users are expected to use the Virchow Model responsibly and ethically. Please consider the potential impacts of your use on individuals and society. + +Medical or Clinical Use: The Virchow Model is not intended for use in medical diagnosis, treatment, or prevention of disease of real patients. It should not be used as a substitute for professional medical advice. + +Privacy and Data Protection: Users should respect privacy rights and comply with applicable data protection laws when using the Virchow Model. + +No Malicious Use: The Virchow Model should not be used to create malicious code, malware, or to interfere with the proper functioning of computer systems. + +Transparency: If you use the Virchow Model in a product or service, we encourage you to disclose this fact to your end users. + +Feedback and Contributions: We welcome feedback and contributions to improve the Virchow Model. Please consider sharing your improvements with the community. + +These additional terms are not intended to restrict your rights under the Apache 2.0 License but to promote responsible and ethical use of the Virchow Model. + +By using the Virchow Model, you acknowledge that you have read and understood these terms. + +**Citation** + +Please cite the following work if you used this model in your research. + +Vorontsov, E., Bozkurt, A., Casson, A. et al. A foundation model for clinical-grade computational pathology and rare cancers detection. Nat Med (2024). https://doi.org/10.1038/s41591-024-03141-0 + +``` +@article{vorontsov2024virchow, + title={A foundation model for clinical-grade computational pathology and rare cancers detection}, + author={Vorontsov, Eugene and Bozkurt, Alican and Casson, Adam and Shaikovski, George and Zelechowski, Michal and Severson, Kristen and Zimmermann, Eric and Hall, James and Tenenholtz, Neil and Fusi, Nicolo and Yang, Ellen and Mathieu, Philippe and van Eck, Alexander and Lee, Donghun and Viret, Julian and Robert, Eric and Wang, Yi Kan and Kunz, Jeremy D. and Lee, Matthew C. H. and Bernhard, Jan H. and Godrich, Ran A. and Oakley, Gerard and Millar, Ewan and Hanna, Matthew and Wen, Hannah and Retamero, Juan A. and Moye, William A. and Yousfi, Razik and Kanan, Christopher and Klimstra, David S. and Rothrock, Brandon and Liu, Siqi and Fuchs, Thomas J.}, + journal={Nature Medicine}, + year={2024}, + publisher={Nature Publishing Group} +} + +``` + +## Sample Input and Output (for real-time inference) + +### Sample Input + +```json +{ + "input_data": { + "columns": [ + "image" + ], + "index":[0], + "data": [ + ["image1"] + ] + } +} +``` +Note: +- "image1" and "image2" should be publicly accessible urls or strings in base64 format. + +### Sample Output +```json +[ + { + "output": [ + 0.0, 0.0, 0.0, 0.0 + ] + } +] +``` +Output will be image embeddings. \ No newline at end of file diff --git a/assets/models/system/Virchow/model.yaml b/assets/models/system/Virchow/model.yaml new file mode 100644 index 0000000000..41d6c6d666 --- /dev/null +++ b/assets/models/system/Virchow/model.yaml @@ -0,0 +1,8 @@ +path: + container_name: models + container_path: huggingface/Virchow/mlflow_model_folder + storage_name: automlcesdkdataresources + type: azureblob +publish: + description: description.md + type: mlflow_model diff --git a/assets/models/system/Virchow/spec.yaml b/assets/models/system/Virchow/spec.yaml new file mode 100644 index 0000000000..862201e022 --- /dev/null +++ b/assets/models/system/Virchow/spec.yaml @@ -0,0 +1,34 @@ +$schema: https://azuremlschemas.azureedge.net/latest/model.schema.json + +name: Virchow +path: ./ + +properties: + inference-min-sku-spec: 6|1|112|64 + inference-recommended-sku: Standard_NC6s_v3, Standard_NC12s_v3, Standard_NC24s_v3, Standard_NC24ads_A100_v4, Standard_NC48ads_A100_v4, Standard_NC96ads_A100_v4, Standard_ND96asr_v4, Standard_ND96amsr_A100_v4, Standard_ND40rs_v2 + languages: en + SharedComputeCapacityEnabled: true + +tags: + task: image-feature-extraction + industry: health-and-life-sciences + Preview: "" + inference_supported_envs: + - hf + license: apache-2.0 + author: Paige + hiddenlayerscanned: "" + SharedComputeCapacityEnabled: "" + inference_compute_allow_list: + [ + Standard_NC6s_v3, + Standard_NC12s_v3, + Standard_NC24s_v3, + Standard_NC24ads_A100_v4, + Standard_NC48ads_A100_v4, + Standard_NC96ads_A100_v4, + Standard_ND96asr_v4, + Standard_ND96amsr_A100_v4, + Standard_ND40rs_v2, + ] +version: 1 \ No newline at end of file diff --git a/assets/models/system/cxrreportgen/asset.yaml b/assets/models/system/cxrreportgen/asset.yaml new file mode 100644 index 0000000000..fcf5c5a05b --- /dev/null +++ b/assets/models/system/cxrreportgen/asset.yaml @@ -0,0 +1,4 @@ +extra_config: model.yaml +spec: spec.yaml +type: model +categories: ["Foundation Models"] diff --git a/assets/models/system/cxrreportgen/description.md b/assets/models/system/cxrreportgen/description.md new file mode 100644 index 0000000000..e8d3e876e1 --- /dev/null +++ b/assets/models/system/cxrreportgen/description.md @@ -0,0 +1,123 @@ +## Overview + +The CxrReportGen model utilizes a multimodal architecture, integrating a BiomedCLIP image encoder with a Phi-3-Mini text encoder to accurately interpret complex medical imaging studies of chest X-rays. CxrReportGen follows the same framework as **[MAIRA-2](https://www.microsoft.com/en-us/research/publication/maira-2-grounded-radiology-report-generation/)**. Its primary function is to generate comprehensive and structured radiology reports, with visual grounding represented by bounding boxes on the images. + +### Training information + +| **Training Dataset** | **Details** | +|----------------|---------------------| +| **[MIMIC-CXR](https://physionet.org/content/mimic-cxr/2.0.0/)** | Frontal chest X-rays from the training partition of the MIMIC-CXR dataset and the associated text reports. Rule-based processing was carried out to extract findings and impressions separately, or to map non-labeled report sections to the relevant sections. During training, text is randomly sampled from either the findings or the impression section. In total 203,170 images from this dataset were used.| +| **Propiertary datasets** | Multiple other proprietary datasets, composed of procured data, were additionally leveraged for training. Caution was taken to ensure there was no leakage of test data samples in the data used for training. | + +**Training Statistics:** + - **Data Size:** ~400,000 samples + - **Batch Size:** 16 + - **Epochs:** 3 + - **Learning Rate:** 2.5e-05 + - **Hardware:** 8 A100 GPUs + - **Training Time:** 1 day and 19 hours + - **Sku:** Standard_ND96amsr_A100_v4 + +### License and where to send questions or comments about the model +The license for CXRReportGen is the MIT license. +For questions or comments, please contact: hlsfrontierteam@microsoft.com + +## Benchmark Results + +### Findings Generation on MIMIC-CXR test set: + +| CheXpert F1-14 (Micro) | CheXpert F1-5 (Micro)| RadGraph-F1 | ROUGE-L | BLEU-4| +|----------------|--------------|-------------|---------|-------| +| 59.1 | 59.7 | 40.8 | 39.1 |23.7 | + + +### Grounded Reporting on [GR-Bench test set](https://arxiv.org/pdf/2406.04449v1): + +| CheXpert F1-14 (Micro) | RadGraph-F1 | ROUGE-L | Box-Completion (Precision/Recall)| +|------------------------|------------ |----------|-----------------| +| 60.0 | 55.6 | 56.6 | 71.5/82.0 | + +## Carbon Footprint +The estimated carbon emissions during training are 0.06364 tCO2eq. + + +## Sample Input and Output + +### Input: +```json +{'input_data': + {'columns': ['frontal_image', 'lateral_image', 'indication', 'technique', 'comparison'], + 'index': [0], + 'data': [ + [ + base64.encodebytes(read_image(frontal)).decode("utf-8"), + base64.encodebytes(read_image(lateral)).decode("utf-8"), + 'Pneumonia', + 'One view chest', + 'None' + ]]}, + 'params': {}} +``` + +### Output: +Output is json encoded inside an array. +```python +findings = json.loads(result[0]["output"]) +findings +``` + +```json +[['Cardiac silhouette remains normal in size.', None], + ['Hilar contours are unremarkable.', None], + ['There are some reticular appearing opacities in the left base not seen on the prior exam.', + [[0.505, 0.415, 0.885, 0.775]]], + ['There is blunting of the right costophrenic sulcus.', + [[0.005, 0.555, 0.155, 0.825]]], + ['Upper lungs are clear.', None]] +``` +The generated bounding box coordinates are the (x, y) coordinates of the top left and bottom right corners of the box, e.g. (x_topleft, y_topleft, x_bottomright, y_bottomright). These are relative to the cropped image (that is, the image that the model ultimately got as input), so be careful while visualising. + +You can optionally apply the below code on the output to adjust the size: +```python + def adjust_box_for_original_image_size(box: BoxType, width: int, height: int) -> BoxType: + """ + This function adjusts the bounding boxes from the MAIRA-2 model output to account for the image processor + cropping the image to be square prior to the model forward pass. The box coordinates are adjusted to be + relative to the original shape of the image assuming the image processor cropped the image based on the length + of the shortest side. + + Args: + box (BoxType): + The box to be adjusted, normalised to (0, 1). + width (int): + Original width of the image, in pixels. + height (int): + Original height of the image, in pixels. + + Returns: + BoxType: The box normalised relative to the original size of the image. + """ + crop_width = crop_height = min(width, height) + x_offset = (width - crop_width) // 2 + y_offset = (height - crop_height) // 2 + + norm_x_min, norm_y_min, norm_x_max, norm_y_max = box + + abs_x_min = int(norm_x_min * crop_width + x_offset) + abs_x_max = int(norm_x_max * crop_width + x_offset) + abs_y_min = int(norm_y_min * crop_height + y_offset) + abs_y_max = int(norm_y_max * crop_height + y_offset) + + adjusted_norm_x_min = abs_x_min / width + adjusted_norm_x_max = abs_x_max / width + adjusted_norm_y_min = abs_y_min / height + adjusted_norm_y_max = abs_y_max / height + + return (adjusted_norm_x_min, adjusted_norm_y_min, adjusted_norm_x_max, adjusted_norm_y_max) +``` + +## Ethical Considerations + +CxrReportGen should not be used as a diagnostic tool or as a substitute for professional medical advice. It is designed to assist radiologists by generating findings and reports, but final clinical decisions should always be made by human experts. + +For detailed guidelines on ethical use, refer to Microsoft's [Responsible AI Principles](https://www.microsoft.com/en-us/ai/responsible-ai). diff --git a/assets/models/system/cxrreportgen/model.yaml b/assets/models/system/cxrreportgen/model.yaml new file mode 100644 index 0000000000..9d8360c59f --- /dev/null +++ b/assets/models/system/cxrreportgen/model.yaml @@ -0,0 +1,8 @@ +path: + container_name: models + container_path: huggingface/CxrReportGen/mlflow_model_folder + storage_name: automlcesdkdataresources + type: azureblob +publish: + description: description.md + type: mlflow_model diff --git a/assets/models/system/cxrreportgen/spec.yaml b/assets/models/system/cxrreportgen/spec.yaml new file mode 100644 index 0000000000..b706df4d0b --- /dev/null +++ b/assets/models/system/cxrreportgen/spec.yaml @@ -0,0 +1,30 @@ +$schema: https://azuremlschemas.azureedge.net/latest/model.schema.json + +name: CxrReportGen +path: ./ + +properties: + inference-min-sku-spec: 24|1|220|64 + inference-recommended-sku: Standard_NC24ads_A100_v4, Standard_NC48ads_A100_v4, Standard_NC96ads_A100_v4, Standard_ND96asr_v4, Standard_ND96amsr_A100_v4 + languages: en + SharedComputeCapacityEnabled: true + +tags: + task: image-text-to-text + industry: health-and-life-sciences + Preview: "" + inference_supported_envs: + - hf + license: mit + author: Microsoft + hiddenlayerscanned: "" + SharedComputeCapacityEnabled: "" + inference_compute_allow_list: + [ + Standard_NC24ads_A100_v4, + Standard_NC48ads_A100_v4, + Standard_NC96ads_A100_v4, + Standard_ND96asr_v4, + Standard_ND96amsr_A100_v4, + ] +version: 3 \ No newline at end of file diff --git a/assets/models/system/medimageinsight/asset.yaml b/assets/models/system/medimageinsight/asset.yaml new file mode 100644 index 0000000000..fcf5c5a05b --- /dev/null +++ b/assets/models/system/medimageinsight/asset.yaml @@ -0,0 +1,4 @@ +extra_config: model.yaml +spec: spec.yaml +type: model +categories: ["Foundation Models"] diff --git a/assets/models/system/medimageinsight/description.md b/assets/models/system/medimageinsight/description.md new file mode 100644 index 0000000000..d0a82c22d5 --- /dev/null +++ b/assets/models/system/medimageinsight/description.md @@ -0,0 +1,146 @@ +### Overview +Most medical imaging AI today is narrowly built to detect a small set of individual findings on a single modality like Chest x-Rays. +This training approach is data and computationally inefficient, requiring ~6-12 months per finding, and often fails to generalize in real world environments. +By further training existing multimodal foundation models on medical images and associated text data, Microsoft and Nuance created a multimodal foundation model that shows evidence of generalizing across various medical imaging modalities, anatomies, locations, severities, and types of medical data. +The training methods learn to map the medical text and images into a unified numerical vector representation space, which makes it easy for computers to understand the relationships between those modalities. + +Embeddings is an important building block in AI research and development for retrieval, search, comparison, classification, and tagging tasks, and developers and researchers can now use MedImageInsight embeddings in the medical domain. +MedImageInsight embeddings is open source allowing developers to customize and adapt to their specific use cases. + +### Model Architecture + +Microsoft MedImageInsight includes 360 million parameter image encoder and 252 million parameter language encoder and comes as pretrained model with fine-tuning capability. The language encoder is not run in inference for each image. It is only run once (offline) to generate classifier head. MedImageInsight is a vision language transformer and was derviced from the Florence computer vision foundation model. Florence is a two-tower architecture similar to CLIP, except the DaViT archictecture is used as the image encoder and the UniCL objective is used as the objective function for MedImageInsight. + +Model input supports image and text input and generates vector embeddings as output. This is a static model trained on an offline dataset that is described below. + +### License and where to send questions or comments about the model +A custom commercial license is available. Please contact the team for details. + +### Training information + +| **Training Dataset** | **Details** | +|----------------|---------------------| +| **[MIMIC-CXR](https://physionet.org/content/mimic-cxr/2.0.0/)** | Frontal chest X-rays from the training partition of the MIMIC-CXR dataset and the associated text reports. Rule-based processing was carried out to extract findings and impressions separately, or to map non-labeled report sections to the relevant sections. During training, text is randomly sampled from either the findings or the impression section. In total 203,170 images from this dataset were used.| +| **[NIH-CXR-LT](https://pubmed.ncbi.nlm.nih.gov/36318048/)**| The NIH-CXR-LT dataset contains long tail distribution categories spanning 20 disease classes for frontal chest X-rays. 68,058 images from the training dataset were leveraged. | +| **[IRMA 2009](https://publications.rwth-aachen.de/record/113524/files/Lehmann_IRMACode_2003.pdf)** | A dataset containing X-rays covering a spectrum of body regions, views, and patient positions. Category information is specified in a coding system, with a PDF mapping the coding system to text for each of the code sub-parts. We converted the coding scheme to the text counterparts by extracting this mapping from the PDF, and leveraged the image and code-text pairs for training. | +| **[RSNA BoneAge](https://pubs.rsna.org/doi/abs/10.1148/radiol.2018180736?journalCode=radiology)** | Pediatric bone-age hand X-rays annotated with the development age of the images. The images are supplied in 8-bit format with inconsistent window leveling. Preprocessing was applied including histogram equalization followed by window leveling to control and standardize the appearance of the images for subsequent training and inference. The development age and gender of the image was converted to text using a standardized template. 12,611 images from the training partition are leveraged. | +| **[UPENN](https://www.nature.com/articles/s41597-022-01560-7)** | A dataset of MRI images of glioblastomas. Images were paired with the text of their DICOM image series descriptions. In total 4,645 images with associated texts were organized for training. | +| **[TCGA](https://www.cancerimagingarchive.net/collection/tcga-sarc/)** | multi-modal dataset of imaging for sarcoma diagnostics. CT and MRI images were extracted and associated with the text of their series description, constituting 5,643 image and text pairs. | +| **[SD198](https://link.springer.com/chapter/10.1007/978-3-319-46466-4_13)** | A dataset of clinical photographs of 198 skin lesions crawled from the web. Train and test splits were not made available but based on random 50% sampling, which we followed for consistency, yielding 3,253 images for training. | +| **[ISIC2019](https://arxiv.org/abs/1902.03368)** | A collection of dermascopic images of skin lesions, associated with 8 diagnostic states spanning metastatic and non-metastatic disease. 20,268 images from the training partition were leveraged. | +| **[PatchCamelyon](https://jamanetwork.com/journals/jama/fullarticle/2665774)** | Histopathological images of breast tissue depicting the presence or absence of cancer. 262,144 images and associated text labels were used in training. | +| **[RSNA Mammography](https://www.kaggle.com/competitions/rsna-breast-cancer-detection/data)** | Images from RSNA hosted and managed challenge on breast cancer detection from mammography. The dataset comprises several styles of mammo- grams with varying window levels and contrasts. No attempt was made to standardize or normalize the images. In total, 43,764 mammograms were leveraged for training. | +| **[LIDIC-IDRI](https://ieee-dataport.org/documents/lung-image-database-consortium-image-collection-lidc-idri)** | A dataset of chest CTs depicting lung nodules at various stages of development. Dataset was broken into tiles of 5x5 across images, with tiles labeled for the maturity of lung nodule present in the tile. 80,201 tiles were sampled for training. | +| **[PAD-UFES-20](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7479321/)** | A collection of clinical photographs of skin lesions taken from mo- bile devices, where the images have been cropped over the lesion of interest. 6 diseases are represented. According to precedent 2,065 images (90%) were leveraged for training, and 233 (10%) for testing. | +| **[ODIR-5k](https://www.kaggle.com/datasets/andrewmvd/ocular-disease-recognition-odir5k)** | Fundus images, where pairs of eyes were annotated across 6 categories. If one eye is not normal, the pair is labeled with the disease of the abnormal eye. Laterality specific textual descriptions were also available. Upon further processing, we discovered about 79 unique textual descriptions were assigned across 6,495 unique eyes, and opted to use these descriptions as labels instead of the reduced 6 labels. 5228 images were used for training, and 1267 images were used for evaluation, which constituted a random 20% sampling of the top 30 categories (with 10 or more instances in the dataset). | +| **Propiertary datasets** | Multiple other proprietary datasets, composed of procured data, data supplied by collaborative partners, and data crawled from the web were additionally leveraged for training. Caution was taken to ensure there was no leakage of test data samples in the crawled data used for training. | + + +| **Carbon Footprint** | **Details** | +|---------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **Carbon Footprint** | Pretraining utilized a cumulative 7680 GPU hours of computation on hardware of type V100 (TDP of 250W-400W). Estimated total emissions were 0.89184 tCO2eq. We trained on Azure Machine Learning. We used 64 V100 GPUs. Compute region was West US 2. | + + +### Evaluation Results +In this section, we report the results for the models on standard academic benchmarks. For all the evaluations, we use our internal evaluations library. For these models, we always pick the best score between our evaluation framework and any publicly reported results. +| **Modality** | **Use Case** | **Benchmark** | **Maturity relative to Human Expert** | **MSFT IP or Partner Models** | **Google Models** | +|----------------|---------------------|-----------------------------------------------------------------------------------------------|--------------------------------------|---------------------------------|---------------------------------------| +| **Radiology** | Classification | X-Ray: RSNA Bone age | 🟒 | 6.85 avg L1* | No test results | +| | Classification | X-Ray: IRMA2005 body-region/view categories | 🟒 | 0.99 mAUC* | No test results | +| | Classification | ChestXray14: Consolidation (finetuning) | 🟑 | 0.74 mAUC* | 0.74 mAUC (ELiXR)* | +| | Classification | ChestXray14: Edema (finetuning) | 🟑 | 0.86 mAUC* | 0.85 mAUC* (ELiXR) | +| | Classification | ChestXray14: Effusion (finetuning) | 🟑 | 0.83 mAUC* | 0.83 mAUC* (ELiXR) | +| | Classification | MR/CT: Exam categories | 🟑 | 0.95 mAUC* | No test results | +| | Classification | Chest CT: LIDC-IDRI Lung Nodules | 🟑 | 0.81 mAUC* | No model | +| | Classification | Mammography: RSNA Mammography | 🟑 | 0.81 mAUC* | No model | +| **Dermatology**| Classification | ISIC2019 | 🟑 | 0.84 mAUC* | No test results | +| | Classification | SD-198 | 🟑 | 0.93 mAUC* | No test results | +| | Classification | PADUFES20 | 🟑 | 0.96 mAUC | 0.97* (Med-PaLM-M 84B) | +| **Pathology** | Classification | PCAM | 🟑 | 0.96 mAUC* (PaLM) | No test results | +| | Classification | WILDS | 🟑 | 0.97 mAUC (PaLM) | No test results | + + +*SOTA for this task + +### Fairness evaluation + +The table below highlights the performance (AUC) of Bone Age prediction and ChextX-ray text search tasks for female and male respectively. + +| Tasks | AUC | +|----------------------------------------|--------| +| Bone Age (Female) | 6.9343 | +| Bone Age (Male) | 6.5446 | +| ChestX-ray text search (Female) | 0.8651 | +| ChestX-ray text search (Male) | 0.8603 | + + +The table below highlight characterisitcs of patients whose OCT images were included in the analysis. + +| Diagnosis | Diabetic Macular Edema (DME) | Choroidal Neovascularization (CNV) | Drusen | Normal | +|--------------------------------|------------------------------|------------------------------------|--------|--------| +| **Number of Patients** | 709 | 791 | 713 | 3548 | +| **Mean Age (years)** | 57 (Range: 20-90) | 83 (Range: 58-97) | 82 (Range: 40-95) | 60 (Range: 21-86) | +| **Gender** | | | | | +| Male | 38.3% | 54.2% | 44.4% | 59.2% | +| Female | 61.7% | 45.8% | 55.6% | 40.8% | +| **Ethnicity** | | | | | +| Caucasian | 42.6% | 83.3% | 85.2% | 59.9% | +| Asian | 23.4% | 6.3% | 8.6% | 21.1% | +| Hispanic | 23.4% | 8.3% | 4.9% | 10.2% | +| African American | 4.3% | 2.1% | 1.2% | 1.4% | +| Mixed or Other | 10.6% | 0% | 0% | 7.5% | + + +We plan on doing more comprehensive fairness evaluations before public release. + +### Ethical Considerations and Limitations + +Microsoft believes Responsible AI is a shared responsibility and we have identified six principles and practices help organizations address risks, innovate, and create value: fairness, reliability and safety, privacy and security, inclusiveness, transparency, and accountability. When downloaded or used in accordance with our terms of service, developers should work with their supporting model team to ensure this model meets requirements for the relevant use case and addresses unforeseen product misuse.β€― + +While testing the model with images and/or text, ensure the the data is PHI free and that there are no patient information or information that can be tracked to a patient identity. + +The model is not designed for the following use cases: +* **Use as a diagnostic tool or as a medical device** - Using information extracted by our service in diagnosis, cure, mitigation, treatment, or prevention of disease or other conditions, as a substitute of professional medical advice, diagnosis, treatment, or clinical judgment of a healthcare professional.β€― + +* **Scenarios without consent for data** -β€―Any scenario that uses health data for a purpose for which consent was not obtained.β€―β€― + +* **Use outside of health scenarios** - Any scenario that uses non-medical related image and/or serving purposes outside of the healthcare domain.β€― + +Please see Microsoft's Responsible AI Principles and approach available at [https://www.microsoft.com/en-us/ai/principles-and-approach/](https://www.microsoft.com/en-us/ai/principles-and-approach/) + + +### Sample inputs and outputs (for real time inference) + +Input: +```bash +data = { + "input_data": { + "columns": [ + "image", + "text" + ], + "index":[0, 1], + "data": [ + [base64.encodebytes(read_image(sample_image_ct_8Bits_Mono)).decode("utf-8"), "This 3D volume depicts the pancreas with a single tumor, the largest of which measures 5.10 centimeters in length."], + [base64.encodebytes(read_image(sample_image_mri_8Bits_Mono)).decode("utf-8"), "This 3D volume depicts the brain with a single tumor."] + ] + }, + "params": {} +} +``` + +Output: +```bash +[{"image_features": [[-0.040428221225738525, 0.015632804483175278, -0.034625787287950516, -0.013094332069158554, 0.023215821012854576, -0.010303247720003128, -0.003998206462711096, -0.00022746287868358195]] +``` + +## Data and Resource Specification for Deployment +* **Supported Data Input Format** +- Monochromatic 8-bit Images (i.e. PNG, TIFF) +- RGB Images (i.e. JPEG, PNG) +- Text (Maximum: 77 Tokens) + +* **Hardware Requirement for Compute Instances** +- Default: Single V100 GPU +- Minimum: Single GPU instance with 8Gb Memory +- Batch size: 4 (~6Gb Memory) diff --git a/assets/models/system/medimageinsight/model.yaml b/assets/models/system/medimageinsight/model.yaml new file mode 100644 index 0000000000..368c284af4 --- /dev/null +++ b/assets/models/system/medimageinsight/model.yaml @@ -0,0 +1,8 @@ +path: + container_name: models + container_path: huggingface/MedImageInsight/mlflow_model_folder + storage_name: automlcesdkdataresources + type: azureblob +publish: + description: description.md + type: mlflow_model diff --git a/assets/models/system/medimageinsight/spec.yaml b/assets/models/system/medimageinsight/spec.yaml new file mode 100644 index 0000000000..3658b51fb8 --- /dev/null +++ b/assets/models/system/medimageinsight/spec.yaml @@ -0,0 +1,34 @@ +$schema: https://azuremlschemas.azureedge.net/latest/model.schema.json + +name: MedImageInsight +path: ./ + +properties: + inference-min-sku-spec: 6|1|112|64 + inference-recommended-sku: Standard_NC6s_v3, Standard_NC12s_v3, Standard_NC24s_v3, Standard_NC24ads_A100_v4, Standard_NC48ads_A100_v4, Standard_NC96ads_A100_v4, Standard_ND96asr_v4, Standard_ND96amsr_A100_v4, Standard_ND40rs_v2 + languages: en + SharedComputeCapacityEnabled: true + +tags: + task: embeddings + industry: health-and-life-sciences + Preview: "" + inference_supported_envs: + - hf + license: mit + author: Microsoft + hiddenlayerscanned: "" + SharedComputeCapacityEnabled: "" + inference_compute_allow_list: + [ + Standard_NC6s_v3, + Standard_NC12s_v3, + Standard_NC24s_v3, + Standard_NC24ads_A100_v4, + Standard_NC48ads_A100_v4, + Standard_NC96ads_A100_v4, + Standard_ND96asr_v4, + Standard_ND96amsr_A100_v4, + Standard_ND40rs_v2, + ] +version: 2 \ No newline at end of file diff --git a/assets/models/system/medimageparse/asset.yaml b/assets/models/system/medimageparse/asset.yaml new file mode 100644 index 0000000000..fcf5c5a05b --- /dev/null +++ b/assets/models/system/medimageparse/asset.yaml @@ -0,0 +1,4 @@ +extra_config: model.yaml +spec: spec.yaml +type: model +categories: ["Foundation Models"] diff --git a/assets/models/system/medimageparse/description.md b/assets/models/system/medimageparse/description.md new file mode 100644 index 0000000000..50ba7b8445 --- /dev/null +++ b/assets/models/system/medimageparse/description.md @@ -0,0 +1,133 @@ +### Overview +Biomedical image analysis is fundamental for biomedical discovery in cell biology, pathology, radiology, and many other biomedical domains. MedImageParse is a biomedical foundation model for imaging parsing that can jointly conduct segmentation, detection, and recognition for 82 object types across 9 imaging modalities. Through joint learning, we can improve accuracy for individual tasks and enable novel applications such as segmenting all relevant objects in an image through a text prompt, rather than requiring users to laboriously specify the bounding box for each object. + +On image segmentation, we showed that MedImageParse is broadly applicable, outperforming state-of-the-art methods on 102,855 test image-mask-label triples across 9 imaging modalities. + +MedImageParse is also able to identify invalid user inputs describing objects that do not exist in the image. On object detection, which aims to locate a specific object of interest, MedImageParse again attained state-of-the-art performance, especially on objects with irregular shapes. + +On object recognition, which aims to identify all objects in a given image along with their semantic types, we showed that MedImageParse can simultaneously segment and label all biomedical objects in an image. + +In summary, MedImageParse is an all-in-one tool for biomedical image analysis by jointly solving segmentation, detection, and recognition. + +It is broadly applicable to all major biomedical image modalities, paving the path for efficient and accurate image-based biomedical discovery. + +### Model Architecture +MedImageParse is built upon a transformer-based architecture, optimized for processing large biomedical corpora. Leveraging multi-head attention mechanisms, it excels at identifying and understanding biomedical terminology, as well as extracting contextually relevant information from dense scientific texts. The model is pre-trained on vast biomedical datasets, allowing it to generalize across various biomedical domains with high accuracy. + +### License and where to send questions or comments about the model +The license for MedImageParse is the MIT license. +For questions or comments, please contact: hlsfrontierteam@microsoft.com + +### Training information + +MedImageParse was trained on a large dataset comprising over six million triples of image, segmentation mask, and textual description. + +MedImageParse used 16 NVIDIA A100-SXM4-40GB GPUs for a duration of 58 hours. + +### Evaluation Results +Please see the paper for detailed information about methods and results. https://microsoft.github.io/BiomedParse/assets/BiomedParse_arxiv.pdf + +Bar plot comparing the Dice score between our method and competing methods on 102,855 test instances (image-mask-label +triples) across 9 modalities. MedSAM and SAM require bounding box as input. + +![MedImageParse comparison results on segmentation](medimageparseresults.png) + + + +### Fairness evaluation +We conducted fairness evaluation for different sex and age groups. Two-sided independent t-test +shows non-significant differences between female and male and between different age groups, with p-value > 5% for all imaging modalities and segmentation targets evaluated. + +### Ethical Considerations and Limitations + +Microsoft believes Responsible AI is a shared responsibility and we have identified six principles and practices help organizations address risks, innovate, and create value: fairness, reliability and safety, privacy and security, inclusiveness, transparency, and accountability. When downloaded or used in accordance with our terms of service, developers should work with their supporting model team to ensure this model meets requirements for the relevant use case and addresses unforeseen product misuse.β€― + +While testing the model with images and/or text, ensure the the data is PHI free and that there are no patient information or information that can be tracked to a patient identity. + +The model is not designed for the following use cases: +* **Use as a diagnostic tool or as a medical device** - Although MedImageParse is highly accurate in parsing biomedical it is not intended to be consumed directly and using information extracted by our service in diagnosis, cure, mitigation, treatment, or prevention of disease or other conditions, as a substitute of professional medical advice, diagnosis, treatment, or clinical judgment of a healthcare professional.β€― + +* **Scenarios without consent for data** -β€―Any scenario that uses health data for a purpose for which consent was not obtained.β€―β€― + +* **Use outside of health scenarios** - Any scenario that uses non-medical related image and/or serving purposes outside of the healthcare domain.β€― + +Please see Microsoft's Responsible AI Principles and approach available at [https://www.microsoft.com/en-us/ai/principles-and-approach/](https://www.microsoft.com/en-us/ai/principles-and-approach/) + + + +### Sample inputs and outputs (for real time inference) + +Input: +```bash +data = { + "input_data": { + "columns": [ + "image", + "text" + ], + "index":[0, 1], + "data": [ + [base64.encodebytes(read_image('./examples/Part_3_226_pathology_breast.png')).decode("utf-8"), "neoplastic cells in breast pathology & inflammatory cells."], + [base64.encodebytes(read_image('./examples/TCGA_HT_7856_19950831_8_MRI-FLAIR_brain.png')).decode("utf-8"), "brain tumor"] + ], + }, + "params": {} +} +``` + + + +## Data and Resource Specification for Deployment +* **Supported Data Input Format** +1. The model expect 2D 8-bit RGB or grayscale images by default, with pixel values ranging from 0 to 255 and resolution 1024*1024. +2. We provided preprocessing notebooks 4, 5, 6 to illustrate how to convert raw formats including DICOM, NIFTI, PNG, and JPG to desired format, with preprocessing steps such as CT windowing. +3. The model outputs pixel probabilities in the same shape as the input image. We convert the floating point probabilities to 8-bit grayscale outputs. The probability threshold for segmentation mask is 0.5, which corresponds to 127.5 in 8-bit grayscale output. +4. The model takes in text prompts for segmentation and doesn't have a fixed number of targets to handle. However, to ensure quality performance, we recommend the following tasks based on evaluation results. + - CT: abdomen: adrenal gland, aorta, bladder, duodenum, esophagus, gallbladder, kidney, kidney cyst, + kidney tumor, left adrenal gland, left kidney, liver, pancreas, postcava, + right adrenal gland, right kidney, spleen, stomach, tumor + colon: tumor + liver: liver, tumor + lung: COVID-19 infection, nodule + pelvis: uterus + - MRI-FLAIR: brain: edema, lower-grade glioma, tumor, tumor core, whole tumor + - MRI-T1-Gd: brain: enhancing tumor, tumor core + - MRI-T2: prostate: prostate peripheral zone, prostate transitional zone, + - MRI: abdomen: aorta, esophagus, gallbladder, kidney, left kidney, liver, pancreas, postcava, + right kidney, spleen, stomach + brain: anterior hippocampus, posterior hippocampus + heart: left heart atrium, left heart ventricle, myocardium, right heart ventricle + prostate: prostate + - OCT: retinal: edema + - X-Ray: chest: COVID-19 infection, left lung, lung, lung opacity, right lung, viral pneumonia + - dermoscopy: skin: lesion, melanoma + - endoscope: colon: neoplastic polyp, non-neoplastic polyp, polyp + - fundus: retinal: optic cup, optic disc, + - pathology: bladder: neoplastic cells + breast: epithelial cells, neoplastic cells + cervix: neoplastic cells + colon: glandular structure, neoplastic cells + esophagus: neoplastic cells + kidney: neoplastic cells + liver: epithelial cells, neoplastic cells + ovarian: epithelial cells, 'neoplastic cells + prostate: neoplastic cells + skin: neoplastic cells + stomach: neoplastic cells + testis: epithelial cells + thyroid: epithelial cells, neoplastic cells + uterus: neoplastic cells +ultrasound: breast: benign tumor, malignant tumor, tumor + heart: left heart atrium, left heart ventricle + transperineal: fetal head, public symphysis + +* **Hardware Requirement for Compute Instances** +- Default: Single V100 GPU +- Minimum: Single GPU instance with 8Gb Memory + + +* **Hardware Requirement for Compute Instances** +Please suggest the following hardware requirements for the compute instances, for example: +- Batch size: 4 (~6Gb Memory) +- Image Compression Ratio: 75 (Default) +- Image Size: 512 (Default for X-Y Dimension) diff --git a/assets/models/system/medimageparse/model.yaml b/assets/models/system/medimageparse/model.yaml new file mode 100644 index 0000000000..a86648672c --- /dev/null +++ b/assets/models/system/medimageparse/model.yaml @@ -0,0 +1,8 @@ +path: + container_name: models + container_path: huggingface/MedImageParse/mlflow_model_folder + storage_name: automlcesdkdataresources + type: azureblob +publish: + description: description.md + type: mlflow_model diff --git a/assets/models/system/medimageparse/spec.yaml b/assets/models/system/medimageparse/spec.yaml new file mode 100644 index 0000000000..bfbd96d709 --- /dev/null +++ b/assets/models/system/medimageparse/spec.yaml @@ -0,0 +1,34 @@ +$schema: https://azuremlschemas.azureedge.net/latest/model.schema.json + +name: MedImageParse +path: ./ + +properties: + inference-min-sku-spec: 6|1|112|64 + inference-recommended-sku: Standard_NC6s_v3, Standard_NC12s_v3, Standard_NC24s_v3, Standard_NC24ads_A100_v4, Standard_NC48ads_A100_v4, Standard_NC96ads_A100_v4, Standard_ND96asr_v4, Standard_ND96amsr_A100_v4, Standard_ND40rs_v2 + languages: en + SharedComputeCapacityEnabled: true + +tags: + task: image-segmentation + industry: health-and-life-sciences + Preview: "" + inference_supported_envs: + - hf + license: mit + author: Microsoft + hiddenlayerscanned: "" + SharedComputeCapacityEnabled: "" + inference_compute_allow_list: + [ + Standard_NC6s_v3, + Standard_NC12s_v3, + Standard_NC24s_v3, + Standard_NC24ads_A100_v4, + Standard_NC48ads_A100_v4, + Standard_NC96ads_A100_v4, + Standard_ND96asr_v4, + Standard_ND96amsr_A100_v4, + Standard_ND40rs_v2, + ] +version: 2 \ No newline at end of file diff --git a/assets/models/system/microsoft-llava-med-v1.5-mistral-7b/asset.yaml b/assets/models/system/microsoft-llava-med-v1.5-mistral-7b/asset.yaml new file mode 100644 index 0000000000..fcf5c5a05b --- /dev/null +++ b/assets/models/system/microsoft-llava-med-v1.5-mistral-7b/asset.yaml @@ -0,0 +1,4 @@ +extra_config: model.yaml +spec: spec.yaml +type: model +categories: ["Foundation Models"] diff --git a/assets/models/system/microsoft-llava-med-v1.5-mistral-7b/description.md b/assets/models/system/microsoft-llava-med-v1.5-mistral-7b/description.md new file mode 100644 index 0000000000..95cea135cc --- /dev/null +++ b/assets/models/system/microsoft-llava-med-v1.5-mistral-7b/description.md @@ -0,0 +1,55 @@ +# LLaVA-Med v1.5, using [mistralai/Mistral-7B-Instruct-v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2) as LLM for a better commercial license + +Large Language and Vision Assistant for bioMedicine (i.e., β€œLLaVA-Med”) is a large language and vision model trained using a curriculum learning method for adapting LLaVA to the biomedical domain. It is an open-source release intended for research use only to facilitate reproducibility of the corresponding paper which claims improved performance for open-ended biomedical questions answering tasks, including common visual question answering (VQA) benchmark datasets such as PathVQA and VQA-RAD. + +LLaVA-Med was proposed in [LLaVA-Med: Training a Large Language-and-Vision Assistant for Biomedicine in One Day](https://arxiv.org/abs/2306.00890) by Chunyuan Li, Cliff Wong, Sheng Zhang, Naoto Usuyama, Haotian Liu, Jianwei Yang, Tristan Naumann, Hoifung Poon, Jianfeng Gao. + + +**Model date:** +LLaVA-Med-v1.5-Mistral-7B was trained in April 2024. + +**Paper or resources for more information:** +https://aka.ms/llava-med + +**Where to send questions or comments about the model:** +https://github.com/microsoft/LLaVA-Med/issues + + +## License +[mistralai/Mistral-7B-Instruct-v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2) license. + +## Intended use + +The data, code, and model checkpoints are intended to be used solely for (I) future research on visual-language processing and (II) reproducibility of the experimental results reported in the reference paper. The data, code, and model checkpoints are not intended to be used in clinical care or for any clinical decision making purposes. + +### Primary Intended Use + +The primary intended use is to support AI researchers reproducing and building on top of this work. LLaVA-Med and its associated models should be helpful for exploring various biomedical vision-language processing (VLP ) and vision question answering (VQA) research questions. + +### Out-of-Scope Use + +Any deployed use case of the model --- commercial or otherwise --- is out of scope. Although we evaluated the models using a broad set of publicly-available research benchmarks, the models and evaluations are intended for research use only and not intended for deployed use cases. Please refer to [the associated paper](https://aka.ms/llava-med) for more details. + + +## Data + +This model builds upon [PMC-15M dataset](https://aka.ms/biomedclip-paper), which is a large-scale parallel image-text dataset for biomedical vision-language processing. It contains 15 million figure-caption pairs extracted from biomedical research articles in PubMed Central. It covers a diverse range of biomedical image types, such as microscopy, radiography, histology, and more. + + +## Limitations + +This model was developed using English corpora, and thus may be considered English-only. This model is evaluated on a narrow set of biomedical benchmark tasks, described in [LLaVA-Med paper](https://aka.ms/llava-med). As such, it is not suitable for use in any clinical setting. Under some conditions, the model may make inaccurate predictions and display limitations, which may require additional mitigation strategies. In particular, this model is likely to carry many of the limitations of the model from which it is derived, [LLaVA](https://llava-vl.github.io/). + +Further, this model was developed in part using the [PMC-15M](https://aka.ms/biomedclip-paper) dataset. The figure-caption pairs that make up this dataset may contain biases reflecting the current practice of academic publication. For example, the corresponding papers may be enriched for positive findings, contain examples of extreme cases, and otherwise reflect distributions that are not representative of other sources of biomedical data. + + +### BibTeX entry and citation info + +```bibtex +@article{li2023llavamed, + title={Llava-med: Training a large language-and-vision assistant for biomedicine in one day}, + author={Li, Chunyuan and Wong, Cliff and Zhang, Sheng and Usuyama, Naoto and Liu, Haotian and Yang, Jianwei and Naumann, Tristan and Poon, Hoifung and Gao, Jianfeng}, + journal={arXiv preprint arXiv:2306.00890}, + year={2023} +} +``` \ No newline at end of file diff --git a/assets/models/system/microsoft-llava-med-v1.5-mistral-7b/model.yaml b/assets/models/system/microsoft-llava-med-v1.5-mistral-7b/model.yaml new file mode 100644 index 0000000000..5b81ca69d9 --- /dev/null +++ b/assets/models/system/microsoft-llava-med-v1.5-mistral-7b/model.yaml @@ -0,0 +1,8 @@ +path: + container_name: models + container_path: huggingface/llava-med-v1.5-mistral-7b/mlflow_model_folder + storage_name: automlcesdkdataresources + type: azureblob +publish: + description: description.md + type: mlflow_model diff --git a/assets/models/system/microsoft-llava-med-v1.5-mistral-7b/spec.yaml b/assets/models/system/microsoft-llava-med-v1.5-mistral-7b/spec.yaml new file mode 100644 index 0000000000..383a58772b --- /dev/null +++ b/assets/models/system/microsoft-llava-med-v1.5-mistral-7b/spec.yaml @@ -0,0 +1,36 @@ +$schema: https://azuremlschemas.azureedge.net/latest/model.schema.json + +name: microsoft-llava-med-v1.5-mistral-7b +path: ./ + +properties: + inference-min-sku-spec: 6|1|112|64 + inference-recommended-sku: Standard_NC6s_v3, Standard_NC12s_v3, Standard_NC24s_v3, Standard_NC24ads_A100_v4, Standard_NC48ads_A100_v4, Standard_NC96ads_A100_v4, Standard_ND96asr_v4, Standard_ND96amsr_A100_v4, Standard_ND40rs_v2 + languages: en + SharedComputeCapacityEnabled: true + +tags: + industry: health-and-life-sciences + author: Microsoft + Preview: "" + SharedComputeCapacityEnabled: "" + inference_supported_envs: + - hf + license: apache-2.0 + task: image-text-to-text + hiddenlayerscanned: "" + huggingface_model_id: microsoft/llava-med-v1.5-mistral-7b + inference_compute_allow_list: + [ + Standard_NC6s_v3, + Standard_NC12s_v3, + Standard_NC24s_v3, + Standard_NC24ads_A100_v4, + Standard_NC48ads_A100_v4, + Standard_NC96ads_A100_v4, + Standard_ND96asr_v4, + Standard_ND96amsr_A100_v4, + Standard_ND40rs_v2, + ] + +version: 1 \ No newline at end of file diff --git a/assets/promptflow/models/rai-eval-ui-dag-flow/model.yaml b/assets/promptflow/models/rai-eval-ui-dag-flow/model.yaml index dd58915c02..a4d259189c 100644 --- a/assets/promptflow/models/rai-eval-ui-dag-flow/model.yaml +++ b/assets/promptflow/models/rai-eval-ui-dag-flow/model.yaml @@ -1,6 +1,6 @@ path: container_name: rai-eval-flows - container_path: models/rai_eval_ui_dag_flow/v2 + container_path: models/rai_eval_ui_dag_flow/v3 storage_name: amlraipfmodels type: azureblob publish: diff --git a/assets/promptflow/models/rai-eval-ui-dag-flow/spec.yaml b/assets/promptflow/models/rai-eval-ui-dag-flow/spec.yaml index 1b2858a8c3..7ee944b140 100644 --- a/assets/promptflow/models/rai-eval-ui-dag-flow/spec.yaml +++ b/assets/promptflow/models/rai-eval-ui-dag-flow/spec.yaml @@ -9,4 +9,4 @@ properties: azureml.promptflow.description: Compute the quality and safety of the answer for the given question based on the ground_truth and the context inference-min-sku-spec: 2|0|14|28 inference-recommended-sku: Standard_DS3_v2 -version: 2 +version: 3 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 045da6dd48..1773eb5c4c 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Chat Completion Finetune description: 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_finetune) to learn more. -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/finetune 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 e747d6e553..009568ad4d 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Question Answering Finetune description: 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_finetune) to learn more. -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/finetune 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 5009f06a00..7ecf254bea 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Summarization Finetune description: 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_finetune) to learn more. -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/finetune 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 8f93a4be02..15c513c295 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.59 +version: 0.0.61 type: command is_deterministic: false @@ -8,7 +8,7 @@ is_deterministic: false display_name: Text Classification Finetune description: 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_finetune) to learn more. -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/finetune 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 75619f0ca4..3132e57b70 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Text Generation Finetune description: Component to finetune model for Text Generation task -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/finetune 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 6317240fef..62260ac133 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.59 +version: 0.0.61 type: command is_deterministic: false @@ -8,7 +8,7 @@ is_deterministic: false display_name: Token Classification Finetune description: 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_finetune) to learn more. -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/finetune 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 f4a2afe7c7..8c9b4e729b 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Translation Finetune description: 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_finetune) to learn more. -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/finetune 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 5fb0eb1ae5..7b5bbebbc0 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Common Model Converter description: Component to convert the finetune job output to pytorch and mlflow model -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/model_converter 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 eea55de483..cd3ba50bf1 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Chat Completion Model Import description: Component to import PyTorch / MLFlow model. See [docs](https://aka.ms/azureml/components/chat_completion_model_import) to learn more. -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/model_selector 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 f8bff6351d..f423999cf4 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Question Answering Model Import description: Component to import PyTorch / MLFlow model. See [docs](https://aka.ms/azureml/components/question_answering_model_import) to learn more. -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/model_selector 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 9edd2c5ec9..ab36b95a27 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Summarization Model Import description: Component to import PyTorch / MLFlow model. See [docs](https://aka.ms/azureml/components/summarization_model_import) to learn more. -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/model_selector 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 5b16827ef2..8ef90fef56 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Text Classification Model Import description: Component to import PyTorch / MLFlow model. See [docs](https://aka.ms/azureml/components/text_classification_model_import) to learn more. -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/model_selector 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 1cc41a79f0..7b5fdfe1ee 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Text Generation Model Import description: Import PyTorch / MLFlow model -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/model_selector 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 9da2ab5f85..9c85437d15 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Token Classification Model Import description: Component to import PyTorch / MLFlow model. See [docs](https://aka.ms/azureml/components/token_classification_model_import) to learn more. -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/model_selector 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 9f9d535aa2..4e90a11c9d 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Translation Model Import description: Component to import PyTorch / MLFlow model. See [docs](https://aka.ms/azureml/components/translation_model_import) to learn more. -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/model_selector 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 addf0b7b06..aa24280886 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.61 +version: 0.0.63 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. @@ -495,7 +495,7 @@ outputs: jobs: ft_nlp_common_validation: type: command - component: azureml:ft_nlp_common_validation:0.0.59 + component: azureml:ft_nlp_common_validation:0.0.61 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.59 + component: azureml:chat_completion_model_import:0.0.61 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.59 + component: azureml:chat_completion_datapreprocess:0.0.61 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.59 + component: azureml:chat_completion_finetune:0.0.61 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.59 + component: azureml:ft_nlp_model_converter:0.0.61 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 78d68cb734..fe268e98e1 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.61 +version: 0.0.63 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.59 + component: azureml:ft_nlp_common_validation:0.0.61 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.59 + component: azureml:question_answering_model_import:0.0.61 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.59 + component: azureml:question_answering_datapreprocess:0.0.61 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.59 + component: azureml:question_answering_finetune:0.0.61 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.59 + component: azureml:ft_nlp_model_converter:0.0.61 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 5d2c8eefbf..b04df19dd3 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.61 +version: 0.0.63 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.59 + component: azureml:ft_nlp_common_validation:0.0.61 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.59 + component: azureml:summarization_model_import:0.0.61 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.59 + component: azureml:summarization_datapreprocess:0.0.61 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.59 + component: azureml:summarization_finetune:0.0.61 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.59 + component: azureml:ft_nlp_model_converter:0.0.61 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 e4411b6ea9..7f60186b3c 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.61 +version: 0.0.63 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.59 + component: azureml:ft_nlp_common_validation:0.0.61 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.59 + component: azureml:text_classification_model_import:0.0.61 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.59 + component: azureml:text_classification_datapreprocess:0.0.61 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.59 + component: azureml:text_classification_finetune:0.0.61 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.59 + component: azureml:ft_nlp_model_converter:0.0.61 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 a6d25aac31..2c53ce6bad 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.61 +version: 0.0.63 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.59 + component: azureml:ft_nlp_common_validation:0.0.61 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.59 + component: azureml:text_generation_model_import:0.0.61 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.59 + component: azureml:text_generation_datapreprocess:0.0.61 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.59 + component: azureml:text_generation_finetune:0.0.61 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.59 + component: azureml:ft_nlp_model_converter:0.0.61 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 057b867c75..7c91c10215 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.61 +version: 0.0.63 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.59 + component: azureml:ft_nlp_common_validation:0.0.61 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.59 + component: azureml:text_generation_model_import:0.0.61 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.59 + component: azureml:text_generation_datapreprocess:0.0.61 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.59 + component: azureml:text_generation_finetune:0.0.61 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.59 + component: azureml:ft_nlp_model_converter:0.0.61 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 74fc63e9a7..7ca042168a 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.61 +version: 0.0.63 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.59 + component: azureml:ft_nlp_common_validation:0.0.61 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.59 + component: azureml:text_generation_model_import:0.0.61 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.59 + component: azureml:text_generation_datapreprocess:0.0.61 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.59 + component: azureml:text_generation_finetune:0.0.61 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.59 + component: azureml:ft_nlp_model_converter:0.0.61 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 27a5b4d3c4..604ff6a5ab 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.61 +version: 0.0.63 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.59 + component: azureml:ft_nlp_common_validation:0.0.61 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.59 + component: azureml:text_generation_model_import:0.0.61 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.59 + component: azureml:text_generation_datapreprocess:0.0.61 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.59 + component: azureml:text_generation_finetune:0.0.61 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.59 + component: azureml:ft_nlp_model_converter:0.0.61 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 38666a37f3..9bea51b7ea 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.61 +version: 0.0.63 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.59 + component: azureml:ft_nlp_common_validation:0.0.61 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.59 + component: azureml:text_generation_model_import:0.0.61 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.59 + component: azureml:text_generation_datapreprocess:0.0.61 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.59 + component: azureml:text_generation_finetune:0.0.61 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.59 + component: azureml:ft_nlp_model_converter:0.0.61 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 437fe3b0bf..66136ab6c9 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.61 +version: 0.0.63 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.59 + component: azureml:ft_nlp_common_validation:0.0.61 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.59 + component: azureml:text_generation_model_import:0.0.61 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.59 + component: azureml:text_generation_datapreprocess:0.0.61 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.59 + component: azureml:text_generation_finetune:0.0.61 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.59 + component: azureml:ft_nlp_model_converter:0.0.61 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 b44de36b60..f40d8121d0 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.61 +version: 0.0.63 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.59 + component: azureml:ft_nlp_common_validation:0.0.61 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.59 + component: azureml:text_generation_model_import:0.0.61 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.59 + component: azureml:text_generation_datapreprocess:0.0.61 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.59 + component: azureml:text_generation_finetune:0.0.61 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.59 + component: azureml:ft_nlp_model_converter:0.0.61 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 9abd941d92..baf84f99a2 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.61 +version: 0.0.63 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.59 + component: azureml:ft_nlp_common_validation:0.0.61 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.59 + component: azureml:text_generation_model_import:0.0.61 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.59 + component: azureml:text_generation_datapreprocess:0.0.61 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.59 + component: azureml:text_generation_finetune:0.0.61 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.59 + component: azureml:ft_nlp_model_converter:0.0.61 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 b38c0d02ec..1b35b66eca 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.61 +version: 0.0.63 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.59 + component: azureml:ft_nlp_common_validation:0.0.61 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.59 + component: azureml:text_generation_model_import:0.0.61 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.59 + component: azureml:text_generation_datapreprocess:0.0.61 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.59 + component: azureml:text_generation_finetune:0.0.61 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.59 + component: azureml:ft_nlp_model_converter:0.0.61 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 1f5c25e8d3..5361ba645a 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.61 +version: 0.0.63 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.59 + component: azureml:ft_nlp_common_validation:0.0.61 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.59 + component: azureml:text_generation_model_import:0.0.61 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.59 + component: azureml:text_generation_datapreprocess:0.0.61 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.59 + component: azureml:text_generation_finetune:0.0.61 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.59 + component: azureml:ft_nlp_model_converter:0.0.61 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 352b8d556f..e5e274d0cd 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.61 +version: 0.0.63 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.59 + component: azureml:ft_nlp_common_validation:0.0.61 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.59 + component: azureml:token_classification_model_import:0.0.61 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.59 + component: azureml:token_classification_datapreprocess:0.0.61 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.59 + component: azureml:token_classification_finetune:0.0.61 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.59 + component: azureml:ft_nlp_model_converter:0.0.61 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 eaa2bde173..81a1ba0dfb 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.61 +version: 0.0.63 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.59 + component: azureml:ft_nlp_common_validation:0.0.61 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.59 + component: azureml:translation_model_import:0.0.61 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.59 + component: azureml:translation_datapreprocess:0.0.61 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.59 + component: azureml:translation_finetune:0.0.61 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.59 + component: azureml:ft_nlp_model_converter:0.0.61 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 f8f147de55..ed2c1ff7b7 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Chat Completion DataPreProcess description: Component to preprocess data for chat completion task. See [docs](https://aka.ms/azureml/components/chat_completion_datapreprocess) to learn more. -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/preprocess 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 1a91f37d54..ccf56cc5d3 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Question Answering DataPreProcess description: Component to preprocess data for question answering task. See [docs](https://aka.ms/azureml/components/question_answering_datapreprocess) to learn more. -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/preprocess 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 42a83a0a97..eeb1772a5b 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Summarization DataPreProcess description: Component to preprocess data for summarization task. See [docs](https://aka.ms/azureml/components/summarization_datapreprocess) to learn more. -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/preprocess 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 adc4a06be7..ab49e1ed5e 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Text Classification DataPreProcess description: Component to preprocess data for single label classification task. See [docs](https://aka.ms/azureml/components/text_classification_datapreprocess) to learn more. -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/preprocess 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 1bc8ada5d7..891fd38b9b 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Text Generation DataPreProcess description: Component to preprocess data for text generation task -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/preprocess 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 7a195e7016..fdbc16124f 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Token Classification DataPreProcess description: Component to preprocess data for token classification task. See [docs](https://aka.ms/azureml/components/token_classification_datapreprocess) to learn more. -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/preprocess 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 463e27bbe6..2ba450fdc4 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Translation DataPreProcess description: Component to preprocess data for translation task. See [docs](https://aka.ms/azureml/components/translation_datapreprocess) to learn more. -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/preprocess 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 cfb8eecdb5..3af495bc9b 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.59 +version: 0.0.61 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: Common Validation Component description: Component to validate the finetune job against Validation Service -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 code: ../../../src/validation diff --git a/assets/training/finetune_acft_hf_nlp/components_v2/data_import/common/spec.yaml b/assets/training/finetune_acft_hf_nlp/components_v2/data_import/common/spec.yaml index 6904a7ebb6..a89640bb27 100644 --- a/assets/training/finetune_acft_hf_nlp/components_v2/data_import/common/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components_v2/data_import/common/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: oss_text_generation_data_import -version: 0.0.22 +version: 0.0.23 type: command is_deterministic: True diff --git a/assets/training/finetune_acft_hf_nlp/components_v2/finetune/chat_completion/spec.yaml b/assets/training/finetune_acft_hf_nlp/components_v2/finetune/chat_completion/spec.yaml index 75e2e8d9a3..1f5d54ee2a 100644 --- a/assets/training/finetune_acft_hf_nlp/components_v2/finetune/chat_completion/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components_v2/finetune/chat_completion/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: oss_chat_completion_finetune -version: 0.0.22 +version: 0.0.23 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: OSS Chat Completion Finetune description: FTaaS component to finetune model for Chat Completion task -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 inputs: task_name: diff --git a/assets/training/finetune_acft_hf_nlp/components_v2/finetune/text_generation/spec.yaml b/assets/training/finetune_acft_hf_nlp/components_v2/finetune/text_generation/spec.yaml index 22849947e8..5b4fea6731 100644 --- a/assets/training/finetune_acft_hf_nlp/components_v2/finetune/text_generation/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components_v2/finetune/text_generation/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json name: oss_text_generation_finetune -version: 0.0.22 +version: 0.0.23 type: command is_deterministic: True @@ -8,7 +8,7 @@ is_deterministic: True display_name: OSS Text Generation Finetune description: FTaaS component to finetune model for Text Generation task -environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/72 +environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/73 inputs: task_name: diff --git a/assets/training/finetune_acft_hf_nlp/components_v2/pipeline_components/chat_completion/spec.yaml b/assets/training/finetune_acft_hf_nlp/components_v2/pipeline_components/chat_completion/spec.yaml index b69e8f93ca..725fbccfe4 100644 --- a/assets/training/finetune_acft_hf_nlp/components_v2/pipeline_components/chat_completion/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components_v2/pipeline_components/chat_completion/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/pipelineComponent.schema.json name: oss_chat_completion_pipeline -version: 0.0.22 +version: 0.0.23 type: pipeline display_name: OSS Chat Completion Pipeline description: FTaaS Pipeline component for chat completion @@ -123,7 +123,7 @@ outputs: jobs: oss_text_generation_data_import: type: command - component: azureml:oss_text_generation_data_import:0.0.22 + component: azureml:oss_text_generation_data_import:0.0.23 compute: '${{parent.inputs.compute_data_import}}' resources: instance_type: '${{parent.inputs.instance_type_data_import}}' @@ -142,7 +142,7 @@ jobs: user_column_names: 'messages' oss_chat_completion_finetune: type: command - component: azureml:oss_chat_completion_finetune:0.0.22 + component: azureml:oss_chat_completion_finetune:0.0.23 compute: '${{parent.inputs.compute_finetune}}' resources: instance_type: '${{parent.inputs.instance_type_finetune}}' diff --git a/assets/training/finetune_acft_hf_nlp/components_v2/pipeline_components/text_generation/spec.yaml b/assets/training/finetune_acft_hf_nlp/components_v2/pipeline_components/text_generation/spec.yaml index 7f504ff041..ef553cc974 100644 --- a/assets/training/finetune_acft_hf_nlp/components_v2/pipeline_components/text_generation/spec.yaml +++ b/assets/training/finetune_acft_hf_nlp/components_v2/pipeline_components/text_generation/spec.yaml @@ -1,6 +1,6 @@ $schema: https://azuremlschemas.azureedge.net/latest/pipelineComponent.schema.json name: oss_text_generation_pipeline -version: 0.0.22 +version: 0.0.23 type: pipeline display_name: OSS Text Generation Pipeline description: FTaaS Pipeline component for text generation @@ -138,7 +138,7 @@ outputs: jobs: oss_text_generation_data_import: type: command - component: azureml:oss_text_generation_data_import:0.0.22 + component: azureml:oss_text_generation_data_import:0.0.23 compute: '${{parent.inputs.compute_data_import}}' resources: instance_type: '${{parent.inputs.instance_type_data_import}}' @@ -157,7 +157,7 @@ jobs: user_column_names: '${{parent.inputs.text_key}},${{parent.inputs.ground_truth_key}}' oss_text_generation_finetune: type: command - component: azureml:oss_text_generation_finetune:0.0.22 + component: azureml:oss_text_generation_finetune:0.0.23 compute: '${{parent.inputs.compute_finetune}}' resources: instance_type: '${{parent.inputs.instance_type_finetune}}' diff --git a/assets/training/model_evaluation/src/image_dataset.py b/assets/training/model_evaluation/src/image_dataset.py index ed15fc5aa9..aae8b6ac7d 100644 --- a/assets/training/model_evaluation/src/image_dataset.py +++ b/assets/training/model_evaluation/src/image_dataset.py @@ -193,15 +193,20 @@ def get_classification_dataset( # labels: {test_dataset_wrapper.num_classes}" ) - df = pd.DataFrame(columns=input_column_names + [label_column_name]) + # Initialize the rows of the output dataframe to the empty list. + frame_rows = [] + for index in range(len(test_dataset_wrapper)): image_path = test_dataset_wrapper.get_image_full_path(index) if is_valid_image(image_path): # sending image_paths instead of base64 encoded string as oss flavor doesnt take bytes as input. - df = df.append({ + frame_rows.append({ input_column_names[0]: image_path, label_column_name: test_dataset_wrapper.label_at_index(index) - }, ignore_index=True) + }) + + # Make the output dataframe. + df = pd.DataFrame(data=frame_rows, columns=input_column_names + [label_column_name]) return df @@ -253,7 +258,9 @@ def get_object_detection_dataset( f"# test images: {len(test_dataset)}, # labels: {test_dataset.num_classes}" ) test_dataset_wrapper = RuntimeDetectionDatasetAdapter(test_dataset) - df = pd.DataFrame(columns=input_column_names + [label_column_name]) + + # Initialize the rows of the output dataframe to the empty list. + frame_rows = [] counter = 0 for index in range(len(test_dataset_wrapper)): @@ -262,12 +269,15 @@ def get_object_detection_dataset( if is_valid_image(image_path): counter += 1 - df = df.append({ + frame_rows.append({ input_column_names[0]: base64.encodebytes(read_image(image_path)).decode("utf-8"), input_column_names[1]: image_meta_info, input_column_names[2]: ". ".join(test_dataset.classes), label_column_name: label, - }, ignore_index=True) + }) + + # Make the output dataframe. + df = pd.DataFrame(data=frame_rows, columns=input_column_names + [label_column_name]) logger.info(f"Total number of valid images: {counter}") return df @@ -300,8 +310,8 @@ def get_generation_dataset( mltable = load(mltable_path) mltable_dataframe = mltable.to_pandas_dataframe() - # Initialize the output dataframe with the input and label columns. - df = pd.DataFrame(columns=input_column_names + [label_column_name]) + # Initialize the rows of the output dataframe to the empty list. + frame_rows = [] # Go through all (image_url, captions) pairs and make a (prompt, image_url) from each pair. The model will generate # a synthetic image from the prompt and the set of synthetic images will be compared with the set of original ones. @@ -310,16 +320,18 @@ def get_generation_dataset( ): # Go through all captions (split according to special separator). for caption in captions.split(GenerationLiterals.CAPTION_SEPARATOR): - df = df.append( + frame_rows.append( { # The model input is a text prompt. input_column_names[0]: caption, # The original image is passed through via the label column. label_column_name: image_url, - }, - ignore_index=True + } ) + # Make the output dataframe. + df = pd.DataFrame(data=frame_rows, columns=input_column_names + [label_column_name]) + return df diff --git a/assets/training/model_evaluation/tests/__init__.py b/assets/training/model_evaluation/tests/__init__.py new file mode 100644 index 0000000000..8cbdb5039f --- /dev/null +++ b/assets/training/model_evaluation/tests/__init__.py @@ -0,0 +1,4 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +"""Init file.""" diff --git a/assets/training/model_evaluation/tests/test_image_dataset.py b/assets/training/model_evaluation/tests/test_image_dataset.py new file mode 100644 index 0000000000..6a43c23a1f --- /dev/null +++ b/assets/training/model_evaluation/tests/test_image_dataset.py @@ -0,0 +1,190 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +"""Test image dataset implementations.""" + +import json +import os +import pytest +import sys +import tempfile + +from unittest.mock import patch + +from azureml.acft.common_components.image.runtime_common.common.dataset_helper import AmlDatasetHelper + +MODEL_DIR = os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)), "./src")) +sys.path.append(MODEL_DIR) +from constants import TASK # noqa: E402 +from image_dataset import get_image_dataset # noqa: E402 + + +DATASET_PER_TASK = { + TASK.IMAGE_CLASSIFICATION: [ + {"image_url": "AmlDatastore://images/a/image1.jpg", "label": 0}, + {"image_url": "AmlDatastore://images/a/image2.jpg", "label": 1}, + ], + TASK.IMAGE_OBJECT_DETECTION: [ + { + "image_url": "AmlDatastore://images/b/image1.png", + "label": [{"label": 0, "topX": 0.0, "topY": 0.0, "bottomX": 0.5, "bottomY": 0.5}], + }, + { + "image_url": "AmlDatastore://images/b/image2.png", + "label": [{"label": 1, "topX": 0.5, "topY": 0.5, "bottomX": 1.0, "bottomY": 1.0}], + }, + ], + TASK.IMAGE_GENERATION: [ + {"image_url": "example.com/image1.png", "label": "an example"}, + {"image_url": "example.com/image2.png", "label": "another example"}, + ], +} +MLTABLE_CONTENTS_PER_TASK = { + TASK.IMAGE_CLASSIFICATION: ( + "paths:\n" + " - file: {file_name}\n" + "transformations:\n" + " - read_json_lines:\n" + " encoding: utf8\n" + " invalid_lines: error\n" + " include_path_column: false\n" + " - convert_column_types:\n" + " - columns: image_url\n" + " column_type: stream_info\n" + "type: mltable\n" + ), + TASK.IMAGE_OBJECT_DETECTION: ( + "paths:\n" + " - file: {file_name}\n" + "transformations:\n" + " - read_json_lines:\n" + " encoding: utf8\n" + " invalid_lines: error\n" + " include_path_column: false\n" + " - convert_column_types:\n" + " - columns: image_url\n" + " column_type: stream_info\n" + "type: mltable\n" + ), + TASK.IMAGE_GENERATION: ( + "paths:\n" + "- file: {file_name}\n" + "transformations:\n" + "- read_json_lines:\n" + " encoding: utf8\n" + " include_path_column: false\n" + " invalid_lines: error\n" + " partition_size: 20971520\n" + " path_column: Path\n" + "- convert_column_types:\n" + " - column_type: stream_info\n" + " columns: image_url\n" + "type: mltable\n" + ), +} + + +class MockWorkspace: + """Mock workspace.""" + + def __init__(self, subscription_id, resource_group, workspace_name, location, workspace_id): + """Make mock workspace.""" + self.subscription_id = subscription_id + self.resource_group = resource_group + self._workspace_name = workspace_name + self.location = location + self._workspace_id_internal = workspace_id + self.name = workspace_name + + +class MockExperiment: + """Mock experiment.""" + + def __init__(self, workspace, id): + """Make mock experiment.""" + self.workspace = workspace + self.id = id + + +class MockRun: + """Mock run.""" + + def __init__(self, id): + """Make mock run.""" + self.id = id + + +class MockRunContext: + """Mock run context.""" + + def __init__(self, experiment, run_id, parent_run_id): + """Make mock run context.""" + self.experiment = experiment + self._run_id = run_id + self.id = run_id + self.parent = MockRun(parent_run_id) + + +def get_mock_run_context(): + """Make mock run context.""" + TEST_EXPERIMENT_ID = "22222222-2222-2222-2222-222222222222" + TEST_REGION = "eastus" + TEST_PARENT_RUN_ID = "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb" + TEST_RESOURCE_GROUP = "testrg" + TEST_RUN_ID = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" + TEST_SUBSCRIPTION_ID = "00000000-0000-0000-0000-000000000000" + TEST_WORKSPACE_ID = "11111111-1111-1111-111111111111" + TEST_WORKSPACE_NAME = "testws" + + ws = MockWorkspace( + subscription_id=TEST_SUBSCRIPTION_ID, + resource_group=TEST_RESOURCE_GROUP, + workspace_name=TEST_WORKSPACE_NAME, + location=TEST_REGION, + workspace_id=TEST_WORKSPACE_ID, + ) + experiment = MockExperiment(workspace=ws, id=TEST_EXPERIMENT_ID) + return MockRunContext(experiment, run_id=TEST_RUN_ID, parent_run_id=TEST_PARENT_RUN_ID) + + +@pytest.mark.parametrize("task_type,input_column_names,label_column_name", [ + (TASK.IMAGE_CLASSIFICATION, ["image_url"], "label"), + (TASK.IMAGE_OBJECT_DETECTION, ["image_url"], "label"), + (TASK.IMAGE_GENERATION, ["prompt"], "label"), +]) +def test_image_dataset(task_type, input_column_names, label_column_name): + """Test image dataset on small example.""" + with tempfile.TemporaryDirectory() as directory_name: + # Save the jsonl file. + dataset = DATASET_PER_TASK[task_type] + with open(os.path.join(directory_name, "dataset.jsonl"), "wt") as f: + for r in dataset: + f.write(json.dumps(r) + "\n") + + # Save the MLTable file. + mltable_str = MLTABLE_CONTENTS_PER_TASK[task_type].format(file_name="dataset.jsonl") + with open(os.path.join(directory_name, "MLTable"), "wt") as f: + f.write(mltable_str) + + # Make blank image files for image classification and object detection tasks, to simulate downloading. + if task_type in [TASK.IMAGE_CLASSIFICATION, TASK.IMAGE_OBJECT_DETECTION]: + for r in dataset: + image_file_name_tokens = r["image_url"].replace("AmlDatastore://", "").split("/") + os.makedirs(os.path.join(directory_name, *image_file_name_tokens[:-1]), exist_ok=True) + open(os.path.join(directory_name, *image_file_name_tokens), "wb").close() + + # Load the MLTable. + with patch("azureml.core.Run.get_context", get_mock_run_context), \ + patch( + "azureml.acft.common_components.image.runtime_common.common.utils.download_or_mount_image_files" + ), \ + patch.object(AmlDatasetHelper, "get_data_dir", return_value=directory_name): + df = get_image_dataset(task_type, directory_name, input_column_names, label_column_name) + + # Compare the loaded dataset with the original. + if task_type == TASK.IMAGE_GENERATION: + loaded_dataset = [{k: row[k] for k in ["prompt", "label"]} for _, row in df.iterrows()] + for r1, r2 in zip( + sorted(dataset, key=lambda x: x["label"]), sorted(loaded_dataset, key=lambda x: x["prompt"]) + ): + assert r2 == {"prompt": r1["label"], "label": r1["image_url"]}