Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
YizhenJia committed Jan 2, 2025
1 parent 18f5888 commit 4e4139d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lmflow/pipeline/utils/lisa_trainer_fsdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def __init__(
self.active_layers_names = []

layers = self._get_all_body_layers()
print('freeze all layers at lisatrainer init')
for layer in layers:
for param in layer.parameters():
param.requires_grad = False
Expand Down Expand Up @@ -127,9 +128,12 @@ def maybe_switch_active_layers(self):
return

layers = self._get_all_body_layers()
print(self.optimizer.state)
for key in self.optimizer.state.keys():
print(key.shape)
for active_layer_idx in self.active_layers_indices:
for name, param in layers[active_layer_idx].named_parameters():
print(f"{name=}")
print(f"del {name=}")
del self.optimizer.state[param]

self._switch_active_layers()
Expand Down

0 comments on commit 4e4139d

Please sign in to comment.