Skip to content

Commit

Permalink
Add Text-Generation/Chat MaaP FineTuning sample (#3459)
Browse files Browse the repository at this point in the history
* Add Text-Generation MaaP FineTuning sample

* Add chat sample notebook for maap

* Add CLI samples

* Add missing file

* Fix comments and use the released sdk.

* Corrections.

* Fix black formatter issue.

* Minor changes.

---------

Co-authored-by: Sagar Sumant <sasum@microsoft.com>
  • Loading branch information
sagarsumant and Sagar Sumant authored Jan 10, 2025
1 parent a7da589 commit 05dcd4c
Show file tree
Hide file tree
Showing 19 changed files with 2,316 additions and 4 deletions.
4 changes: 4 additions & 0 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ path|status|description
[jobs/parallel/1a_oj_sales_prediction/pipeline.yml](jobs/parallel/1a_oj_sales_prediction/pipeline.yml)|[![jobs/parallel/1a_oj_sales_prediction/pipeline](https://github.com/Azure/azureml-examples/workflows/cli-jobs-parallel-1a_oj_sales_prediction-pipeline/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-parallel-1a_oj_sales_prediction-pipeline.yml)|The hello world pipeline job with partition by key
[jobs/parallel/2a_iris_batch_prediction/pipeline.yml](jobs/parallel/2a_iris_batch_prediction/pipeline.yml)|[![jobs/parallel/2a_iris_batch_prediction/pipeline](https://github.com/Azure/azureml-examples/workflows/cli-jobs-parallel-2a_iris_batch_prediction-pipeline/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-parallel-2a_iris_batch_prediction-pipeline.yml)|The hello world pipeline job with inline parallel job
[jobs/parallel/3a_mnist_batch_identification/pipeline.yml](jobs/parallel/3a_mnist_batch_identification/pipeline.yml)|[![jobs/parallel/3a_mnist_batch_identification/pipeline](https://github.com/Azure/azureml-examples/workflows/cli-jobs-parallel-3a_mnist_batch_identification-pipeline/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-parallel-3a_mnist_batch_identification-pipeline.yml)|The hello world pipeline job with inline parallel job
[finetuning-model-as-a-service-chat-completion](jobs/finetuning/standalone/model-as-a-service/chat-completion/chat-completion-finetuning.yaml)|[![finetuning-model-as-a-service-chat-completion](https://github.com/Azure/azureml-examples/workflows/cli-jobs-finetuning-standalone-model-as-a-service-chat-completion/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-finetuning-standalone-model-as-a-service-chat-completion.yml)|No description
[finetuning-model-as-a-service-text-generation](jobs/finetuning/standalone/model-as-a-service/text-generation/text-generation-finetuning.yaml)|[![finetuning-model-as-a-service-text-generation](https://github.com/Azure/azureml-examples/workflows/cli-jobs-finetuning-standalone-model-as-a-service-text-generation/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-finetuning-standalone-model-as-a-service-text-generation.yml)|No description
[finetuning-model-as-a-platform-chat-completion](jobs/finetuning/standalone/model-as-a-service/chat-completion/chat-completion-finetuning.yaml)|[![finetuning-model-as-a-platform-chat-completion](https://github.com/Azure/azureml-examples/workflows/cli-jobs-finetuning-standalone-model-as-a-platform-chat-completion/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-finetuning-standalone-model-as-a-platform-chat-completion.yml)|No description
[finetuning-model-as-a-platform-text-generation](jobs/finetuning/standalone/model-as-a-service/text-generation/text-generation-finetuning.yaml)|[![finetuning-model-as-a-platform-text-generation](https://github.com/Azure/azureml-examples/workflows/cli-jobs-finetuning-standalone-model-as-a-platform-text-generation/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-finetuning-standalone-model-as-a-platform-text-generation.yml)|No description
[cli\foundation-models\azure_openai\oai-v1\openai_completions_finetune\openai_completions_finetune_spec.yaml](cli\foundation-models\azure_openai\oai-v1\openai_completions_finetune\openai_completions_finetune_spec.yaml)|[![cli\foundation-models\azure_openai\oai-v1\openai_completions_finetune\openai_completions_finetune_spec.yaml](https://github.com/Azure/azureml-examples/workflows/cli-foundation-models-azure_openai-oai-v1-openai_completions_finetune.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-foundation-models-azure_openai-oai-v1-openai_completions_finetune.yml)|The hello world pipeline job with inline parallel job
[cli\foundation-models\azure_openai\oai-v2\openai_completions_finetune_pipeline\openai_completions_finetune_pipeline_spec.yaml](cli\foundation-models\azure_openai\oai-v2\openai_completions_finetune_pipeline\openai_completions_finetune_pipeline_spec.yaml)|[![cli\foundation-models\azure_openai\oai-v2\openai_completions_finetune_pipeline\openai_completions_finetune_pipeline_spec.yaml](https://github.com/Azure/azureml-examples/workflows/cli-foundation-models-azure_openai-oai-v2-openai_completions_finetune.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-foundation-models-azure_openai-oai-v2-openai_completions_finetune.yml)|The hello world pipeline job with inline parallel job

Expand Down
14 changes: 10 additions & 4 deletions cli/jobs/finetuning/standalone/finetuning-job-cliv2-readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,16 @@ Note that these files are for demo purposes only.
Sample Yaml file for generating FineTuningJob using azureml CLIV2
**Text Generation FineTuning (Model-As-A-Service)**
1. [finetuning-with-amlcompute](./model-as-a-service/text-generation/text-generation-finetuning.yaml)
**Text Generation FineTuning (Model-As-A-Platform)**
1. [finetuning-with-amlcompute](./model-as-a-platform/text-generation/text-generation-finetuning-amlcompute.yaml)
2. [finetuning-with-instance-types](./model-as-a-platform/text-generation/text-generation-finetuning-instance-types.yaml)
**ChatCompletion FineTuning (Model-As-A-Service)**
1. [finetuning-with-amlcompute](./model-as-a-service/chat-completion/chat-completion-finetuning.yaml)
**ChatCompletion FineTuning (Model-As-A-Platform)**
1. [finetuning-with-amlcompute](./model-as-a-platform/chat/chat-completion-finetuning-amlcompute.yaml)
2. [finetuning-with-instance-types](./model-as-a-platform/chat/chat-completion-finetuning-instance-types.yaml)
**Text Generation FineTuning (Model-As-A-Service)**
1. [finetuning](./model-as-a-service/text-generation/text-generation-finetuning.yaml)
**ChatCompletion FineTuning (Model-As-A-Service)**
1. [finetuning](./model-as-a-service/chat-completion/chat-completion-finetuning.yaml)
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
type: finetuning

name: "Phi-3-mini-4k-instruct-with-amlcompute"
experiment_name: "Phi-3-mini-4k-instruct-finetuning-experiment"
display_name: "Phi-3-mini-4k-instruct-display-name"
task: chat_completion
model_provider: custom
model:
path: "azureml://registries/azureml/models/Phi-3-mini-4k-instruct/versions/14"
type: mlflow_model
compute: "lowpri-a100"
training_data: train.jsonl
validation_data:
path: validation.jsonl
type: uri_file
hyperparameters:
num_train_epochs: "1"
per_device_train_batch_size: "1"
learning_rate: "0.00002"
properties:
my_property: "my_value"
tags:
foo_tag: "bar"
outputs:
registered_model:
name: "Phi-3-mini-4k-instruct-finetuned-model"
type: mlflow_model
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
type: finetuning

name: "Phi-3-mini-4k-instruct-with-instance-types"
experiment_name: "Phi-3-mini-4k-instruct-finetuning-experiment-instance-types"
display_name: "Phi-3-mini-4k-instruct-display-name"
task: chat_completion
model_provider: custom
model:
path: "azureml://registries/azureml/models/Phi-3-mini-4k-instruct/versions/14"
type: mlflow_model
resources:
instance_types:
# You can specify multiple instance types for the training job
# Backend will decide which instance type to use based on the constraints on training job.
- "Standard_NC96ads_A100_v4"
- "Standard_E4s_v3"
training_data: train.jsonl
validation_data:
path: validation.jsonl
type: uri_file
hyperparameters:
num_train_epochs: "1"
per_device_train_batch_size: "1"
learning_rate: "0.00002"
properties:
my_property: "my_value"
tags:
foo_tag: "bar"
outputs:
registered_model:
name: "Phi-3-mini-4k-instruct-finetuned-model"
type: mlflow_model
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## How to run FineTuningJob using AzureML CLIV2?
[Running FineTuningJob Using AzureML CLIV2](../../finetuning-job-cliv2-readme.md)
Loading

0 comments on commit 05dcd4c

Please sign in to comment.