From f90ae217ee1373d2c9617a963b5827fc8739cbf8 Mon Sep 17 00:00:00 2001
From: George Shaikovski <g.shaikov@gmail.com>
Date: Fri, 2 Jun 2023 13:03:38 +0100
Subject: [PATCH] fix warmup LR

LR resets every epoch during warmup to `warmup_start_lr` because it uses inner epoch step counter. We need to use `total_cur_step` to increment LR continuously from epoch to epoch.
---
 minigpt4/common/optims.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/minigpt4/common/optims.py b/minigpt4/common/optims.py
index 58327f7..270e66b 100644
--- a/minigpt4/common/optims.py
+++ b/minigpt4/common/optims.py
@@ -80,7 +80,7 @@ class LinearWarmupCosineLRScheduler:
         total_cur_step = cur_epoch * self.iters_per_epoch + cur_step
         if total_cur_step < self.warmup_steps:
             warmup_lr_schedule(
-                step=cur_step,
+                step=total_cur_step,
                 optimizer=self.optimizer,
                 max_step=self.warmup_steps,
                 init_lr=self.warmup_start_lr,