MENU
      Create training
        • PDF

        Create training

        • PDF

        Article summary

        Available in Classic and VPC

        Create a training. After the training you created is complete, you can call Chat Completions API or Completions API to generate interactive sentences to see the answers CLOVA Studio generated.

        Request

        This section describes the request format. The method and URI are as follows:

        MethodURI
        POST/tuning/v2/tasks

        Request headers

        The following describes the request headers.

        FieldRequiredDescription
        AuthorizationRequiredAPI key for authentication <e.g.,> Bearer nv-************
        X-NCP-CLOVASTUDIO-REQUEST-IDOptionalRequest ID for the request
        Content-TypeRequiredRequest data format
        • multipart/form-data

        Request body

        You can include the following data in the body of your request:

        FieldTypeRequiredDescription
        nameStringOptionalTraining name
        • Auto-generate with training creation date if not entered
        modelStringRequiredModel name to use for tuning
        tuningTypeStringOptionalTuning method
        • PEFT (default)
        taskTypeStringOptionalTraining type
        • GENERATION (default) | CLASSIFICATION
          • GENERATION: generation
          • CLASSIFICATION: classification
        trainEpochsStringOptionalNumber of epochs trained on the model
        • 1 ≤ trainEpochs ≤ 20 (default: 8)
        learningRateStringOptionalTraining rate (level or degree to which model parameters are relearned when tuning)
        • 1 ≤ learningRate ≤ 1.0E-6 (default: 1.0E-4)
        trainingDatasetFilePathStringConditionalPath to the dataset file to train on
        • Required when uploaded to the Object Storage service
        trainingDatasetBucketStringConditionalName of the bucket where the dataset file to be trained is uploaded
        • Required when entering trainingDatasetFilePath
        trainingDatasetAccessKeyStringConditionalAccess key for accessing large dataset file to train on
        • Required when entering trainingDatasetFilePath
        trainingDatasetSecretKeyStringConditionalSecret key for accessing large dataset file to train on
        • Required when entering trainingDatasetFilePath

        Request example

        The request example is as follows:

        curl --location --request POST 'https://clovastudio.apigw.ntruss.com/tuning/v2/tasks' \
        --header 'Authorization: Bearer {API Key}' \
        --header 'Content-Type: multipart/form-data' \
        --header 'X-NCP-CLOVASTUDIO-REQUEST-ID: {Request ID}'
        --data '{
          "name": "generation_task",
          "model": "HCX-003",
          "tuningType": "PEFT",
          "taskType": "GENERATION",
          "trainEpochs": 8,
          "learningRate": 1e-5f,
          "trainingDatasetFilePath": "root_path/sub_path/file_name",
          "trainingDatasetBucket": "bucket_name",
          "trainingDatasetAccessKey": "access_key",
          "trainingDatasetSecretKey": "secret_key"
        }'
        Shell

        Response

        This section describes the response format.

        Response headers

        The following describes the response headers.

        HeadersRequiredDescription
        Content-Type-Response data format
        • application/json

        Response body

        The response body includes the following data:

        FieldTypeRequiredDescription
        resultObject-Response result
        result.idString-Training ID
        result.nameString-Training name
        result.modelString-Tuning model name
        result.methodString-Tuning method
        • LoRA
        result.taskTypeString-Training type
        • GENERATION | CLASSIFICATION
          • GENERATION: generation
          • CLASSIFICATION: classification
        result.trainEpochsInteger-Number of epochs trained on the model
        result.learningRateDouble-Training rate (level or degree to which model parameters are retrained when tuning)
        result.statusString-Training progress
        • WAIT | RUNNING | FAILED | SUCCEEDED
          • WAIT: training pending
          • RUNNING: training in progress
          • FAILED: training stopped
          • SUCCEEDED: training completed
        result.statusInfoArray-Training progress details
        result.createdClientTypeString-Type of client requesting training
        • API | WEB
          • API: API client
          • WEB: web client
        result.createdDateString-Training creation date (ISO 8601 format)
        result.updatedDateString-Training modification date (ISO 8601 format)

        statusInfo

        The following describes statusInfo.

        FieldTypeRequiredDescription
        labelArray-
        • When the training type is CLASSIFICATION: User data labels are displayed
        • When the training type is GENERATION: null
        dataRowsInteger-Number of data
        numOfTokensInteger-Number of data tokens
        currStepInteger-Number of current training steps
        totalTrainStepsInteger-Number of total training steps
        currEpochInteger-Current epoch
        totalTrainEpochsInteger-All training epochs
        estimatedTimeInteger-Estimated run time
        • Derived by multiplying the average time of 1 epoch by the total number of training epochs
        trainLossDouble-Training loss
        sendWeightSuccessBoolean-Whether to save training results
        • false | true
          • false: Don't save
          • true: Save
        failureReasonString-Reason for training failure (FAILED)
        messageString-Detailed message for training failure (FAILED) reason
        endDatetimeString-Training end date (in ISO 8601 format)

        failureReason, message

        The following describes training failure reasons (failureReason) and the detailed message (message) for each training failure reason.

        Training failure reasonMessage detailsDescription
        file.extensionUnavailable file extension. Please check the file extension again.The data file extension does not match the requested tuningType
        file.sizeExceeded the disk usage limit. Please check if the file size is {limit} or less.The expected file size for the training request is exceeded
        file.encodingUnsupported charsetNon-UTF8-sig encoding
        file.formatInvalid json format. {reason}Unable to decode the dataset file (.json/.jsonl)
        file.formatInvalid dataset: required field empty. {column}The dataset file does not have the required columns
        file.formatInvalid dataset: unexpected column. {column}The dataset file has unexpected columns
        file.formatInvalid dataset: duplicate columns. {column}The dataset file is not case sensitive and contains duplicate columns
        file.formatInvalid dataset: column orderThe column order in the dataset file deviates from System_Prompt, C_ID, T_ID, Text, and Completion
        file.formatInvalid dataset: {column}The C_ID (or T_ID) in the dataset file does not satisfy the pattern of starting at 0 and incrementing by 1, or the value is empty
        file.error-File read error
        resource.timeout-Response timeout due to GPU acquisition failure; retry required
        clops.error-CLOps error while training
        train.unknown-Non-file related error while training

        Response example

        The response example is as follows:

        Succeeded

        The following is a sample response upon a successful call.

        {
            "status": {
                "code": "20000",
                "message": "OK"
        },
        "result": {
            "id": "czf9fbky",
            "name": "230821-130704",
            "model": "HCX-003",
            "method": "LoRA",
            "taskType": "GENERATION",
            "trainEpochs": 8,
            "learningRate": 1.0E-4,
            "status": "WAIT",
            "statusInfo": {
                "label": null,
                "dataRows": null,
                "numOfTokens": null,
                "currStep": null,
                "totalTrainSteps": null,
                "currEpoch": null,
                "totalTrainEpochs": null,
                "estimatedTime": null,
                "trainLoss": null,
                "sendWeightSuccess": null,
                "failureReason": null,
                "message":null,
                "endDatetime": null
                },
                "createdClientType": "API",
                "createdDate": "2023-08-21T13:07:06+0900",
                "updatedDate": "2023-08-21T13:07:06+0900"
            }
        }
        Python

        Failure

        The following is a sample response upon a failed call.


        Was this article helpful?

        Changing your password will log you out immediately. Use the new password to log back in.
        First name must have atleast 2 characters. Numbers and special characters are not allowed.
        Last name must have atleast 1 characters. Numbers and special characters are not allowed.
        Enter a valid email
        Enter a valid password
        Your profile has been successfully updated.