Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Chat-Completion/Text-Generation MaaS FineTuning Samples. #3480

Merged
merged 5 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions cli/jobs/finetuning/standalone/finetuning-job-cliv2-readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 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:
sagarsumant marked this conversation as resolved.
Show resolved Hide resolved

```bash
az group create --name <resource-group-name> --location <location>
az ml workspace create --name <workspace-name> --resource-group <resource-group-name> --location <location>
```

### 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.

sagarsumant marked this conversation as resolved.
Show resolved Hide resolved
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)


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
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)

Large diffs are not rendered by default.

Large diffs are not rendered by default.

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)
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

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Loading