💻 Code: Remove unnecessary code. Mode switching is unnecessary; the model's weight values will not change due to mode switching. No forward computation is performed; it only saves the model parameters.

pull/95/head
yym68686 2024-12-03 17:31:49 +08:00 committed by GitHub
parent f7127e4310
commit ba4c7b85df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 0 additions and 2 deletions

View File

@ -89,7 +89,6 @@ def train_epoch(epoch, wandb):
"epoch_Time": spend_time / (step + 1) * iter_per_epoch // 60 - spend_time // 60}) "epoch_Time": spend_time / (step + 1) * iter_per_epoch // 60 - spend_time // 60})
if (step + 1) % args.save_interval == 0 and (not ddp or dist.get_rank() == 0): if (step + 1) % args.save_interval == 0 and (not ddp or dist.get_rank() == 0):
model.eval()
moe_path = '_moe' if lm_config.use_moe else '' moe_path = '_moe' if lm_config.use_moe else ''
ckp = f'{args.save_dir}/pretrain_{lm_config.dim}{moe_path}.pth' ckp = f'{args.save_dir}/pretrain_{lm_config.dim}{moe_path}.pth'
@ -99,7 +98,6 @@ def train_epoch(epoch, wandb):
state_dict = model.state_dict() state_dict = model.state_dict()
torch.save(state_dict, ckp) torch.save(state_dict, ckp)
model.train()
def init_model(): def init_model():