"git@developer.sourcefind.cn:norm/vllm.git" did not exist on "7717d0838b2b74313184a462bb6e08711a5950c6"
Commit 0a159036 authored by hepj's avatar hepj
Browse files

修改VIT模型loss就地操作

parent c0f05c10
...@@ -53,7 +53,9 @@ def train_one_epoch(model: torch.nn.Module, ...@@ -53,7 +53,9 @@ def train_one_epoch(model: torch.nn.Module,
print("Loss is {}, stopping training".format(loss_value)) print("Loss is {}, stopping training".format(loss_value))
sys.exit(1) sys.exit(1)
loss /= accum_iter loss_new= loss/accum_iter
loss=loss_new
loss_scaler(loss, optimizer, parameters=model.parameters(), loss_scaler(loss, optimizer, parameters=model.parameters(),
update_grad=(data_iter_step + 1) % accum_iter == 0) update_grad=(data_iter_step + 1) % accum_iter == 0)
if (data_iter_step + 1) % accum_iter == 0: if (data_iter_step + 1) % accum_iter == 0:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment