From b8bea00855bf7fcece01c2108b896e4c164cc624 Mon Sep 17 00:00:00 2001 From: SunXiaoye <31361630+JingofXin@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:30:11 +0800 Subject: [PATCH] Fixed batch_size_per_device and batch_size misuse in LazyLLM (#377) --- lazyllm/components/finetune/llamafactory/sft.yaml | 2 +- lazyllm/tools/train_service/client.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lazyllm/components/finetune/llamafactory/sft.yaml b/lazyllm/components/finetune/llamafactory/sft.yaml index 064a01c5..a615a426 100644 --- a/lazyllm/components/finetune/llamafactory/sft.yaml +++ b/lazyllm/components/finetune/llamafactory/sft.yaml @@ -78,7 +78,7 @@ per_device_train_batch_size: 1 per_device_eval_batch_size: 1 per_gpu_train_batch_size: null per_gpu_eval_batch_size: null -gradient_accumulation_steps: 8 +gradient_accumulation_steps: 1 eval_accumulation_steps: null eval_delay: 0 learning_rate: 1.0e-04 diff --git a/lazyllm/tools/train_service/client.py b/lazyllm/tools/train_service/client.py index 9eda8b2e..c78db833 100644 --- a/lazyllm/tools/train_service/client.py +++ b/lazyllm/tools/train_service/client.py @@ -79,7 +79,7 @@ def train(self, train_config, token): 'num_train_epochs': train_config['num_epochs'], 'learning_rate': train_config['learning_rate'], 'lr_scheduler_type': train_config['lr_scheduler_type'], - 'per_device_train_batch_size': train_config['batch_size'], + 'per_device_train_batch_size': train_config['batch_size'] // train_config['num_gpus'], 'cutoff_len': train_config['cutoff_len'], 'lora_r': train_config['lora_r'], 'lora_alpha': train_config['lora_alpha'],