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

Adding text-generation model converter #3181

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Common Model Converter

### Name

ft_nlp_model_converter

### Version

0.0.17

### Type

command

### Description

Component to convert the finetune job output to pytorch and mlflow model

## Inputs

| Name | Description | Type | Default | Optional | Enum |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ---------- | -------- | ---- |
| model_path | Pytorch model asset path. Pass the finetune job pytorch model output. | uri_folder | - | False | NA |
| converted_model | Exisiting converted MlFlow path. Pass the finetune job mlflow model output. | mlflow_model | - | True | NA |

## Outputs

| Name | Description | Type |
| --------------- | ------------------ | -------- |
| output_dir | Output folder containing _best_ finetuned model in mlflow format. | mlflow_model |
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type: component
spec: spec.yaml
categories: ["Foundational Models", "Finetune"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
$schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json
name: text_generation_model_converter
version: 0.0.52
type: command

is_deterministic: True

display_name: Text Generation Model Converter
description: Component to convert the text generation finetune job output from pytorch to mlflow model

environment: azureml://registries/azureml/environments/acft-hf-nlp-gpu/versions/63

code: ../../../src/model_converter

inputs:
model_path:
type: uri_folder
optional: false
description: Pytorch model asset path. Pass the finetune job pytorch model output.
mode: rw_mount

# Validation parameters
system_properties:
type: string
optional: true
description: Validation parameters propagated from pipeline.

outputs:
mlflow_model_folder:
type: mlflow_model
description: Output folder containing _best_ finetuned model in mlflow format.
mode: rw_mount

command: >-
python model_converter.py --model_path '${{inputs.model_path}}' $[[--system_properties '${{inputs.system_properties}}']] --output_dir '${{outputs.mlflow_model_folder}}'
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,9 @@ jobs:
system_properties: '${{parent.inputs.system_properties}}'
outputs:
pytorch_model_folder: '${{parent.outputs.pytorch_model_folder}}'
ft_nlp_model_converter:
text_generation_model_converter:
type: command
component: azureml:ft_nlp_model_converter:0.0.52
component: azureml:text_generation_model_converter:0.0.52
compute: '${{parent.inputs.compute_finetune}}'
resources:
instance_type: '${{parent.inputs.instance_type_finetune}}'
Expand All @@ -678,7 +678,7 @@ jobs:
input_column_names: '${{parent.inputs.text_key}}'
batch_size: '${{parent.inputs.per_device_train_batch_size}}'
device: auto
mlflow_model: '${{parent.jobs.ft_nlp_model_converter.outputs.mlflow_model_folder}}'
mlflow_model: '${{parent.jobs.text_generation_model_converter.outputs.mlflow_model_folder}}'
evaluation_config: '${{parent.inputs.evaluation_config}}'
evaluation_config_params: '${{parent.inputs.evaluation_config_params}}'
compute_metrics:
Expand Down
Loading