From ba4c7b85df8ed6069ba647b2cc96d4809ba65837 Mon Sep 17 00:00:00 2001 From: yym68686 Date: Tue, 3 Dec 2024 17:31:49 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=BB=20Code:=20Remove=20unnecessary=20c?= =?UTF-8?q?ode.=20Mode=20switching=20is=20unnecessary;=20the=20model's=20w?= =?UTF-8?q?eight=20values=20will=20not=20change=20due=20to=20mode=20switch?= =?UTF-8?q?ing.=20No=20forward=20computation=20is=20performed;=20it=20only?= =?UTF-8?q?=20saves=20the=20model=20parameters.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1-pretrain.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/1-pretrain.py b/1-pretrain.py index 175c655..b30ebcd 100644 --- a/1-pretrain.py +++ b/1-pretrain.py @@ -89,7 +89,6 @@ def train_epoch(epoch, wandb): "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): - model.eval() moe_path = '_moe' if lm_config.use_moe else '' 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() torch.save(state_dict, ckp) - model.train() def init_model():