Hugging Face Classification Training
Learn about the hf_clf_train
function within Simplifine’s Train Engine
hf_clf_train(
model_name:str,
dataset_name:str='',
hf_data_column:str='',
hf_label_column:str='',
num_epochs:int=3,
batch_size:int=8,
lr:float=5e-5,
from_hf:bool=True,
hf_token:str='',
inputs:list=[],
labels:list=[],
output_dir:str='clf_output',
use_peft:bool=False,
peft_config=None,
report_to='none',
wandb_api_key:str='',
ddp:bool=False,
zero:bool=False,
fp16:bool=False,
bf16:bool=False,
gradient_accumulation_steps:int=1,
gradient_checkpointing:bool=False
):
The name or path of the pre-trained model to use.
The name of the dataset to be used for training. Defaults to an empty string.
The name of the column in the dataset containing the input data. Defaults to an empty string.
The name of the column in the dataset containing the labels. Defaults to an empty string.
The number of training epochs. Defaults to 3
.
The batch size for training. Defaults to 8
.
The learning rate for optimization. Defaults to 5e-5
.
A flag to determine whether to load the dataset from Hugging Face. Defaults to True
.
The Hugging Face token required for accessing private datasets or models. Defaults to an empty string.
A list of input data for training. Defaults to an empty list.
A list of labels for training. Defaults to an empty list.
The directory to save the output model and logs. Defaults to 'clf_output'
.
A flag to enable Parameter-Efficient Fine-Tuning (PEFT). Defaults to False
.
The configuration object for PEFT. Defaults to None
.
The service to report training logs to (e.g., wandb
). Defaults to 'none'
.
The API key for Weights and Biases (WandB) logging. Defaults to an empty string.
A flag to enable Distributed Data Parallel (DDP) training. Defaults to False
.
A flag to enable ZeRO (Zero Redundancy Optimizer) for memory optimization. Defaults to False
.
A flag to enable 16-bit floating-point (FP16) training. Defaults to False
.
A flag to enable 16-bit Brain Floating Point (BF16) training. Defaults to False
.
The number of steps for gradient accumulation. Defaults to 1
.
A flag to enable gradient checkpointing for reducing memory usage. Defaults to False
.