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:
nameText - Name of the fine-tuning job.dataset_listList[Dataset] - List of datasets to use for fine-tuning.modelModel - The base model to be fine-tuned.costFinetuneCost - Cost information for the fine-tuning job.idText - ID of the fine-tuning job.descriptionText - Detailed description of the fine-tuning purpose.supplierText - Provider/creator of the fine-tuned model.versionText - Version identifier of the fine-tuning job.train_percentagefloat - Percentage of data to use for training.dev_percentagefloat - Percentage of data to use for validation.dataset_list0 Text - Template for formatting training examples, using <<COLUMN_NAME>> to reference dataset columns.dataset_list1 Hyperparameters - Configuration for the fine-tuning process.dataset_list2 dict - Extra metadata for the fine-tuning job.dataset_list3 str - URL endpoint for the backend API.dataset_list4 str - Authentication key for API access.dataset_list5 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:
nameText - Name of the fine-tuning job.dataset_listList[Dataset] - List of datasets to use for fine-tuning.modelModel - The base model to be fine-tuned.costFinetuneCost - Cost information for the fine-tuning job.idText, optional - ID of the job. Defaults to "".descriptionText, optional - Detailed description of the fine-tuning purpose. Defaults to "".supplierText, optional - Provider/creator of the fine-tuned model. Defaults to "aiXplain".versionText, optional - Version identifier. Defaults to "1.0".train_percentagefloat, optional - Percentage of data to use for training. Defaults to 100.dev_percentagefloat, optional - Percentage of data to use for validation. Defaults to 0.dataset_list0 Text, optional - Template for formatting training examples. Use <<COLUMN_NAME>> to reference dataset columns. Defaults to None.dataset_list1 Hyperparameters, optional - Configuration for the fine-tuning process. Defaults to None.dataset_list2 - 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.