-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 Text-Generation/Chat MaaP FineTuning sample #3459
Open
sagarsumant
wants to merge
7
commits into
main
Choose a base branch
from
sasum/maap-text-gen-sample
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
627404e
Add Text-Generation MaaP FineTuning sample
75c75df
Merge branch 'main' into sasum/maap-text-gen-sample
sagarsumant 53e824b
Add chat sample notebook for maap
ddd1adb
Merge branch 'main' of https://github.com/Azure/azureml-examples into…
720f8b7
Merge branch 'sasum/maap-text-gen-sample' of https://github.com/Azure…
6c8dcae
Add CLI samples
703c293
Add missing file
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
sdk/python/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,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: | ||
|
||
```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 hyperdrive-service-static-rg --workspace-name train-finetune-dev-eastus --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 hyperdrive-service-static-rg: Specifies the Azure resource group. | ||
* --workspace-name train-finetune-dev-eastus: Specifies the Azure Machine Learning workspace. | ||
* --name "ft-maap-llama3-instance-types-1209-01": Specifies the name of the job. | ||
|
||
Sample Yaml file for generating FineTuningJob using azureml CLIV2 | ||
|
||
**Text Generation FineTuning** | ||
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** | ||
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) |
27 changes: 27 additions & 0 deletions
27
...finetuning/standalone/model-as-a-platform/chat/chat-completion-finetuning-amlcompute.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,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 |
32 changes: 32 additions & 0 deletions
32
...tuning/standalone/model-as-a-platform/chat/chat-completion-finetuning-instance-types.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,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 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider using instead of hardcoded values for rg, ws etc.