Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/lmflow/pipeline/finetuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,7 @@ def __init__(self, n_layers, interval_steps, model):
self.layers_attribute = 'model.transformer.h' # General access path
self.total_layers = len(eval('self.' + self.layers_attribute)) # Dynamically execute to get the number of layers

# Freeze all layers upon initialization
self.freeze_all_layers()
self.switch_active_layers()
self.active_layers_indices = []
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these lines should be swapped, since active_layers_indices is modified by switch_active_layers


def freeze_all_layers(self):
Expand All @@ -323,7 +322,7 @@ def freeze_all_layers(self):

def on_step_begin(self, args, state, control, **kwargs):
# Check if it's time to switch active layers, including at step 0
if state.global_step % self.interval_steps == 0 or state.global_step == 1:
if state.global_step % self.interval_steps == 0 :
self.switch_active_layers()

def switch_active_layers(self):
Expand Down