(Mandatory) Model Startup Script Adaptation

During model adaptation, the model startup script adaptation is a main task. Different parameters need to be defined in a model startup script based on job types, such as fine-tuning, evaluation, and inference.

A model startup script must be a Python file, so modules such as argparse and click are recommended.

Model Fine-Tuning

Startup Script

Parameter

Description

Mandatory Parameter

data_path

Dataset root directory required by fine-tuning. You must define and use this parameter in the model startup script. Otherwise, the job may fail due to incorrectly data loading.

output_path

Root directory of the output path of the model fine-tuning result. You must define and use this parameter in the model startup script. Otherwise, the output file may fail to be saved due to incorrect output path.

Optional Parameter

pretrained_model_path

Root directory of the pre-trained model file. You need to define and use this parameter when loading a pre-trained model before starting a fine-tuning job, and implement the pre-trained model loading logic in the model code. (The specific model file can be configured through the custom model hyperparameters. For details, see (Optional) Model Configuration File Adaptation.) If you do not need to load a pre-trained model, you do not need to define this parameter.

If the model code contains a relative path parameter, switch the tk running directory to the root directory of the model code. For details about the adaptation example of the model fine-tuning startup script, see Model Adaptation Examples.

Model Evaluation

Startup Script

Parameter

Description

Mandatory Parameter

data_path

Dataset root directory required for evaluation. You must define and use this parameter in the model startup script. Otherwise, the job may fail due to incorrectly data loading.

output_path

Root directory of the model evaluation result output path. You must define and use this parameter in the model startup script. Otherwise, the output file may fail to be saved due to incorrect output path. In addition, you need to save the evaluation result as a JSON string in the path and name the file eval_result.json. Otherwise, the evaluation job may fail because the evaluation result cannot be obtained.

ckpt_path

Root directory of the model file to be evaluated. You need to define and use this parameter in the model startup script and implement the model loading logic in the model code. (The specific model file name can be configured in the params part of the configuration file. For details, see (Optional) Model Configuration File Adaptation). Otherwise, the model file may fail to be obtained; as a result, the evaluation result is abnormal.

If the model code contains a relative path parameter, switch the tk running directory to the root directory of the model code. For details about the adaptation example of the model evaluation startup script, see Model Adaptation Examples.

Model Inference

Startup Script

Parameter

Description

Mandatory Parameter

data_path

Dataset root directory required for inference. You must define and use this parameter in the model startup script. Otherwise, the job may fail due to incorrectly data loading.

output_path

Root directory of the model inference result output path. You must define and use this parameter in the model startup script. Otherwise, the output file may fail to be saved due to incorrect output path. In addition, you need to store the inference result as a JSON string in the path and name the file infer_result.json. Otherwise, the inference job may fail because the inference result cannot be obtained.

ckpt_path

Root directory of the model file required for inference. You need to define and use this parameter in the model startup script and implement the model loading logic in the model code. (The specific model file name can be configured in the params part of the configuration file. For details, see (Optional) Model Configuration File Adaptation). Otherwise, the model file may fail to be loaded; as a result, the inference result is abnormal.

If the model code contains a relative path parameter, switch the tk running directory to the root directory of the model code. For details about the adaptation example of the model inference startup script, see Model Adaptation Examples.