aixplain.modules.finetune
__author__
Copyright 2022 The aiXplain SDK authors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Author: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli Date: June 14th 2023 Description: FineTune Class
Finetune Objects
class Finetune(Asset)
A tool for fine-tuning machine learning models using custom datasets.
This class provides functionality to customize pre-trained models for specific tasks by fine-tuning them on user-provided datasets. It handles the configuration of training parameters, data splitting, and job execution.
Attributes:
name
Text - Name of the fine-tuning job.dataset_list
List[Dataset] - List of datasets to use for fine-tuning.model
Model - The base model to be fine-tuned.cost
FinetuneCost - Cost information for the fine-tuning job.id
Text - ID of the fine-tuning job.description
Text - Detailed description of the fine-tuning purpose.supplier
Text - Provider/creator of the fine-tuned model.version
Text - Version identifier of the fine-tuning job.train_percentage
float - Percentage of data to use for training.dev_percentage
float - Percentage of data to use for validation.dataset_list
0 Text - Template for formatting training examples, using <<COLUMN_NAME>> to reference dataset columns.dataset_list
1 Hyperparameters - Configuration for the fine-tuning process.dataset_list
2 dict - Extra metadata for the fine-tuning job.dataset_list
3 str - URL endpoint for the backend API.dataset_list
4 str - Authentication key for API access.dataset_list
5 str - aiXplain-specific API key.
__init__
def __init__(name: Text,
dataset_list: List[Dataset],
model: Model,
cost: FinetuneCost,
id: Optional[Text] = "",
description: Optional[Text] = "",
supplier: Optional[Text] = "aiXplain",
version: Optional[Text] = "1.0",
train_percentage: Optional[float] = 100,
dev_percentage: Optional[float] = 0,
prompt_template: Optional[Text] = None,
hyperparameters: Optional[Hyperparameters] = None,
**additional_info) -> None
Initialize a new Finetune instance.
Arguments:
name
Text - Name of the fine-tuning job.dataset_list
List[Dataset] - List of datasets to use for fine-tuning.model
Model - The base model to be fine-tuned.cost
FinetuneCost - Cost information for the fine-tuning job.id
Text, optional - ID of the job. Defaults to "".description
Text, optional - Detailed description of the fine-tuning purpose. Defaults to "".supplier
Text, optional - Provider/creator of the fine-tuned model. Defaults to "aiXplain".version
Text, optional - Version identifier. Defaults to "1.0".train_percentage
float, optional - Percentage of data to use for training. Defaults to 100.dev_percentage
float, optional - Percentage of data to use for validation. Defaults to 0.dataset_list
0 Text, optional - Template for formatting training examples. Use <<COLUMN_NAME>> to reference dataset columns. Defaults to None.dataset_list
1 Hyperparameters, optional - Configuration for the fine-tuning process. Defaults to None.dataset_list
2 - Extra metadata for the fine-tuning job.
start
def start() -> Model
Start the fine-tuning job on the backend.
This method submits the fine-tuning configuration to the backend and initiates the training process. It handles the creation of the training payload, including dataset splits and hyperparameters.
Returns:
Model
- The model object representing the fine-tuning job. Returns None if the job submission fails.
Raises:
Exception
- If there are errors in the API request or response handling.