-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Chat-Completion/Text-Generation MaaS FineTuning Samples. (#3480)
* Add MaaS finetuning samples. * Fix black formatter thing * Fix comments. * Update code owners. * Fix. --------- Co-authored-by: Sagar Sumant <[email protected]>
- Loading branch information
1 parent
3c78089
commit 00f576d
Showing
16 changed files
with
2,209 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
cli/jobs/finetuning/standalone/finetuning-job-cliv2-readme.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Running a Fine-Tuning Job from CLI | ||
|
||
This guide provides instructions on how to run a fine-tuning job using the Azure Machine Learning CLI v2. | ||
|
||
## Prerequisites | ||
|
||
1. **Azure CLI**: Ensure you have the Azure CLI installed. If not, you can install it from [here](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli). | ||
|
||
2. **Azure Machine Learning CLI v2**: Install the Azure Machine Learning CLI extension v2. | ||
```bash | ||
az extension add -n ml -y | ||
``` | ||
|
||
3. **Azure Subscription**: Ensure you have an active Azure subscription and the necessary permissions to create and manage resources. | ||
|
||
4. **Resource Group and Workspace**: Ensure you have an Azure resource group and an Azure Machine Learning workspace. If not, you can create them using the following commands: | ||
|
||
```bash | ||
az group create --name <resource-group-name> --location <location> | ||
az ml workspace create --name <workspace-name> --resource-group <resource-group-name> --location <location> | ||
``` | ||
|
||
**Note**: MaaS finetuning is supported in following regions due to capacity constraints. | ||
* Llama models can only be finetuned in westus3 region. | ||
* All other models which support MaaS Finetuning can be finetuned in eastus2 region | ||
|
||
### Running the Fine-Tuning Job | ||
To run the fine-tuning job, use the following command: | ||
|
||
```bash | ||
az ml job create --file text-generation-finetuning-amlcompute.yaml --resource-group <<resource-group-name>> --workspace-name <<azureml-workspace-or-project-name>> --name "ft-maap-llama3-instance-types-1209-01" | ||
``` | ||
#### Command Breakdown | ||
* az ml job create: Command to create and run a job in Azure Machine Learning. | ||
* --file text-generation-finetuning-amlcompute.yaml: Specifies the YAML file that defines the job configuration. | ||
* --resource-group <<resource-group-name>>: Specifies the Azure resource group. | ||
* --workspace-name <<azureml-workspace-or-project-name>>: Specifies the Azure Machine Learning workspace. | ||
* --name "ft-maap-llama3-instance-types-1209-01": Specifies the name of the job. | ||
##### InputData | ||
Each sample has input data files provided. | ||
* train.jsonl - This contains training data. | ||
* validation.jsonl - This contains validation data. | ||
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) | ||
**ChatCompletion FineTuning (Model-As-A-Service)** | ||
1. [finetuning-with-amlcompute](./model-as-a-service/chat-completion/chat-completion-finetuning.yaml) | ||
26 changes: 26 additions & 0 deletions
26
.../finetuning/standalone/model-as-a-service/chat-completion/chat-completion-finetuning.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
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 | ||
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 |
2 changes: 2 additions & 0 deletions
2
cli/jobs/finetuning/standalone/model-as-a-service/chat-completion/readme.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
79 changes: 79 additions & 0 deletions
79
cli/jobs/finetuning/standalone/model-as-a-service/chat-completion/train.jsonl
Large diffs are not rendered by default.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
cli/jobs/finetuning/standalone/model-as-a-service/chat-completion/validation.jsonl
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
cli/jobs/finetuning/standalone/model-as-a-service/text-generation/readme.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
26 changes: 26 additions & 0 deletions
26
.../finetuning/standalone/model-as-a-service/text-generation/text-generation-finetuning.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
type: finetuning | ||
|
||
name: "llama-3-8B-with-compute" | ||
experiment_name: "llama-3-8B-finetuning-experiment" | ||
display_name: "llama3-8B-display-name" | ||
task: text_completion | ||
model_provider: custom | ||
model: | ||
path: "azureml://registries/azureml-meta/models/Meta-Llama-3-8B/versions/8" | ||
type: mlflow_model | ||
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: "llama-3-8B-finetuned-model" | ||
type: mlflow_model |
Oops, something went wrong.